Package org.hippoecm.frontend.util
Class RequestUtils
- java.lang.Object
-
- org.hippoecm.frontend.util.RequestUtils
-
public class RequestUtils extends Object
WicketRequest
related utilities.
-
-
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(s).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getFarthestRemoteAddr(org.apache.wicket.request.Request request)
Returns the remote client address or null if remote client address information is unavailable.static String
getFarthestRequestHost(javax.servlet.http.HttpServletRequest request)
Returns the original host information requested by the clientstatic String
getFarthestRequestScheme(javax.servlet.http.HttpServletRequest request)
static String
getFarthestUrlPrefix(javax.servlet.http.HttpServletRequest httpServletRequest)
static String
getFarthestUrlPrefix(org.apache.wicket.request.Request request)
static String[]
getRemoteAddrs(org.apache.wicket.request.Request request)
Returns the remote host addresses related to this request.static boolean
isUserLoggedIn(org.apache.wicket.request.IRequestCycle requestCycle)
Returnstrue
if a user is logged in for the current request andfalse
if not or if there is no http session for the current 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(s). If not set,DEFAULT_HTTP_FORWARDED_FOR_HEADER
is used by default.- See Also:
- Constant Field Values
-
-
Method Detail
-
getFarthestRemoteAddr
public static String getFarthestRemoteAddr(org.apache.wicket.request.Request request)
Returns the remote client address or null if remote client address information is unavailable.- Parameters:
request
- wicket request- Returns:
- the remote client address or null if remote client address information is unavailable
-
getRemoteAddrs
public static String[] getRemoteAddrs(org.apache.wicket.request.Request 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
- wicket request- Returns:
- remote host addresses as non-null string array
-
getFarthestRequestScheme
public static String getFarthestRequestScheme(javax.servlet.http.HttpServletRequest request)
-
getFarthestRequestHost
public static String getFarthestRequestHost(javax.servlet.http.HttpServletRequest request)
Returns the original host information requested by the client- Parameters:
request
-- Returns:
- the farthest request host
-
getFarthestUrlPrefix
public static String getFarthestUrlPrefix(org.apache.wicket.request.Request request)
-
getFarthestUrlPrefix
public static String getFarthestUrlPrefix(javax.servlet.http.HttpServletRequest httpServletRequest)
-
isUserLoggedIn
public static boolean isUserLoggedIn(org.apache.wicket.request.IRequestCycle requestCycle)
Returnstrue
if a user is logged in for the current request andfalse
if not or if there is no http session for the current request. This method uses theRequestCycle
from Wicket and assumes that the request (if present) can be cast to aServletWebRequest
.- Parameters:
requestCycle
- the wicket request cycle- Returns:
- if the user is logged in for the current request
-
-