Class RequestUtils

java.lang.Object
org.hippoecm.frontend.util.RequestUtils

public class RequestUtils extends Object
Wicket Request related utilities.
  • Field Details

    • 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:
    • 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:
  • Method Details

    • 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(jakarta.servlet.http.HttpServletRequest request)
    • getFarthestRequestHost

      public static String getFarthestRequestHost(jakarta.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(jakarta.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