public class ContainerConfig extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CONTENT_CHARSET |
static String |
DEFAULT_URI_ENCODING |
| Constructor and Description |
|---|
ContainerConfig() |
| Modifier and Type | Method and Description |
|---|---|
void |
addBinaryContentTypes(String... contentTypes)
Configure specified content type(s) as binary
|
void |
addCustomDomain(String name)
Adds a new custom domain name to the list of allowed domains
|
void |
addValidFilePath(String filePath)
Adds a new base path to the list of allowed paths.
|
static ContainerConfig |
defaultConfig() |
void |
enableLocalhost()
Enables localhost custom domain name for testing.
|
List<String> |
getCustomDomainNames()
Returns the list of custom domain names enabled for the application
|
String |
getDefaultContentCharset()
Returns the name of the default charset appended to the
Content-Type header if no charset is specified by the request. |
int |
getInitializationTimeout()
Returns the maximum amount of time (in milliseconds) set for the initialization time.
|
String |
getServiceBasePath()
Returns the base path configured in the container.
|
String |
getUriEncoding() |
List<String> |
getValidFilePaths()
Returns the list of file paths that the servlet accepts read/write requests to
|
boolean |
isBinaryContentType(String contentType)
Determine if specified content type has been configured as binary
|
boolean |
isConsolidateSetCookieHeaders() |
boolean |
isDisableExceptionMapper()
Whether the framework will run exception thrown by the application through the implementation of
ExceptionHandler. |
boolean |
isQueryStringCaseSensitive()
Whether query string parameters in the request should be case sensitive or not.
|
boolean |
isStripBasePath() |
boolean |
isUseStageAsServletContext()
Tells whether the stage name passed in the request should be added to the context path:
AwsProxyHttpServletRequest.getContextPath(). |
void |
setConsolidateSetCookieHeaders(boolean consolidateSetCookieHeaders)
Tells the library to consolidate multiple Set-Cookie headers into a single Set-Cookie header with multiple, comma-separated values.
|
void |
setDefaultContentCharset(String defaultContentCharset)
Sets the default charset value for the
Content-Type header if no charset is specified with a request. |
void |
setDisableExceptionMapper(boolean disable)
This configuration parameter tells the container whether it should skip exception mapping and simply let any
Exception thrown by the underlying application bubble up to the Lambda handler class.
|
void |
setInitializationTimeout(int initializationTimeout)
Sets the initialization timeout.
|
void |
setQueryStringCaseSensitive(boolean queryStringCaseSensitive)
Sets whether query string parameter names should be treated as case sensitive.
|
void |
setServiceBasePath(String serviceBasePath)
Configures a base path that can be stripped from the request path before passing it to the framework-specific implementation.
|
void |
setStripBasePath(boolean stripBasePath)
Whether this framework should strip the base path mapping specified with the
setServiceBasePath(String) method from a request before
passing it to the framework-specific implementations |
void |
setUriEncoding(String uriEncoding)
Sets the charset used to URLEncode and Decode request paths.
|
void |
setUseStageAsServletContext(boolean useStageAsServletContext)
Sets whether the API Gateway stage name should be included in the servlet context path.
|
void |
setValidFilePaths(List<String> validFilePaths)
Sets a list of valid file paths for the servlet to read/write from.
|
public static final String DEFAULT_URI_ENCODING
public static final String DEFAULT_CONTENT_CHARSET
public static ContainerConfig defaultConfig()
public String getServiceBasePath()
setStripBasePath(boolean) to route
the request. When requesting the context path from an HttpServletRequest: AwsProxyHttpServletRequest.getContextPath() this base path is added
to the context even though it was initially stripped for the purpose of routing the request. We decided to add it to the context to address GitHub issue
#84 and allow framework's link builders to it.public void setServiceBasePath(String serviceBasePath)
serviceBasePath - The base path mapping to be removed.public boolean isStripBasePath()
public void setStripBasePath(boolean stripBasePath)
setServiceBasePath(String) method from a request before
passing it to the framework-specific implementationsstripBasePath - public String getUriEncoding()
public void setUriEncoding(String uriEncoding)
uriEncoding - The charset. By default this is set to UTF-8public boolean isConsolidateSetCookieHeaders()
public void setConsolidateSetCookieHeaders(boolean consolidateSetCookieHeaders)
consolidateSetCookieHeaders - Whether to consolidate the cookie headers or not.public boolean isUseStageAsServletContext()
AwsProxyHttpServletRequest.getContextPath().public void setUseStageAsServletContext(boolean useStageAsServletContext)
useStageAsServletContext - true if you want the stage to appear as the root of the context path, false otherwise.public List<String> getValidFilePaths()
public void setValidFilePaths(List<String> validFilePaths)
validFilePaths - A populated list of base pathspublic void addValidFilePath(String filePath)
filePath - The base pathpublic void addCustomDomain(String name)
name - The new custom domain name, excluding the scheme ("https") and portpublic List<String> getCustomDomainNames()
public void enableLocalhost()
public boolean isQueryStringCaseSensitive()
false for backward compatibility.true if the parameter matching algorithm is case sensitivepublic void setQueryStringCaseSensitive(boolean queryStringCaseSensitive)
false for backward compatibility.queryStringCaseSensitive - Tells the framework to treat query string parameter names as case sensitivepublic void addBinaryContentTypes(String... contentTypes)
contentTypes - list of exact content types that will be considered as binarypublic boolean isBinaryContentType(String contentType)
contentType - content type to querypublic String getDefaultContentCharset()
Content-Type header if no charset is specified by the request. The
default value of this is ISO-8859-1.public void setDefaultContentCharset(String defaultContentCharset)
Content-Type header if no charset is specified with a request. The default value of this
is ISO-8859-1. If a request specifies a Content-Type header without a charset property, the value of
this field is automatically appended to the header.defaultContentCharset - The name of the charset for the content type header.public int getInitializationTimeout()
setInitializationTimeout(int) for additional details.public void setInitializationTimeout(int initializationTimeout)
InitializationWrapper
the underlying framework is initialized in a separate thread. Serverless Java Container will wait for the maximum
time available during AWS Lambda's init step (~10 seconds) and then return control to the main thread. In the meanwhile,
the initialization process of the underlying framework can continue in a separate thread. AWS Lambda will then call
the handler class to handle an event. This timeout is the maximum amount of time Serverless Java Container framework
will wait for the underlying framework to initialize before returning an error. By default, this is set to 10 seconds.initializationTimeout - The maximum amount of time to wait for the underlying framework initialization after
an event is received in milliseconds.public boolean isDisableExceptionMapper()
ExceptionHandler. When this parameter is set to false the Lambda
container handler object lets the Exception propagate upwards to the Lambda handler class.true if exception mapping is disabled, false otherwise.public void setDisableExceptionMapper(boolean disable)
disable - Set this value to true to disable exception mapping, false otherwise.Copyright © 2022. All rights reserved.