Package io.mangoo.routing.bindings
Class Request
java.lang.Object
io.mangoo.routing.bindings.Validator
io.mangoo.routing.bindings.Request
- All Implemented Interfaces:
Serializable
- Author:
- svenkubiak
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, Object value) Adds an attribute to the internal attributes mapRetrieves the clients accepted languagesgetAttribute(String key) Returns an object attribute from a given keyReturns an object attribute from a given keygetBody()com.jayway.jsonpath.ReadContextReturns the request charset.longio.undertow.server.handlers.CookieRetrieves a single cookie from the requestgetHeader(io.undertow.util.HttpString headerName) Retrieves a specific header value by its nameRetrieves a specific header value by its nameio.undertow.util.HeaderMapRetrieves a list of all headers send by the clientio.undertow.util.HttpStringGet the HTTP request method.Retrieves a map of request parameter (request or query parameter)getParameter(String key) Retrieves a request parameter (request or query parameter) by its namegetPath()The request path.Get the request URI scheme.getURI()The original request URI.getURL()Reconstructs the complete URL as seen by the user.withAuthentication(Authentication authentication) withParameter(Map<String, String> parameter) withSession(Session session) Methods inherited from class io.mangoo.routing.bindings.Validator
addValue, expectDomainName, expectDomainName, expectEmail, expectEmail, expectExactMatch, expectExactMatch, expectFalse, expectFalse, expectIpv4, expectIpv4, expectIpv6, expectIpv6, expectMatch, expectMatch, expectMatch, expectMatch, expectMaxLength, expectMaxLength, expectMaxValue, expectMaxValue, expectMinLength, expectMinLength, expectMinValue, expectMinValue, expectNotNull, expectNotNull, expectNull, expectNull, expectNumeric, expectNumeric, expectRangeLength, expectRangeLength, expectRangeValue, expectRangeValue, expectRegex, expectRegex, expectTrue, expectTrue, expectUrl, expectUrl, expectValue, expectValue, get, getError, getErrors, hasError, hasErrors, invalidate, isValid, setValues
-
Constructor Details
-
Request
public Request() -
Request
public Request(io.undertow.server.HttpServerExchange httpServerExchange)
-
-
Method Details
-
withSession
-
withAuthentication
-
withParameter
-
withBody
-
getSession
- Returns:
- The current session
-
getBody
- Returns:
- The request body
-
getBodyAsJsonMap
- Returns:
- The request body as Map object
-
getBodyAsJsonPath
public com.jayway.jsonpath.ReadContext getBodyAsJsonPath()- Returns:
- The request body as JsonPath object
-
getAuthentication
- Returns:
- The current authentication
-
getParameter
Retrieves a request parameter (request or query parameter) by its name- Parameters:
key- The key to find the parameter- Returns:
- The value for the given or null if none found
-
getParameter
Retrieves a map of request parameter (request or query parameter)- Returns:
- Map of request and query parameter
-
getHeaders
public io.undertow.util.HeaderMap getHeaders()Retrieves a list of all headers send by the client- Returns:
- A HeaderMap of client sent headers
-
getAcceptLanguage
Retrieves the clients accepted languages- Returns:
- the string value of the clients accepted languages
-
getHeader
Retrieves a specific header value by its name- Parameters:
headerName- The name of the header to retrieve- Returns:
- The value of the header or null if none found
-
getHeader
Retrieves a specific header value by its name- Parameters:
headerName- The name of the header to retrieve- Returns:
- The value of the header or null if none found
-
getURI
The original request URI. This will include the host name, protocol etc. if it was specified by the client. This is not decoded in any way, and does not include the query string. Examples: GET http://localhost:8080/myFile.jsf?foo=bar HTTP/1.1 -> 'http://localhost:8080/myFile.jsf' POST /my+File.jsf?foo=bar HTTP/1.1 -> '/my+File.jsf'- Returns:
- The request URI
-
getURL
Reconstructs the complete URL as seen by the user. This includes scheme, host name etc. but does not include query string. This is not decoded.- Returns:
- The request URL
-
getCookies
- Returns:
- An immutable map of request cookies
-
getCookie
Retrieves a single cookie from the request- Parameters:
name- The name of the cookie- Returns:
- The Cookie
-
getScheme
Get the request URI scheme. Normally this is one ofhttporhttps.- Returns:
- the request URI scheme
-
getCharset
Returns the request charset. If none was explicitly specified it will return "ISO-8859-1", which is the default charset for HTTP requests.- Returns:
- The character encoding
-
addAttribute
Adds an attribute to the internal attributes map- Parameters:
key- The key to store the attributevalue- The value to store
-
getContentLength
public long getContentLength()- Returns:
- The content length of the request, or
-1if it has not been set
-
getMethod
public io.undertow.util.HttpString getMethod()Get the HTTP request method. Normally this is one of the strings listed inMethods.- Returns:
- the HTTP request method
-
getPath
The request path. This will be decoded by the server, and does not include the query string. This path is not canonical, so care must be taken to ensure that escape attacks are not possible. Examples: GET http://localhost:8080/b/../my+File.jsf?foo=bar HTTP/1.1 -> '/b/../my+File.jsf' POST /my+File.jsf?foo=bar HTTP/1.1 -> '/my File.jsf'- Returns:
- The request path
-
getAttribute
Returns an object attribute from a given key- Parameters:
key- The key the attribute is stored- Returns:
- Object the value from the attributes map
-
getAttributeAsString
Returns an object attribute from a given key- Parameters:
key- The key the attribute is stored- Returns:
- String the value from the attributes map
-
getAttributes
- Returns:
- All attributes of the request
-