-
- All Implemented Interfaces:
public final class RequestLists would be initialized loading all elements when they are used (set it as lazy in implementations) this will have a performance penalty in favor of ease of use. The alternative would be using a 'Map/List wrapper that delegates calls to abstract methods in the interface (I won't do this just now).
HTTP request context. It holds client supplied data and methods to change the response.
-
-
Field Summary
Fields Modifier and Type Field Description private final Methodmethodprivate final Stringschemeprivate final Stringhostprivate final Stringipprivate final Integerportprivate final Stringpathprivate final StringqueryStringprivate final Stringurlprivate final Map<String, Part>partsprivate final Map<String, List<String>>queryParametersValuesprivate final Map<String, List<String>>formParametersValuesprivate final Map<String, String>queryParametersprivate final Map<String, String>formParametersprivate final Map<String, String>pathParametersprivate final List<X509Certificate>certificateChainprivate final Booleansecureprivate final List<String>acceptValuesprivate final Stringacceptprivate final StringpreferredTypeprivate final StringuserAgentprivate final Stringrefererprivate final Stringoriginprivate final X509Certificatecertificateprivate final Stringbodyprivate final Map<String, List<String>>headersValuesprivate final Map<String, String>headersprivate final Map<String, Cookie>cookiesprivate final StringcontentTypeprivate final LongcontentLength
-
Constructor Summary
Constructors Constructor Description Request(RequestPort adapter)
-
Method Summary
Modifier and Type Method Description final MethodgetMethod()Provides the HTTP method of the request. final StringgetScheme()Provides the name of the scheme used to make this request. final StringgetHost()Provides the fully qualified name of the client. final StringgetIp()Provides the client IP address. final IntegergetPort()Provides the port number used to make the request. final StringgetPath()Provides the servlet path of the request. final StringgetQueryString()Provides the query string of the request. final StringgetUrl()Provides the URL client used to make the request. final Map<String, Part>getParts()Provides a Map of multipart parts in the request. final Map<String, List<String>>getQueryParametersValues()Provides Map of parsed key-value pairs of query parameters in the request. final Map<String, List<String>>getFormParametersValues()Provides Map of request parameters contained in form fields. final Map<String, String>getQueryParameters()Provides a Map of first values of all query parameters in the request. final Map<String, String>getFormParameters()Provides a Map of first values of all form fields. final Map<String, String>getPathParameters()Provides a Map of all path parameters. final List<X509Certificate>getCertificateChain()Provides a List of certificate chain used for SSL. final BooleangetSecure()Check if the request is secure. final List<String>getAcceptValues()List of parameters for "Accept" header key. final StringgetAccept()First value in "Accept" header key. final StringgetPreferredType()Preferred content-type specified under "Accept" header key. final StringgetUserAgent()First value of "User-Agent" header key. final StringgetReferer()First value of "Referer" header key. final StringgetOrigin()First value of "Origin" header key. final X509CertificategetCertificate()First certificate in the certificateChain. final StringgetBody()Request body sent by the client. final Map<String, List<String>>getHeadersValues()Map of header values of the request. final Map<String, String>getHeaders()Map of first values of the headers of the request. final Map<String, Cookie>getCookies()Map of the cookies contained in the browser. final StringgetContentType()Content type of the request body. final LonggetContentLength()Length of the request body. final <T extends Any> Tbody(KClass<T> type)Parses request body according to given type. final <T extends Any> Tbody()Parses request body. final <T extends Any> List<T>bodyObjects(KClass<T> type)Parses request body objects to given type. final <T extends Any> List<T>bodyObjects()Parses request body objects. final Map<String, Object>allParameters()Aggregates path parameters, form parameters and query parameters into a map. -
-
Constructor Detail
-
Request
Request(RequestPort adapter)
-
-
Method Detail
-
getMethod
final Method getMethod()
Provides the HTTP method of the request.
-
getQueryString
final String getQueryString()
Provides the query string of the request.
-
getQueryParametersValues
final Map<String, List<String>> getQueryParametersValues()
Provides Map of parsed key-value pairs of query parameters in the request.
-
getFormParametersValues
final Map<String, List<String>> getFormParametersValues()
Provides Map of request parameters contained in form fields.
-
getQueryParameters
final Map<String, String> getQueryParameters()
Provides a Map of first values of all query parameters in the request.
-
getFormParameters
final Map<String, String> getFormParameters()
Provides a Map of first values of all form fields.
-
getPathParameters
final Map<String, String> getPathParameters()
Provides a Map of all path parameters.
-
getCertificateChain
final List<X509Certificate> getCertificateChain()
Provides a List of certificate chain used for SSL.
-
getAcceptValues
final List<String> getAcceptValues()
List of parameters for "Accept" header key.
-
getPreferredType
final String getPreferredType()
Preferred content-type specified under "Accept" header key.
-
getUserAgent
final String getUserAgent()
First value of "User-Agent" header key.
-
getReferer
final String getReferer()
First value of "Referer" header key.
-
getCertificate
final X509Certificate getCertificate()
First certificate in the certificateChain.
-
getHeadersValues
final Map<String, List<String>> getHeadersValues()
Map of header values of the request.
-
getHeaders
final Map<String, String> getHeaders()
Map of first values of the headers of the request.
-
getCookies
final Map<String, Cookie> getCookies()
Map of the cookies contained in the browser.
-
getContentType
final String getContentType()
Content type of the request body.
-
getContentLength
final Long getContentLength()
Length of the request body.
-
body
final <T extends Any> T body(KClass<T> type)
Parses request body according to given type.
- Parameters:
type- Class specifying the type to which the body is to be parsed
-
bodyObjects
final <T extends Any> List<T> bodyObjects(KClass<T> type)
Parses request body objects to given type.
- Parameters:
type- Class specifying the type to which the objects are to be parsed
-
bodyObjects
final <T extends Any> List<T> bodyObjects()
Parses request body objects.
-
allParameters
final Map<String, Object> allParameters()
Aggregates path parameters, form parameters and query parameters into a map.
-
-
-
-