Class HttpRequestUtils


  • public class HttpRequestUtils
    extends java.lang.Object
    Since:
    5.2.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String USER_AGENT_HEADER
      Constant representing the request header for user agent.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean doesParameterExist​(javax.servlet.http.HttpServletRequest request, java.lang.String name)
      Check if a parameter exists.
      static javax.servlet.http.HttpServletRequest getHttpServletRequestFromRequestAttributes()
      Gets http servlet request from request attributes.
      static org.apereo.cas.authentication.adaptive.geo.GeoLocationRequest getHttpServletRequestGeoLocation​(java.lang.String geoLocationParam)
      Gets http servlet request geo location.
      static org.apereo.cas.authentication.adaptive.geo.GeoLocationRequest getHttpServletRequestGeoLocation​(javax.servlet.http.HttpServletRequest request)
      Gets http servlet request geo location.
      static java.lang.String getHttpServletRequestUserAgent​(javax.servlet.http.HttpServletRequest request)
      Gets http servlet request user agent.
      static javax.servlet.http.HttpServletResponse getHttpServletResponseFromRequestAttributes()
      Gets http servlet response from request attributes.
      static java.util.Map<java.lang.String,​java.lang.String> getRequestHeaders​(javax.servlet.http.HttpServletRequest request)
      Gets request headers.
      static org.apereo.cas.authentication.principal.WebApplicationService getService​(java.util.List<org.apereo.cas.web.support.ArgumentExtractor> argumentExtractors, javax.servlet.http.HttpServletRequest request)
      Gets the service from the request based on given extractors.
      static org.springframework.http.HttpStatus pingUrl​(java.lang.String location)
      Ping url and return http status.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • USER_AGENT_HEADER

        public static final java.lang.String USER_AGENT_HEADER
        Constant representing the request header for user agent.
        See Also:
        Constant Field Values
    • Constructor Detail

      • HttpRequestUtils

        public HttpRequestUtils()
    • Method Detail

      • getHttpServletRequestFromRequestAttributes

        public static javax.servlet.http.HttpServletRequest getHttpServletRequestFromRequestAttributes()
        Gets http servlet request from request attributes.
        Returns:
        the http servlet request from request attributes
      • getHttpServletResponseFromRequestAttributes

        public static javax.servlet.http.HttpServletResponse getHttpServletResponseFromRequestAttributes()
        Gets http servlet response from request attributes.
        Returns:
        the http servlet response from request attributes
      • getHttpServletRequestGeoLocation

        public static org.apereo.cas.authentication.adaptive.geo.GeoLocationRequest getHttpServletRequestGeoLocation​(javax.servlet.http.HttpServletRequest request)
        Gets http servlet request geo location.
        Parameters:
        request - the request
        Returns:
        the http servlet request geo location
      • getHttpServletRequestGeoLocation

        public static org.apereo.cas.authentication.adaptive.geo.GeoLocationRequest getHttpServletRequestGeoLocation​(java.lang.String geoLocationParam)
        Gets http servlet request geo location.
        Parameters:
        geoLocationParam - the geo location param
        Returns:
        the http servlet request geo location
      • getRequestHeaders

        public static java.util.Map<java.lang.String,​java.lang.String> getRequestHeaders​(javax.servlet.http.HttpServletRequest request)
        Gets request headers.
        Parameters:
        request - the request
        Returns:
        the request headers
      • getHttpServletRequestUserAgent

        public static java.lang.String getHttpServletRequestUserAgent​(javax.servlet.http.HttpServletRequest request)
        Gets http servlet request user agent.
        Parameters:
        request - the request
        Returns:
        the http servlet request user agent
      • getService

        public static org.apereo.cas.authentication.principal.WebApplicationService getService​(java.util.List<org.apereo.cas.web.support.ArgumentExtractor> argumentExtractors,
                                                                                               javax.servlet.http.HttpServletRequest request)
        Gets the service from the request based on given extractors.
        Parameters:
        argumentExtractors - the argument extractors
        request - the request
        Returns:
        the service, or null.
      • doesParameterExist

        public static boolean doesParameterExist​(javax.servlet.http.HttpServletRequest request,
                                                 java.lang.String name)
        Check if a parameter exists.
        Parameters:
        request - the HTTP request
        name - the parameter name
        Returns:
        whether the parameter exists
      • pingUrl

        public static org.springframework.http.HttpStatus pingUrl​(java.lang.String location)
        Ping url and return http status.
        Parameters:
        location - the location
        Returns:
        the http status