Class DefaultHttpUserRequest
java.lang.Object
se.swedenconnect.signservice.core.http.DefaultHttpUserRequest
- All Implemented Interfaces:
HttpUserRequest
Default implementation of the
HttpUserRequest
interface. Its primary use is in frontend/backup deployments
where it can help serializing/deserializing to and from JSON.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the client IP address.Gets the value of the specified request header.Gets a map of all request headers where the map entry key is the header name and the map entry value is the header value(s).Gets the HTTP method with which this request was made (i.e.,GET
,POST
,PUT
, ...).getParameter
(String name) Gets the value of a request parameter as a string, ornull
if the parameter does not exist.Gets a map of all request parameters, where the map entry key is the parameter name and the map entry value(s) is the parameter value.Gets the complete request URL of the user HTTP request that was received by the frontend.Gets the frontend "server base URL", which is the protocol, host and context path.Gets the part of this request's URL that calls the frontend's servlet.
-
Constructor Details
-
DefaultHttpUserRequest
public DefaultHttpUserRequest()Default constructor.
-
-
Method Details
-
getMethod
Gets the HTTP method with which this request was made (i.e.,GET
,POST
,PUT
, ...).- Specified by:
getMethod
in interfaceHttpUserRequest
- Returns:
- name of HTTP method used to send the request
-
getRequestUrl
Gets the complete request URL of the user HTTP request that was received by the frontend. This includes the protocol, host, (port), context path and servlet path. This string does not include any potential query parameters.- Specified by:
getRequestUrl
in interfaceHttpUserRequest
- Returns:
- complete request URL
-
getServerBaseUrl
Gets the frontend "server base URL", which is the protocol, host and context path.- Specified by:
getServerBaseUrl
in interfaceHttpUserRequest
- Returns:
- the frontend server base URL
-
getServerServletPath
Gets the part of this request's URL that calls the frontend's servlet. This path starts with a "/" character and includes either the servlet name or a path to the servlet, but does not include any extra path information or a query string.This method will return an empty string ("") if the servlet used to process this request was matched using the "/*" pattern.
- Specified by:
getServerServletPath
in interfaceHttpUserRequest
- Returns:
- the frontend's servlet path that matched this request
-
getClientIpAddress
Gets the client IP address.- Specified by:
getClientIpAddress
in interfaceHttpUserRequest
- Returns:
- the client IP addres
-
getParameter
Gets the value of a request parameter as a string, ornull
if the parameter does not exist.Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
In case you know, or want to be sure, that the parameter contains multiple values, use
HttpUserRequest.getParameters()
.- Specified by:
getParameter
in interfaceHttpUserRequest
- Parameters:
name
- the parameter name- Returns:
- the parameter value, or null if it does not exist
- See Also:
-
getParameters
Gets a map of all request parameters, where the map entry key is the parameter name and the map entry value(s) is the parameter value.Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
- Specified by:
getParameters
in interfaceHttpUserRequest
- Returns:
- a map (possibly empty) of parameter names and values
- See Also:
-
getHeader
Gets the value of the specified request header. If the request did not include a header of the specified name, this method returnsnull
.If there are multiple headers with the same name, this method returns the first header value in the request.
Note: The header name is case insensitive.
- Specified by:
getHeader
in interfaceHttpUserRequest
- Parameters:
name
- the header name- Returns:
- the header value, or null
- See Also:
-
getHeaders
Gets a map of all request headers where the map entry key is the header name and the map entry value is the header value(s).- Specified by:
getHeaders
in interfaceHttpUserRequest
- Returns:
- a (possibly empty) map of header names and values
- See Also:
-