Interface HttpRequest
-
- All Known Implementing Classes:
ServletHttpRequest
public interface HttpRequestRepresents an incoming HTTP request and the contract to manipulate it.- Author:
- Pedro Igor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetCookieValue(String name)Get the first value for a cookie with the givenname.StringgetFirstParam(String name)Get the first value for a parameter with the givennameStringgetHeader(String name)Get the first value for a HEADER with the givenname.List<String>getHeaders(String name)Get a list of all of the values set for the specified header within the HTTP request.InputStreamgetInputStream(boolean buffered)Returns the request input streamStringgetMethod()Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.TokenPrincipalgetPrincipal()Returns aTokenPrincipalassociated with the request.StringgetRelativePath()Get the request path.StringgetRemoteAddr()Returns the client address.StringgetURI()Get the URI representation for the current request.booleanisSecure()Indicates if the request is coming from a secure channel through HTTPS.
-
-
-
Method Detail
-
getRelativePath
String getRelativePath()
Get the request path. This is the path relative to the context path. E.g.: for a HTTP GET request to http://my.appserver.com/my-application/path/sub-path this method is going to return /path/sub-path.- Returns:
- the relative path
-
getMethod
String getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.- Returns:
- a
Stringspecifying the name of the method with which this request was made
-
getURI
String getURI()
Get the URI representation for the current request.- Returns:
- a
Stringrepresentation for the current request
-
getHeaders
List<String> getHeaders(String name)
Get a list of all of the values set for the specified header within the HTTP request.- Parameters:
name- the header name- Returns:
- a list of the values set for this header, if the header is not set on the request then null should be returned
-
getFirstParam
String getFirstParam(String name)
Get the first value for a parameter with the givenname- Parameters:
name- the parameter name- Returns:
- the value of the parameter
-
getCookieValue
String getCookieValue(String name)
Get the first value for a cookie with the givenname.- Parameters:
name- the parameter name- Returns:
- the value of the cookie
-
getRemoteAddr
String getRemoteAddr()
Returns the client address.- Returns:
- the client address.
-
isSecure
boolean isSecure()
Indicates if the request is coming from a secure channel through HTTPS.- Returns:
trueif the HTTP scheme is set to 'https'. Otherwise,false
-
getHeader
String getHeader(String name)
Get the first value for a HEADER with the givenname.- Parameters:
name- the HEADER name- Returns:
- the value of the HEADER
-
getInputStream
InputStream getInputStream(boolean buffered)
Returns the request input stream- Parameters:
buffered- if the input stream should be buffered and support for multiple reads- Returns:
- the request input stream
-
getPrincipal
TokenPrincipal getPrincipal()
Returns aTokenPrincipalassociated with the request.- Returns:
- the principal
-
-