public final class HttpServletUtils extends Object
HttpServletRequest
and HttpServletResponse
API.
Takes care of proxy modifications.
Modifier and Type | Field and Description |
---|---|
static String |
HEADER_FORWARDED
RFC 7239, section 4: Forwarded.
|
static String |
HEADER_X_FORWARDED_HOST
Apache stuff, old de-facto standard: X-Forwarded-Host.
|
static String |
HEADER_X_FORWARDED_PROTO
Apache stuff, old de-facto standard: X-Forwarded-Proto.
|
Modifier and Type | Method and Description |
---|---|
static URL |
getSourceBaseURL(javax.servlet.http.HttpServletRequest servletRequest)
Try to extract from various http headers the base URL (
<protocol>://<host>[:<port>] ) as close as possible
to the one used by the client. |
static URL |
getSourceURL(javax.servlet.http.HttpServletRequest servletRequest)
Try to extract from various http headers the URL (
<protocol>://<host>[:<port>]/<path>[?<querystring>] ) as
close as possible to the one used by the client. |
static boolean |
isCacheReadAllowed(javax.servlet.http.HttpServletRequest request) |
public static final String HEADER_FORWARDED
public static final String HEADER_X_FORWARDED_HOST
public static final String HEADER_X_FORWARDED_PROTO
public static URL getSourceURL(javax.servlet.http.HttpServletRequest servletRequest)
<protocol>://<host>[:<port>]/<path>[?<querystring>]
) as
close as possible to the one used by the client.
In theory HttpServletRequest#getRequestURL() is supposed to take care of all that but depending on the application server and its configuration it's not always reliable. One less thing to configure.
servletRequest
- the servlet request inputpublic static URL getSourceBaseURL(javax.servlet.http.HttpServletRequest servletRequest)
<protocol>://<host>[:<port>]
) as close as possible
to the one used by the client.
In theory HttpServletRequest#getRequestURL() is supposed to take care of all that but depending on the application server and its configuration it's not always reliable. One less thing to configure.
servletRequest
- the servlet request inputpublic static boolean isCacheReadAllowed(javax.servlet.http.HttpServletRequest request)
request
- the servlet request inputCopyright © 2004–2021 XWiki. All rights reserved.