Class ServletRequestUtils
- java.lang.Object
-
- org.onehippo.forge.content.exim.repository.jaxrs.util.ServletRequestUtils
-
public class ServletRequestUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_HTTP_FORWARDED_FOR_HEADER
Default HTTP Forwarded-For header name.static String
HTTP_FORWARDED_FOR_HEADER_PARAM
Servlet context init parameter name for custom HTTP Forwarded-For header name.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getFarthestRemoteAddr(javax.servlet.http.HttpServletRequest request)
Returns the remote client address.static String[]
getRemoteAddrs(javax.servlet.http.HttpServletRequest request)
Returns the remote host addresses related to this request.
-
-
-
Field Detail
-
DEFAULT_HTTP_FORWARDED_FOR_HEADER
public static final String DEFAULT_HTTP_FORWARDED_FOR_HEADER
Default HTTP Forwarded-For header name.X-Forwarded-For
by default.- See Also:
- Constant Field Values
-
HTTP_FORWARDED_FOR_HEADER_PARAM
public static final String HTTP_FORWARDED_FOR_HEADER_PARAM
Servlet context init parameter name for custom HTTP Forwarded-For header name. If not set,DEFAULT_HTTP_FORWARDED_FOR_HEADER
is used by default.- See Also:
- Constant Field Values
-
-
Method Detail
-
getRemoteAddrs
public static String[] getRemoteAddrs(javax.servlet.http.HttpServletRequest request)
Returns the remote host addresses related to this request. If there's any proxy server between the client and the server, then the proxy addresses are contained in the returned array. The lowest indexed element is the farthest downstream client and each successive proxy addresses are the next elements.- Parameters:
request
- servlet request- Returns:
- the remote host addresses related to this request
-
getFarthestRemoteAddr
public static String getFarthestRemoteAddr(javax.servlet.http.HttpServletRequest request)
Returns the remote client address.- Parameters:
request
- servlet request- Returns:
- the remote client address
-
-