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