Class RequestWrapper
java.lang.Object
spark.Request
spark.http.matching.RequestWrapper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TGets the value of the provided attributevoidSets an attribute on the request (can be fetched in filters/routes later in the chain)body()byte[]voidchangeMatch(RouteMatch match) intGets cookie by name.cookies()(package private) static RequestWrappercreate()boolean(package private) RequestinthashCode()headers()Gets the value for the provided headerhost()ip()params()Returns the map containing all route paramsReturns the value of the provided route pattern parameter.pathInfo()intport()protocol()queryMap()queryParams(String queryParam) Gets the query paramqueryParamsSafe(String queryParam) Gets the query param and encode itString[]queryParamsValues(String queryParam) Gets all the values of the query param Example: query parameter 'id' from the following request URI: /hello?id=foo&id=barjavax.servlet.http.HttpServletRequestraw()scheme()session()Returns the current session associated with this request, or if the request does not have a session, creates one.session(boolean create) Returns the current session associated with this request, or if there is no current session andcreateis true, returns a new session.voidsetDelegate(Request delegate) String[]splat()toString()uri()url()Methods inherited from class Request
queryParamOrDefault
-
Field Details
-
delegate
-
-
Constructor Details
-
RequestWrapper
private RequestWrapper()
-
-
Method Details
-
create
-
setDelegate
-
getDelegate
Request getDelegate() -
changeMatch
- Overrides:
changeMatchin classRequest
-
requestMethod
- Overrides:
requestMethodin classRequest- Returns:
- request method e.g. GET, POST, PUT, ...
-
scheme
-
port
-
pathInfo
-
matchedPath
- Overrides:
matchedPathin classRequest- Returns:
- the matched route Example return: "/account/:accountId"
-
servletPath
- Overrides:
servletPathin classRequest- Returns:
- the servlet path
-
contextPath
- Overrides:
contextPathin classRequest- Returns:
- the context path
-
contentType
- Overrides:
contentTypein classRequest- Returns:
- the content type of the body
-
body
-
bodyAsBytes
public byte[] bodyAsBytes()- Overrides:
bodyAsBytesin classRequest
-
contentLength
public int contentLength()- Overrides:
contentLengthin classRequest- Returns:
- the length of request.body
-
equals
-
hashCode
-
params
-
params
Description copied from class:RequestReturns the value of the provided route pattern parameter. Example: parameter 'name' from the following pattern: (get '/hello/:name') -
splat
-
host
-
ip
-
queryParams
Description copied from class:RequestGets the query param- Overrides:
queryParamsin classRequest- Parameters:
queryParam- the query parameter- Returns:
- the value of the provided queryParam Example: query parameter 'id' from the following request URI: /hello?id=foo
-
queryParamsSafe
Description copied from class:RequestGets the query param and encode it- Overrides:
queryParamsSafein classRequest- Parameters:
queryParam- the query parameter- Returns:
- the encode value of the provided queryParam Example: query parameter 'me' from the URI: /hello?id=fool.
-
queryParamsValues
Description copied from class:RequestGets all the values of the query param Example: query parameter 'id' from the following request URI: /hello?id=foo&id=bar- Overrides:
queryParamsValuesin classRequest- Parameters:
queryParam- the query parameter- Returns:
- the values of the provided queryParam, null if it doesn't exists
-
headers
-
queryParams
- Overrides:
queryParamsin classRequest- Returns:
- all query parameters
-
headers
-
queryString
- Overrides:
queryStringin classRequest- Returns:
- the query string
-
raw
-
toString
-
userAgent
-
url
-
uri
-
protocol
-
attribute
-
attribute
Description copied from class:RequestGets the value of the provided attribute -
attributes
- Overrides:
attributesin classRequest- Returns:
- all attributes
-
session
-
session
Description copied from class:RequestReturns the current session associated with this request, or if there is no current session andcreateis true, returns a new session. -
queryMap
-
queryMap
-
cookies
-
cookie
-