Package dev.voidframework.web.http
Interface HttpRequest
- All Known Implementing Classes:
UndertowHttpRequest
public interface HttpRequest
An HTTP request.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptContentType(String contentType) Checks if the current request accept a specific content type.Returns the body content;Returns the request charset.Returns a cookie.Returns a single header.Returns all headers.Get the HTTP request method.Get the input stream to read the request.Returns the query string, without the leading "?".getQueryStringParameter(String parameterName) Returns the query string parameter value.getQueryStringParameter(String parameterName, String fallbackValue) Returns the query string parameter value.getQueryStringParameterAsList(String parameterName) Returns the query string parameter values as list.getQueryStringParameterAsList(String parameterName, List<String> fallbackValue) Returns the query string parameter values as list.Returns all query string parameters.Returns the remote host that this request was sent to.Returns the original request URI.Returns the complete URL as seen by the user.
-
Method Details
-
getCharset
String getCharset()Returns the request charset.- Returns:
- The request charset
- Since:
- 1.0.0
-
getCookie
Returns a cookie.- Parameters:
cookieName- The cookie name- Returns:
- The cookie, otherwise, null
- Since:
- 1.0.0
-
acceptContentType
Checks if the current request accept a specific content type.- Parameters:
contentType- The content type- Returns:
trueif the content type is accepted, otherwise,false- Since:
- 1.1.0
-
getHeader
Returns a single header.- Parameters:
headerName- The header name- Returns:
- The requested header value, otherwise, a null value
- Since:
- 1.0.0
-
getHeaders
Returns all headers.- Returns:
- All headers
- Since:
- 1.0.0
-
getHttpMethod
HttpMethod getHttpMethod()Get the HTTP request method.- Returns:
- The request method
- Since:
- 1.0.0
-
getInputSteam
InputStream getInputSteam()Get the input stream to read the request. Can only be called one time.- Returns:
- The input stream
- Since:
- 1.0.0
-
getQueryString
String getQueryString()Returns the query string, without the leading "?".- Returns:
- The query string
- Since:
- 1.0.0
-
getQueryStringParameter
Returns the query string parameter value. If the parameter does not exist, null value will be returned.- Parameters:
parameterName- The parameter name- Returns:
- The query string parameter value
- Since:
- 1.0.0
-
getQueryStringParameter
Returns the query string parameter value. If the parameter does not exist or associated value is blank, fallback value will be returned.- Parameters:
parameterName- The parameter namefallbackValue- The value to use if the parameter does not exist or associated value is blank- Returns:
- The query string parameter value
- Since:
- 1.6.0
-
getQueryStringParameterAsList
Returns the query string parameter values as list. If the parameter does not exist, an empty list will be returned.- Parameters:
parameterName- The parameter name- Returns:
- The query string parameter values as list
- Since:
- 1.3.0
-
getQueryStringParameterAsList
Returns the query string parameter values as list. If the parameter does not exist or associated value is empty, fallback value will be returned.- Parameters:
parameterName- The parameter namefallbackValue- The value to use if the parameter does not exist or the value is empty- Returns:
- The query string parameter values as list
- Since:
- 1.6.0
-
getQueryStringParameters
Returns all query string parameters.- Returns:
- All query string parameters
- Since:
- 1.0.0
-
getRemoteHostName
String getRemoteHostName()Returns the remote host that this request was sent to.- Returns:
- The remote host name
- Since:
- 1.0.0
-
getRequestURL
String getRequestURL()Returns the complete URL as seen by the user.- Returns:
- The request URL
- Since:
- 1.0.0
-
getRequestURI
String getRequestURI()Returns the original request URI. This is not decoded in any way, and does not include the query string.- Returns:
- The request URI
- Since:
- 1.0.0
-
getBodyContent
HttpRequestBodyContent getBodyContent()Returns the body content;- Returns:
- The body content
- Since:
- 1.0.0
-