Package org.hippoecm.frontend.util
Class RequestUtils
java.lang.Object
org.hippoecm.frontend.util.RequestUtils
Wicket
Request
related utilities.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
(jakarta.servlet.http.HttpServletRequest request) Returns the original host information requested by the clientstatic String
getFarthestRequestScheme
(jakarta.servlet.http.HttpServletRequest request) static String
getFarthestUrlPrefix
(jakarta.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 Details
-
DEFAULT_HTTP_FORWARDED_FOR_HEADER
Default HTTP Forwarded-For header name.X-Forwarded-For
by default.- See Also:
-
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:
-
-
Method Details
-
getFarthestRemoteAddr
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
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
-
getFarthestRequestHost
Returns the original host information requested by the client- Parameters:
request
-- Returns:
- the farthest request host
-
getFarthestUrlPrefix
-
getFarthestUrlPrefix
public static String getFarthestUrlPrefix(jakarta.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
-