Package org.xwiki.container.servlet
Class HttpServletUtils
- java.lang.Object
-
- org.xwiki.container.servlet.HttpServletUtils
-
public final class HttpServletUtils extends Object
Various helpers around theHttpServletRequest
andHttpServletResponse
API.Takes care of proxy modifications.
- Since:
- 10.7RC1
- Version:
- $Id: 1859fdf703e6848851df24f0f495c821a2e2ad97 $
-
-
Field Summary
Fields Modifier and Type Field 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.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
HEADER_FORWARDED
public static final String HEADER_FORWARDED
RFC 7239, section 4: Forwarded.- See Also:
- Constant Field Values
-
HEADER_X_FORWARDED_HOST
public static final String HEADER_X_FORWARDED_HOST
Apache stuff, old de-facto standard: X-Forwarded-Host.- See Also:
- Constant Field Values
-
HEADER_X_FORWARDED_PROTO
public static final String HEADER_X_FORWARDED_PROTO
Apache stuff, old de-facto standard: X-Forwarded-Proto.- See Also:
- Constant Field Values
-
-
Method Detail
-
getSourceURL
public 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.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.
- Parameters:
servletRequest
- the servlet request input- Returns:
- the URL as close as possible from what the client used
-
getSourceBaseURL
public 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.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.
- Parameters:
servletRequest
- the servlet request input- Returns:
- the URL as close as possible from what the client used
-
isCacheReadAllowed
public static boolean isCacheReadAllowed(javax.servlet.http.HttpServletRequest request)
- Parameters:
request
- the servlet request input- Returns:
- true if the request explicitly disable getting resources from the cache
- Since:
- 11.8RC1
-
-