001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.rest.config;
014
015import org.apache.juneau.annotation.*;
016import org.apache.juneau.cp.*;
017import org.apache.juneau.encoders.*;
018import org.apache.juneau.rest.*;
019import org.apache.juneau.rest.annotation.*;
020import org.apache.juneau.rest.arg.*;
021import org.apache.juneau.rest.debug.*;
022import org.apache.juneau.rest.logger.*;
023import org.apache.juneau.rest.processor.*;
024import org.apache.juneau.rest.staticfile.*;
025import org.apache.juneau.rest.swagger.*;
026import org.apache.juneau.serializer.annotation.*;
027import org.apache.juneau.oapi.*;
028
029/**
030 * Predefined REST configuration that defines common default values for all configurations.
031 */
032@Rest(
033   // Configuration file.
034   config="$S{j.configFile,$E{J_CONFIG_FILE,SYSTEM_DEFAULT}}",
035
036   // Standard fields.
037   path="",
038   roleGuard="",
039   rolesDeclared="",
040
041   // Configuration beans.
042   converters={},
043   encoders={IdentityEncoder.class},
044   guards={},
045   parsers={},
046   partParser=OpenApiParser.class,
047   partSerializer=OpenApiSerializer.class,
048   responseProcessors={
049      ReaderProcessor.class,
050      InputStreamProcessor.class,
051      ThrowableProcessor.class,
052      HttpResponseProcessor.class,
053      HttpResourceProcessor.class,
054      HttpEntityProcessor.class,
055      ResponseBeanProcessor.class,
056      PlainTextPojoProcessor.class,
057      SerializedPojoProcessor.class
058   },
059   restOpArgs={
060      AttributeArg.class,
061      ContentArg.class,
062      FormDataArg.class,
063      HasFormDataArg.class,
064      HasQueryArg.class,
065      HeaderArg.class,
066      HttpServletRequestArgs.class,
067      HttpServletResponseArgs.class,
068      HttpSessionArgs.class,
069      InputStreamParserArg.class,
070      MethodArg.class,
071      ParserArg.class,
072      PathArg.class,
073      QueryArg.class,
074      ReaderParserArg.class,
075      RequestBeanArg.class,
076      ResponseBeanArg.class,
077      ResponseHeaderArg.class,
078      ResponseCodeArg.class,
079      RestContextArgs.class,
080      RestSessionArgs.class,
081      RestOpContextArgs.class,
082      RestOpSessionArgs.class,
083      RestRequestArgs.class,
084      RestResponseArgs.class,
085      DefaultArg.class
086   },
087   serializers={},
088
089   // Configurable settings.
090   allowedHeaderParams="$S{j.allowedHeaderParams,$E{J_ALLOWED_HEADER_PARAMS,Accept,Content-Type}}",
091   allowedMethodHeaders="$S{j.allowedMethodHeaders,$E{J_ALLOWED_METHOD_HEADERS,}}",
092   allowedMethodParams="$S{j.allowedMethodParams,$E{J_ALLOWED_METHOD_PARAMS,HEAD,OPTIONS}}",
093   clientVersionHeader="$S{j.clientVersionHeader,$E{J_CLIENT_VERSION_HEADER,Client-Version}}",
094   debug="$S{j.debug,$E{J_DEBUG,}}",
095   debugOn="$S{j.debugOn,$E{J_DEBUG_ON,}}",
096   defaultAccept="$S{j.defaultAccept,$E{J_DEFAULT_ACCEPT,}}",
097   defaultCharset="$S{j.defaultCharset,$E{J_DEFAULT_CHARSET,UTF-8}}",
098   defaultContentType="$S{j.defaultContentType,$E{J_DEFAULT_CONTENT_TYPE,}}",
099   defaultRequestAttributes="$S{j.defaultRequestAttributes,$E{J_DEFAULT_REQUEST_ATTRIBUTES,}}",
100   defaultRequestHeaders="$S{j.defaultRequestHeaders,$E{J_DEFAULT_REQUEST_HEADERS,}}",
101   defaultResponseHeaders="$S{j.defaultResponseHeaders,$E{J_DEFAULT_RESPONSE_HEADERS,}}",
102   disableContentParam="$S{j.disableContentParam,$E{J_DISABLE_CONTENT_PARAM,false}}",
103   maxInput="$S{j.maxInput,$E{J_MAX_INPUT,1000000}}",
104   messages="$S{j.messages,$E{J_MESSAGES,}}",
105   renderResponseStackTraces="$S{j.renderResponseStackTraces,$E{J_RENDER_RESPONSE_STACK_TRACES,false}}",
106   uriAuthority="$S{j.uriAuthority,$E{J_URI_AUTHORITY,}}",
107   uriContext="$S{j.uriContext,$E{J_URI_CONTEXT,}}",
108   uriRelativity="$S{j.uriRelativity,$E{J_URI_RELATIVITY,}}",
109   uriResolution="$S{j.uriResolution,$E{J_URI_RESOLUTION,}}",
110
111   // Metadata settings.
112   consumes={},
113   description="",
114   produces={},
115   siteName="$S{j.siteName,$E{J_SITE_NAME,}}",
116   swagger=@Swagger,
117   title="$S{j.title,$E{J_TITLE,}}",
118
119   // Injectable/overridable beans.
120   beanStore=BeanStore.Void.class,  // Defaults to BeanStore.
121   callLogger=CallLogger.Void.class,  // Defaults to BasicCallLogger.
122   debugEnablement=DebugEnablement.Void.class,  // Defaults to BasicDefaultEnablement.
123   staticFiles=StaticFiles.Void.class,  // Defaults to BasicStaticFiles.
124   swaggerProvider=SwaggerProvider.Void.class,  // Defaults to BasicSwaggerProvider.
125
126   // Overridable context classes.
127   restChildrenClass=RestChildren.class,
128   restOperationsClass=RestOperations.class
129)
130@BeanConfig(
131   // When parsing generated beans, ignore unknown properties that may only exist as getters and not setters.
132   ignoreUnknownBeanProperties="true",
133   ignoreUnknownEnumValues="true"
134)
135@SerializerConfig(
136   // Enable automatic resolution of URI objects to root-relative values.
137   uriResolution="ROOT_RELATIVE"
138)
139public interface DefaultConfig {}