Class RequestUtils


  • public class RequestUtils
    extends Object
    Wicket Request related utilities.
    • 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
    • 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)
        Returns true if a user is logged in for the current request and false if not or if there is no http session for the current request. This method uses the RequestCycle from Wicket and assumes that the request (if present) can be cast to a ServletWebRequest.
        Parameters:
        requestCycle - the wicket request cycle
        Returns:
        if the user is logged in for the current request