@ThreadSafe public final class HTTPServletRequestX extends Object
HttpServletRequest
Modifier and Type | Method and Description |
---|---|
static StringBuilder |
buildRequestSummary(HttpServletRequest reqHS)
Constructs a standard log message summarizing the request, and returns it in a
string builder.
|
static boolean |
getBooleanParameter(String key,
ServletRequest reqS)
Returns the boolean value of a request parameter, where true is encoded as a 'Y',
'y' or empty value '', and false as an 'N', 'n' or omitted value (null).
|
static String |
getForwardedRemoteAddr(HttpServletRequest reqHS)
Returns the apparent address of the remote client after taking into account any
proxying declared in the
x-forwarded-for header. |
static String |
getParameterNonEmpty(String key,
ServletRequest reqS)
Returns the non-empty value of a request parameter, or null if the parameter is
not specified.
|
static String |
getParameterRequired(String key,
ServletRequest reqS)
Returns the non-null, non-empty value of a request parameter.
|
static StringBuilder |
getRequestURLFull(HttpServletRequest reqHS)
Reconstructs the full URL the client used to make the request, including any query
portion, and returns it in a string builder.
|
static void |
relayHeaders(String name,
HttpServletRequest reqHS,
URLConnection http)
Copies headers of the specified name from an incoming client request (reqHS) to an
outgoing server request (http).
|
public static StringBuilder buildRequestSummary(HttpServletRequest reqHS)
public static boolean getBooleanParameter(String key, ServletRequest reqS) throws HTTPRequestException
HTTPRequestException
- if the value is present and malformed.public static String getForwardedRemoteAddr(HttpServletRequest reqHS)
x-forwarded-for
header. No attempt is made
to authenticate the proxying declaration, which may easily be bogus. Therefore do
not depend on the returned value being correct, or even well formed.public static String getParameterNonEmpty(String key, ServletRequest reqS) throws HTTPRequestException
HTTPRequestException
- if the value is the empty string "".VPage.stringNonEmpty(org.apache.wicket.request.mapper.parameter.PageParameters,String)
,
PageParametersX.getStringNonEmpty(org.apache.wicket.request.mapper.parameter.PageParameters,String)
public static String getParameterRequired(String key, ServletRequest reqS) throws HTTPRequestException
HTTPRequestException
- if the value is either null or the empty string "".VPage.stringRequired(org.apache.wicket.request.mapper.parameter.PageParameters,String)
,
PageParametersX.getStringRequired(org.apache.wicket.request.mapper.parameter.PageParameters,String)
public static StringBuilder getRequestURLFull(HttpServletRequest reqHS)
HttpServletRequest.getRequestURL()
public static void relayHeaders(String name, HttpServletRequest reqHS, URLConnection http)