public abstract class AwsHttpServletRequest extends Object implements javax.servlet.http.HttpServletRequest
HttpServletRequest can extend this class to reuse
the utility methods| Modifier and Type | Class and Description |
|---|---|
static class |
AwsHttpServletRequest.HeaderValue
Class that represents a header value.
|
| Modifier and Type | Field and Description |
|---|---|
protected AwsLambdaServletContainerHandler |
containerHandler |
protected javax.servlet.ServletInputStream |
requestInputStream |
protected AwsHttpServletResponse |
response |
| Modifier | Constructor and Description |
|---|---|
protected |
AwsHttpServletRequest(com.amazonaws.services.lambda.runtime.Context lambdaContext)
Protected constructors for implementing classes.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
appendCharacterEncoding(String currentContentType,
String newEncoding) |
protected javax.servlet.ServletInputStream |
bodyStringToInputStream(String body,
boolean isBase64Encoded) |
String |
changeSessionId() |
protected String |
generateContextPath(ContainerConfig config,
String apiStage) |
protected Map<String,String[]> |
generateParameterMap(MultiValuedTreeMap<String,String> qs,
ContainerConfig config) |
protected String |
generateQueryString(MultiValuedTreeMap<String,String> parameters,
boolean encode,
String encodeCharset)
Given a map of key/values query string parameters from API Gateway, creates a query string as it would have
been in the original url.
|
protected StringBuffer |
generateRequestURL(String requestPath) |
Object |
getAttribute(String s) |
Enumeration<String> |
getAttributeNames() |
javax.servlet.DispatcherType |
getDispatcherType() |
protected String |
getFirstQueryParamValue(MultiValuedTreeMap<String,String> queryString,
String key,
boolean isCaseSensitive) |
protected String[] |
getFormBodyParameterCaseInsensitive(String key) |
protected Map<String,List<String>> |
getFormUrlEncodedParametersMap() |
String |
getLocalAddr() |
String |
getLocalName() |
int |
getLocalPort() |
protected Map<String,javax.servlet.http.Part> |
getMultipartFormParametersMap() |
protected String[] |
getQueryParamValues(MultiValuedTreeMap<String,String> qs,
String key,
boolean isCaseSensitive) |
String |
getRequestedSessionId() |
AwsHttpServletResponse |
getResponse() |
protected String |
getSchemeFromHeader(Headers headers) |
String |
getServerName() |
int |
getServerPort() |
javax.servlet.ServletContext |
getServletContext() |
String |
getServletPath() |
javax.servlet.http.HttpSession |
getSession() |
javax.servlet.http.HttpSession |
getSession(boolean b) |
boolean |
isAsyncStarted() |
boolean |
isAsyncSupported() |
boolean |
isRequestedSessionIdFromCookie() |
boolean |
isRequestedSessionIdFromUrl()
Deprecated.
|
boolean |
isRequestedSessionIdFromURL() |
boolean |
isRequestedSessionIdValid() |
protected String |
parseCharacterEncoding(String contentTypeHeader) |
protected javax.servlet.http.Cookie[] |
parseCookieHeaderValue(String headerValue)
Given the Cookie header value, parses it and creates a Cookie object
|
protected List<AwsHttpServletRequest.HeaderValue> |
parseHeaderValue(String headerValue)
Prases a header value using the default value separator "," and qualifier separator ";".
|
protected List<AwsHttpServletRequest.HeaderValue> |
parseHeaderValue(String headerValue,
String valueSeparator,
String qualifierSeparator)
Generic method to parse an HTTP header value and split it into a list of key/values for all its components.
|
void |
removeAttribute(String s) |
void |
setAttribute(String s,
Object o) |
void |
setContainerHandler(AwsLambdaServletContainerHandler containerHandler) |
void |
setResponse(AwsHttpServletResponse response) |
void |
setServletContext(javax.servlet.ServletContext context) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitauthenticate, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestURI, getRequestURL, getUserPrincipal, isUserInRole, login, logout, upgradegetAsyncContext, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getInputStream, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, isSecure, setCharacterEncoding, startAsync, startAsyncprotected AwsHttpServletResponse response
protected AwsLambdaServletContainerHandler containerHandler
protected javax.servlet.ServletInputStream requestInputStream
protected AwsHttpServletRequest(com.amazonaws.services.lambda.runtime.Context lambdaContext)
lambdaContext - The Lambda function context. This object is used for utility methods such as logpublic AwsHttpServletResponse getResponse()
public void setResponse(AwsHttpServletResponse response)
public void setContainerHandler(AwsLambdaServletContainerHandler containerHandler)
public String getRequestedSessionId()
getRequestedSessionId in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.HttpSession getSession(boolean b)
getSession in interface javax.servlet.http.HttpServletRequestpublic javax.servlet.http.HttpSession getSession()
getSession in interface javax.servlet.http.HttpServletRequestpublic String changeSessionId()
changeSessionId in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdValid()
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequestpublic boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequest@Deprecated public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequestpublic Object getAttribute(String s)
getAttribute in interface javax.servlet.ServletRequestpublic Enumeration<String> getAttributeNames()
getAttributeNames in interface javax.servlet.ServletRequestpublic String getServerName()
getServerName in interface javax.servlet.ServletRequestpublic int getServerPort()
getServerPort in interface javax.servlet.ServletRequestpublic void setAttribute(String s, Object o)
setAttribute in interface javax.servlet.ServletRequestpublic void removeAttribute(String s)
removeAttribute in interface javax.servlet.ServletRequestpublic String getLocalName()
getLocalName in interface javax.servlet.ServletRequestpublic String getLocalAddr()
getLocalAddr in interface javax.servlet.ServletRequestpublic int getLocalPort()
getLocalPort in interface javax.servlet.ServletRequestpublic javax.servlet.ServletContext getServletContext()
getServletContext in interface javax.servlet.ServletRequestpublic boolean isAsyncStarted()
isAsyncStarted in interface javax.servlet.ServletRequestpublic boolean isAsyncSupported()
isAsyncSupported in interface javax.servlet.ServletRequestpublic javax.servlet.DispatcherType getDispatcherType()
getDispatcherType in interface javax.servlet.ServletRequestpublic String getServletPath()
getServletPath in interface javax.servlet.http.HttpServletRequestpublic void setServletContext(javax.servlet.ServletContext context)
protected javax.servlet.http.Cookie[] parseCookieHeaderValue(String headerValue)
headerValue - The string value of the HTTP Cookie headerprotected String generateQueryString(MultiValuedTreeMap<String,String> parameters, boolean encode, String encodeCharset) throws javax.servlet.ServletException
parameters - A Map<String, String> of query string parametersencode - Whether the key and values should be URL encodedencodeCharset - Charset to use for encoding the query stringjavax.servlet.ServletExceptionprotected String generateContextPath(ContainerConfig config, String apiStage)
protected StringBuffer generateRequestURL(String requestPath)
protected String appendCharacterEncoding(String currentContentType, String newEncoding)
protected javax.servlet.ServletInputStream bodyStringToInputStream(String body, boolean isBase64Encoded) throws IOException
IOExceptionprotected String getFirstQueryParamValue(MultiValuedTreeMap<String,String> queryString, String key, boolean isCaseSensitive)
protected String[] getFormBodyParameterCaseInsensitive(String key)
protected Map<String,javax.servlet.http.Part> getMultipartFormParametersMap()
protected String[] getQueryParamValues(MultiValuedTreeMap<String,String> qs, String key, boolean isCaseSensitive)
protected Map<String,String[]> generateParameterMap(MultiValuedTreeMap<String,String> qs, ContainerConfig config)
protected List<AwsHttpServletRequest.HeaderValue> parseHeaderValue(String headerValue)
headerValue - The value to be parsedprotected List<AwsHttpServletRequest.HeaderValue> parseHeaderValue(String headerValue, String valueSeparator, String qualifierSeparator)
Accept: application/json; application/xml will contain two
key value pairs with key null and the value set to application/json and application/xml respectively.headerValue - The string value for the HTTP headervalueSeparator - The separator to be used for parsing header valuesCopyright © 2022. All rights reserved.