001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2015 ForgeRock AS. 015 */ 016 017package org.forgerock.http.routing; 018 019import org.forgerock.http.header.AcceptApiVersionHeader; 020import org.forgerock.http.header.WarningHeader; 021 022/** 023 * Implementations of this interface will be responsible for maintaining the 024 * behaviour of API Version routing. 025 * 026 * <p>API Version routing can issue a {@link WarningHeader} if no 027 * {@literal Accept-API-Version} header is set on the request. In addition a 028 * default behaviour can be set to determine how the route will compare 029 * matching API Version routes.</p> 030 * 031 * @see WarningHeader 032 * @see AcceptApiVersionHeader 033 * @see DefaultVersionBehaviour 034 */ 035public interface ResourceApiVersionBehaviourManager { 036 037 /** 038 * Sets if warning headers should be set on the response if no 039 * {@literal Accept-API-Version} header is present on the request. 040 * 041 * @param warningEnabled {@code true} if warning headers should be set. 042 */ 043 void setWarningEnabled(boolean warningEnabled); 044 045 /** 046 * Returns {@code true} if warning headers should be set on the response if 047 * no {@literal Accept-API-Version} header is present on the request. 048 * 049 * @return {@code true} if warning headers should be set. 050 */ 051 boolean isWarningEnabled(); 052 053 /** 054 * Sets the default routing behaviour to use when the request does not 055 * contain the {@literal Accept-API-Version} header. 056 * 057 * @param behaviour The default routing behaviour when no 058 * {@literal Accept-API-Version} header is present on the request. 059 */ 060 void setDefaultVersionBehaviour(DefaultVersionBehaviour behaviour); 061 062 /** 063 * Gets the default routing behaviour to use when the request does not 064 * contain the {@literal Accept-API-Version} header. 065 * 066 * @return The default routing behaviour when no 067 * {@literal Accept-API-Version} header is present on the request. 068 */ 069 DefaultVersionBehaviour getDefaultVersionBehaviour(); 070}