Class RestRequestHelper


  • public class RestRequestHelper
    extends Object
    Helper class for working with requests.
    Since:
    8.2.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • getLocale

        public static Locale getLocale​(javax.servlet.http.HttpServletRequest servletRequest)
      • getContentType

        public static String getContentType​(javax.ws.rs.core.MultivaluedMap<String,​String> headers)
      • getFileName

        public static String getFileName​(javax.ws.rs.core.MultivaluedMap<String,​String> headers)
      • getHeader

        public static String getHeader​(javax.ws.rs.core.MultivaluedMap<String,​String> headers,
                                       String headerName)
        Parameters:
        headers - the map with the available headers
        headerName - the field name of the desired header value
        Returns:
        If there's exactly one value for the provided header field name, this value will be returned. Otherwise (more than one value or no value at all) null is returned.
      • getHeaderValues

        public static List<String> getHeaderValues​(javax.ws.rs.core.MultivaluedMap<String,​String> headers,
                                                   String headerName)
        Parameters:
        headers - the map with the available headers
        headerName - the field name of the desired header values
        Returns:
        the list of values mapped to the provided header field name (possibly empty but not null)
      • getLocale

        public static Locale getLocale​(org.pac4j.core.context.WebContext webContext)
      • getUnsafeFileItems

        public static List<? extends IScannedFileItem> getUnsafeFileItems​(javax.servlet.http.HttpServletRequest servletRequest)
        Checks the current MultipartPreservingRequest (if available) for unsafe file uploads
        Parameters:
        servletRequest - the servlet request to get the desired MultipartPreservingRequest from
        Returns:
        a list containing the unsafe file items, possibly empty but never null