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// @formatter:off
037@Rest(
038   // Configuration file.
039   config="$S{j.configFile,$E{J_CONFIG_FILE,SYSTEM_DEFAULT}}",
040
041   // Standard fields.
042   path="",
043   roleGuard="",
044   rolesDeclared="",
045
046   // Configuration beans.
047   converters={},
048   encoders={IdentityEncoder.class},
049   guards={},
050   parsers={},
051   partParser=OpenApiParser.class,
052   partSerializer=OpenApiSerializer.class,
053   responseProcessors={
054      ReaderProcessor.class,
055      InputStreamProcessor.class,
056      ThrowableProcessor.class,
057      HttpResponseProcessor.class,
058      HttpResourceProcessor.class,
059      HttpEntityProcessor.class,
060      ResponseBeanProcessor.class,
061      PlainTextPojoProcessor.class,
062      SerializedPojoProcessor.class
063   },
064   restOpArgs={
065      AttributeArg.class,
066      ContentArg.class,
067      FormDataArg.class,
068      HasFormDataArg.class,
069      HasQueryArg.class,
070      HeaderArg.class,
071      HttpServletRequestArgs.class,
072      HttpServletResponseArgs.class,
073      HttpSessionArgs.class,
074      InputStreamParserArg.class,
075      MethodArg.class,
076      ParserArg.class,
077      PathArg.class,
078      QueryArg.class,
079      ReaderParserArg.class,
080      RequestBeanArg.class,
081      ResponseBeanArg.class,
082      ResponseHeaderArg.class,
083      ResponseCodeArg.class,
084      RestContextArgs.class,
085      RestSessionArgs.class,
086      RestOpContextArgs.class,
087      RestOpSessionArgs.class,
088      RestRequestArgs.class,
089      RestResponseArgs.class,
090      DefaultArg.class
091   },
092   serializers={},
093
094   // Configurable settings.
095   allowedHeaderParams="$S{j.allowedHeaderParams,$E{J_ALLOWED_HEADER_PARAMS,Accept,Content-Type}}",
096   allowedMethodHeaders="$S{j.allowedMethodHeaders,$E{J_ALLOWED_METHOD_HEADERS,}}",
097   allowedMethodParams="$S{j.allowedMethodParams,$E{J_ALLOWED_METHOD_PARAMS,HEAD,OPTIONS}}",
098   clientVersionHeader="$S{j.clientVersionHeader,$E{J_CLIENT_VERSION_HEADER,Client-Version}}",
099   debug="$S{j.debug,$E{J_DEBUG,}}",
100   debugOn="$S{j.debugOn,$E{J_DEBUG_ON,}}",
101   defaultAccept="$S{j.defaultAccept,$E{J_DEFAULT_ACCEPT,}}",
102   defaultCharset="$S{j.defaultCharset,$E{J_DEFAULT_CHARSET,UTF-8}}",
103   defaultContentType="$S{j.defaultContentType,$E{J_DEFAULT_CONTENT_TYPE,}}",
104   defaultRequestAttributes="$S{j.defaultRequestAttributes,$E{J_DEFAULT_REQUEST_ATTRIBUTES,}}",
105   defaultRequestHeaders="$S{j.defaultRequestHeaders,$E{J_DEFAULT_REQUEST_HEADERS,}}",
106   defaultResponseHeaders="$S{j.defaultResponseHeaders,$E{J_DEFAULT_RESPONSE_HEADERS,}}",
107   disableContentParam="$S{j.disableContentParam,$E{J_DISABLE_CONTENT_PARAM,false}}",
108   maxInput="$S{j.maxInput,$E{J_MAX_INPUT,1000000}}",
109   messages="$S{j.messages,$E{J_MESSAGES,}}",
110   renderResponseStackTraces="$S{j.renderResponseStackTraces,$E{J_RENDER_RESPONSE_STACK_TRACES,false}}",
111   uriAuthority="$S{j.uriAuthority,$E{J_URI_AUTHORITY,}}",
112   uriContext="$S{j.uriContext,$E{J_URI_CONTEXT,}}",
113   uriRelativity="$S{j.uriRelativity,$E{J_URI_RELATIVITY,}}",
114   uriResolution="$S{j.uriResolution,$E{J_URI_RESOLUTION,}}",
115
116   // Metadata settings.
117   consumes={},
118   description="",
119   produces={},
120   siteName="$S{j.siteName,$E{J_SITE_NAME,}}",
121   swagger=@Swagger,
122   title="$S{j.title,$E{J_TITLE,}}",
123
124   // Injectable/overridable beans.
125   beanStore=BeanStore.Void.class,  // Defaults to BeanStore.
126   callLogger=CallLogger.Void.class,  // Defaults to BasicCallLogger.
127   debugEnablement=DebugEnablement.Void.class,  // Defaults to BasicDefaultEnablement.
128   staticFiles=StaticFiles.Void.class,  // Defaults to BasicStaticFiles.
129   swaggerProvider=SwaggerProvider.Void.class,  // Defaults to BasicSwaggerProvider.
130
131   // Overridable context classes.
132   restChildrenClass=RestChildren.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 {}