Class RequestHelper


  • @Immutable
    public final class RequestHelper
    extends Object
    Misc. helper method on HttpServletRequest objects.
    Author:
    Philip Helger
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void forEachRequestHeader​(jakarta.servlet.http.HttpServletRequest aHttpRequest, BiConsumer<String,​String> aConsumer)
      Get a complete request header map as a copy.
      static com.helger.http.AcceptCharsetList getAcceptCharsets​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static com.helger.http.AcceptEncodingList getAcceptEncodings​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static com.helger.http.AcceptLanguageList getAcceptLanguages​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static com.helger.http.AcceptMimeTypeList getAcceptMimeTypes​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static com.helger.http.basicauth.BasicAuthClientCredentials getBasicAuthClientCredentials​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the Basic authentication credentials from the passed HTTP servlet request from the HTTP header CHttpHeader.AUTHORIZATION.
      static String getCheckBoxHiddenFieldName​(String sFieldName)
      Get the name of the automatic hidden field associated with a check-box.
      static long getContentLength​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the content length of the passed request.
      static int getDefaultServerPort​(String sScheme)  
      static com.helger.http.digestauth.DigestAuthClientCredentials getDigestAuthClientCredentials​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the Digest authentication credentials from the passed HTTP servlet request from the HTTP header CHttpHeader.AUTHORIZATION.
      static StringBuilder getFullServerName​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static StringBuilder getFullServerName​(String sScheme, String sServerName, int nServerPort)  
      static String getFullServerNameAndPath​(String sScheme, String sServerName, int nServerPort, String sPath, String sQueryString)  
      static com.helger.commons.http.EHttpMethod getHttpMethod​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the HTTP method associated with the given HTTP request
      static com.helger.commons.http.EHttpMethod getHttpMethodOrDefault​(jakarta.servlet.http.HttpServletRequest aHttpRequest, com.helger.commons.http.EHttpMethod eDefault)
      Get the HTTP method associated with the given HTTP request
      static String getHttpReferer​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static String getHttpUserAgentStringFromRequest​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the user agent from the given request.
      static com.helger.http.EHttpVersion getHttpVersion​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the HTTP version associated with the given HTTP request
      static String getPathInfo​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the request path info without an eventually appended session (";jsessionid=...")
      static String getPathWithinServlet​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Return the path within the servlet mapping for the given request, i.e. the part of the request's URL beyond the part that called the servlet, or "" if the whole URL has been used to identify the servlet.
      static String getPathWithinServlet​(jakarta.servlet.http.HttpServletRequest aHttpRequest, boolean bUseEncodedPath)
      Return the path within the servlet mapping for the given request, i.e. the part of the request's URL beyond the part that called the servlet, or "" if the whole URL has been used to identify the servlet.
      static String getPathWithinServletContext​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Return the URI of the request within the servlet context.
      static String getPathWithinServletContext​(jakarta.servlet.http.HttpServletRequest aHttpRequest, boolean bUseEncodedPath)
      Return the URI of the request within the servlet context.
      static X509Certificate[] getRequestClientCertificates​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the client certificates provided by a HTTP servlet request.
      static com.helger.commons.http.HttpHeaderMap getRequestHeaderMap​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get a complete request header map as a copy.
      static IRequestParamMap getRequestParamMap​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static String getRequestSSLCipherSuite​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static Integer getRequestSSLKeySize​(jakarta.servlet.http.HttpServletRequest aHttpRequest)  
      static String getRequestURIDecoded​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the request URI without an eventually appended session (";jsessionid=...").
      This method considers the GlobalWebScope custom context path.
      This method returns the percent decoded parameters Examples of Returned Values First line of HTTP request Returned Value POST /some/pa%3Ath.html;JSESSIONID=4711 /some/pa:th.html GET http://foo.bar/a.html;JSESSIONID=4711 /a.html HEAD /xyz;JSESSIONID=4711?
      static String getRequestURIEncoded​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the request URI without an eventually appended session (";jsessionid=...").
      This method considers the GlobalWebScope custom context path.
      This method returns the percent encoded parameters "as is" Examples of Returned Values First line of HTTP request Returned Value POST /some/pa%3Ath.html;JSESSIONID=4711 /some/pa%3Ath.html GET http://foo.bar/a.html;JSESSIONID=4711 /a.html HEAD /xyz;JSESSIONID=4711?
      static StringBuilder getRequestURLDecoded​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Reconstructs the URL the client used to make the request.
      static StringBuilder getRequestURLEncoded​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Reconstructs the URL the client used to make the request.
      static int getServerPortToUse​(String sScheme, int nServerPort)  
      static String getSessionID​(com.helger.commons.url.ISimpleURL aURL)
      Get the session ID of the passed string (like in "test.html;JSESSIONID=1234").
      Attention: this methods does not consider eventually present request parameters.
      static String getSessionID​(String sValue)
      Get the session ID of the passed string (like in "test.html;JSESSIONID=1234").
      Attention: this methods does not consider eventually present request parameters.
      static com.helger.useragent.uaprofile.UAProfile getUAProfile​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the user agent object from the given HTTP request.
      static String getURIDecoded​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the full URI (excl. protocol) and parameters of the passed request.
      Example:
      static String getURIEncoded​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the full URI (excl. protocol) and parameters of the passed request.
      Example:
      static String getURLDecoded​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the full URL (incl. protocol) and parameters of the passed request.
      static String getURLEncoded​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the full URL (incl. protocol) and parameters of the passed request.
      static com.helger.useragent.IUserAgent getUserAgent​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Get the user agent object from the given HTTP request.
      static com.helger.commons.url.SimpleURL getWithoutSessionID​(com.helger.commons.url.ISimpleURL aURL)
      Get the passed string without an eventually contained session ID like in "test.html;JSESSIONID=1234?
      static String getWithoutSessionID​(String sValue)
      Get the passed string without an eventually contained session ID like in "test.html;JSESSIONID=1234".
      Attention: this methods does not consider eventually present request parameters.
      static boolean isMultipartContent​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Utility method that determines whether the request contains multipart content.
      static boolean isMultipartContent​(String sContentType)
      Utility method that determines whether the request contains multipart content.
      static boolean isMultipartFormDataContent​(jakarta.servlet.http.HttpServletRequest aHttpRequest)
      Utility method that determines whether the request contains multipart content.
      static boolean isMultipartFormDataContent​(String sContentType)
      Utility method that determines whether the request contains multipart/form-data content.
    • Field Detail

      • MULTIPART

        public static final String MULTIPART
        Part of HTTP content type header. Must be all lower case!
        See Also:
        Constant Field Values
      • MULTIPART_FORM_DATA

        public static final String MULTIPART_FORM_DATA
        HTTP content type header for multipart forms. Must be all lower case!
        See Also:
        Constant Field Values
      • MULTIPART_MIXED

        public static final String MULTIPART_MIXED
        HTTP content type header for multiple uploads. Must be all lower case!
        See Also:
        Constant Field Values
      • DEFAULT_CHECKBOX_HIDDEN_FIELD_PREFIX

        public static final String DEFAULT_CHECKBOX_HIDDEN_FIELD_PREFIX
        The prefix to appended to the field name of the checkbox to create the hidden field.
        See Also:
        Constant Field Values
    • Method Detail

      • getWithoutSessionID

        @Nonnull
        public static String getWithoutSessionID​(@Nonnull
                                                 String sValue)
        Get the passed string without an eventually contained session ID like in "test.html;JSESSIONID=1234".
        Attention: this methods does not consider eventually present request parameters. If parameters are present, they are most likely be stripped away!
        Parameters:
        sValue - The value to strip the session ID from. May not be null.
        Returns:
        The value without a session ID or the original string.
      • getWithoutSessionID

        @Nonnull
        public static com.helger.commons.url.SimpleURL getWithoutSessionID​(@Nonnull
                                                                           com.helger.commons.url.ISimpleURL aURL)
        Get the passed string without an eventually contained session ID like in "test.html;JSESSIONID=1234?param=value".
        Parameters:
        aURL - The value to strip the session ID from the path
        Returns:
        The value without a session ID or the original string.
      • getSessionID

        @Nullable
        public static String getSessionID​(@Nonnull
                                          String sValue)
        Get the session ID of the passed string (like in "test.html;JSESSIONID=1234").
        Attention: this methods does not consider eventually present request parameters. If parameters are present, they must be stripped away explicitly!
        Parameters:
        sValue - The value to get the session ID from. May not be null.
        Returns:
        The session ID of the value or null if no session ID is present.
      • getSessionID

        @Nullable
        public static String getSessionID​(@Nonnull
                                          com.helger.commons.url.ISimpleURL aURL)
        Get the session ID of the passed string (like in "test.html;JSESSIONID=1234").
        Attention: this methods does not consider eventually present request parameters. If parameters are present, they must be stripped away explicitly!
        Parameters:
        aURL - The URL to get the session ID from. May not be null.
        Returns:
        The session ID of the value or null if no session ID is present.
      • getRequestURIDecoded

        @Nonnull
        public static String getRequestURIDecoded​(@Nonnull
                                                  jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the request URI without an eventually appended session (";jsessionid=...").
        This method considers the GlobalWebScope custom context path.
        This method returns the percent decoded parameters
        Examples of Returned Values
        First line of HTTP request Returned Value
        POST /some/pa%3Ath.html;JSESSIONID=4711 /some/pa:th.html
        GET http://foo.bar/a.html;JSESSIONID=4711 /a.html
        HEAD /xyz;JSESSIONID=4711?a=b /xyz
        Parameters:
        aHttpRequest - The HTTP request. May not be null.
        Returns:
        The request URI without the optional session ID. Never null.
        Since:
        9.1.0
      • getRequestURIEncoded

        @Nonnull
        public static String getRequestURIEncoded​(@Nonnull
                                                  jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the request URI without an eventually appended session (";jsessionid=...").
        This method considers the GlobalWebScope custom context path.
        This method returns the percent encoded parameters "as is"
        Examples of Returned Values
        First line of HTTP request Returned Value
        POST /some/pa%3Ath.html;JSESSIONID=4711 /some/pa%3Ath.html
        GET http://foo.bar/a.html;JSESSIONID=4711 /a.html
        HEAD /xyz;JSESSIONID=4711?a=b /xyz
        Parameters:
        aHttpRequest - The HTTP request. May not be null.
        Returns:
        The request URI without the optional session ID. Never null.
        Since:
        9.1.0
      • getPathInfo

        @Nullable
        public static String getPathInfo​(@Nonnull
                                         jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the request path info without an eventually appended session (";jsessionid=...")
        Parameters:
        aHttpRequest - The HTTP request
        Returns:
        Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string and will start with a "/" character. The optional session ID is stripped.
      • getPathWithinServletContext

        @Nonnull
        public static String getPathWithinServletContext​(@Nonnull
                                                         jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Return the URI of the request within the servlet context.
        Parameters:
        aHttpRequest - The HTTP request. May not be null.
        Returns:
        the path within the web application and never null. By default "/" is returned is an empty request URI is determined.
      • getPathWithinServletContext

        @Nonnull
        public static String getPathWithinServletContext​(@Nonnull
                                                         jakarta.servlet.http.HttpServletRequest aHttpRequest,
                                                         boolean bUseEncodedPath)
        Return the URI of the request within the servlet context.
        Parameters:
        aHttpRequest - The HTTP request. May not be null.
        bUseEncodedPath - true to use the URL encoded path, false to use the decoded path
        Returns:
        the path within the web application and never null. By default "/" is returned is an empty request URI is determined.
        Since:
        9.1.10
      • getPathWithinServlet

        @Nonnull
        public static String getPathWithinServlet​(@Nonnull
                                                  jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Return the path within the servlet mapping for the given request, i.e. the part of the request's URL beyond the part that called the servlet, or "" if the whole URL has been used to identify the servlet.
        Detects include request URL if called within a RequestDispatcher include.
        E.g.: servlet mapping = "/test/*"; request URI = "/test/a" -> "/a".
        E.g.: servlet mapping = "/test"; request URI = "/test" -> "".
        E.g.: servlet mapping = "/*.test"; request URI = "/a.test" -> "".
        Parameters:
        aHttpRequest - current HTTP request
        Returns:
        the path within the servlet mapping, or ""
      • getPathWithinServlet

        @Nonnull
        public static String getPathWithinServlet​(@Nonnull
                                                  jakarta.servlet.http.HttpServletRequest aHttpRequest,
                                                  boolean bUseEncodedPath)
        Return the path within the servlet mapping for the given request, i.e. the part of the request's URL beyond the part that called the servlet, or "" if the whole URL has been used to identify the servlet.
        Detects include request URL if called within a RequestDispatcher include.
        E.g.: servlet mapping = "/test/*"; request URI = "/test/a" -> "/a".
        E.g.: servlet mapping = "/test"; request URI = "/test" -> "".
        E.g.: servlet mapping = "/*.test"; request URI = "/a.test" -> "".
        Parameters:
        aHttpRequest - current HTTP request
        bUseEncodedPath - true to use the URL encoded path, false to use the decoded path
        Returns:
        the path within the servlet mapping, or ""
        Since:
        9.1.10
      • getRequestURLDecoded

        @Nonnull
        @Nonempty
        public static StringBuilder getRequestURLDecoded​(@Nonnull
                                                         jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
        This method returns the percent decoded parameters

        If this request has been forwarded using RequestDispatcher.forward(jakarta.servlet.ServletRequest, jakarta.servlet.ServletResponse), the server path in the reconstructed URL must reflect the path used to obtain the RequestDispatcher, and not the server path specified by the client.

        Because this method returns a StringBuilder, not a string, you can modify the URL easily, for example, to append query parameters.

        This method is useful for creating redirect messages and for reporting errors.

        Parameters:
        aHttpRequest - The HTTP request to get the request URL from. May not be null.
        Returns:
        a StringBuilder object containing the reconstructed URL
        Since:
        9.1.10
      • getRequestURLEncoded

        @Nonnull
        @Nonempty
        public static StringBuilder getRequestURLEncoded​(@Nonnull
                                                         jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
        This method returns the percent encoded parameters "as is"

        If this request has been forwarded using RequestDispatcher.forward(jakarta.servlet.ServletRequest, jakarta.servlet.ServletResponse), the server path in the reconstructed URL must reflect the path used to obtain the RequestDispatcher, and not the server path specified by the client.

        Because this method returns a StringBuilder, not a string, you can modify the URL easily, for example, to append query parameters.

        This method is useful for creating redirect messages and for reporting errors.

        Parameters:
        aHttpRequest - The HTTP request to get the request URL from. May not be null.
        Returns:
        a StringBuilder object containing the reconstructed URL
        Since:
        9.1.10
      • getURLDecoded

        @Nonnull
        @Nonempty
        public static String getURLDecoded​(@Nonnull
                                           jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the full URL (incl. protocol) and parameters of the passed request.
         http://hostname.com/mywebapp/servlet/dir/a/b.xml=123?d=789
         
        Parameters:
        aHttpRequest - The request to use. May not be null.
        Returns:
        The full URL.
        Since:
        9.1.10
        See Also:
        getURI to retrieve the URL without the server scheme and name.
      • getURLEncoded

        @Nonnull
        @Nonempty
        public static String getURLEncoded​(@Nonnull
                                           jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the full URL (incl. protocol) and parameters of the passed request.
         http://hostname.com/mywebapp/servlet/dir/a/b.xml=123?d=789
         
        Parameters:
        aHttpRequest - The request to use. May not be null.
        Returns:
        The full URL.
        Since:
        9.1.10
        See Also:
        getURI to retrieve the URL without the server scheme and name.
      • getURIDecoded

        @Nonnull
        @Nonempty
        public static String getURIDecoded​(@Nonnull
                                           jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the full URI (excl. protocol) and parameters of the passed request.
        Example:
         /mywebapp/servlet/dir/a/b.xml=123?d=789
         
        Parameters:
        aHttpRequest - The request to use. May not be null.
        Returns:
        The full URI.
        Since:
        9.1.10
        See Also:
        getURL to retrieve the absolute URL
      • getURIEncoded

        @Nonnull
        @Nonempty
        public static String getURIEncoded​(@Nonnull
                                           jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the full URI (excl. protocol) and parameters of the passed request.
        Example:
         /mywebapp/servlet/dir/a/b.xml=123?d=789
         
        Parameters:
        aHttpRequest - The request to use. May not be null.
        Returns:
        The full URI.
        Since:
        9.1.10
        See Also:
        getURL to retrieve the absolute URL
      • getFullServerName

        @Nonnull
        @Nonempty
        public static StringBuilder getFullServerName​(@Nonnull
                                                      jakarta.servlet.http.HttpServletRequest aHttpRequest)
      • getHttpReferer

        @Nullable
        public static String getHttpReferer​(@Nonnull
                                            jakarta.servlet.http.HttpServletRequest aHttpRequest)
      • getHttpVersion

        @Nullable
        public static com.helger.http.EHttpVersion getHttpVersion​(@Nonnull
                                                                  jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the HTTP version associated with the given HTTP request
        Parameters:
        aHttpRequest - The http request to query. May not be null.
        Returns:
        null if no supported HTTP version is contained
      • getHttpMethod

        @Nullable
        public static com.helger.commons.http.EHttpMethod getHttpMethod​(@Nonnull
                                                                        jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the HTTP method associated with the given HTTP request
        Parameters:
        aHttpRequest - The http request to query. May not be null.
        Returns:
        null if no supported HTTP method is contained
      • getHttpMethodOrDefault

        @Nullable
        public static com.helger.commons.http.EHttpMethod getHttpMethodOrDefault​(@Nonnull
                                                                                 jakarta.servlet.http.HttpServletRequest aHttpRequest,
                                                                                 @Nullable
                                                                                 com.helger.commons.http.EHttpMethod eDefault)
        Get the HTTP method associated with the given HTTP request
        Parameters:
        aHttpRequest - The http request to query. May not be null.
        eDefault - The default to be returned, if no HTTP method could be found. May be null.
        Returns:
        null if no supported HTTP method is contained
        Since:
        9.1.6
      • forEachRequestHeader

        public static void forEachRequestHeader​(@Nonnull
                                                jakarta.servlet.http.HttpServletRequest aHttpRequest,
                                                @Nonnull
                                                BiConsumer<String,​String> aConsumer)
        Get a complete request header map as a copy.
        Parameters:
        aHttpRequest - The source HTTP request. May not be null.
        aConsumer - The BiConsumer that takes name and value. May not be null.
        Since:
        9.1.9
      • getRequestHeaderMap

        @Nonnull
        @ReturnsMutableCopy
        public static com.helger.commons.http.HttpHeaderMap getRequestHeaderMap​(@Nonnull
                                                                                jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get a complete request header map as a copy.
        Parameters:
        aHttpRequest - The source HTTP request. May not be null.
        Returns:
        Never null.
      • getContentLength

        @CheckForSigned
        public static long getContentLength​(@Nonnull
                                            jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the content length of the passed request. This is not done using request.getContentLength() but instead parsing the HTTP header field CHttpHeader.CONTENT_LENGTH manually!
        Parameters:
        aHttpRequest - Source HTTP request. May not be null.
        Returns:
        -1 if no or an invalid content length is set in the header
      • getRequestSSLCipherSuite

        @Nullable
        public static String getRequestSSLCipherSuite​(@Nonnull
                                                      jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Parameters:
        aHttpRequest - he HTTP servlet request to extract the information from. May not be null.
        Returns:
        SSL cipher suite or null if no such attribute is present
      • getRequestSSLKeySize

        @Nullable
        public static Integer getRequestSSLKeySize​(@Nonnull
                                                   jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Parameters:
        aHttpRequest - he HTTP servlet request to extract the information from. May not be null.
        Returns:
        Bit size of the algorithm or null if no such attribute is present
      • getRequestClientCertificates

        @Nullable
        public static X509Certificate[] getRequestClientCertificates​(@Nonnull
                                                                     jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the client certificates provided by a HTTP servlet request.
        Parameters:
        aHttpRequest - The HTTP servlet request to extract the information from. May not be null.
        Returns:
        null if the passed request does not contain any client certificate
      • isMultipartContent

        public static boolean isMultipartContent​(@Nullable
                                                 String sContentType)
        Utility method that determines whether the request contains multipart content.
        Parameters:
        sContentType - The content type to be checked. May be null.
        Returns:
        true if the request is multipart; false otherwise.
      • isMultipartContent

        public static boolean isMultipartContent​(@Nonnull
                                                 jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Utility method that determines whether the request contains multipart content.
        Parameters:
        aHttpRequest - The servlet request to be evaluated. Must be non-null.
        Returns:
        true if the request is multipart; false otherwise.
      • isMultipartFormDataContent

        public static boolean isMultipartFormDataContent​(@Nullable
                                                         String sContentType)
        Utility method that determines whether the request contains multipart/form-data content.
        Parameters:
        sContentType - The content type to be checked. May be null.
        Returns:
        true if the passed, lowercased content type starts with multipart/form-data; false otherwise.
      • isMultipartFormDataContent

        public static boolean isMultipartFormDataContent​(@Nonnull
                                                         jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Utility method that determines whether the request contains multipart content.
        Parameters:
        aHttpRequest - The servlet request to be evaluated. Must be non-null.
        Returns:
        true if the request is multipart; false otherwise.
      • getAcceptCharsets

        @Nonnull
        public static com.helger.http.AcceptCharsetList getAcceptCharsets​(@Nonnull
                                                                          jakarta.servlet.http.HttpServletRequest aHttpRequest)
      • getAcceptEncodings

        @Nonnull
        public static com.helger.http.AcceptEncodingList getAcceptEncodings​(@Nonnull
                                                                            jakarta.servlet.http.HttpServletRequest aHttpRequest)
      • getAcceptLanguages

        @Nonnull
        public static com.helger.http.AcceptLanguageList getAcceptLanguages​(@Nonnull
                                                                            jakarta.servlet.http.HttpServletRequest aHttpRequest)
      • getAcceptMimeTypes

        @Nonnull
        public static com.helger.http.AcceptMimeTypeList getAcceptMimeTypes​(@Nonnull
                                                                            jakarta.servlet.http.HttpServletRequest aHttpRequest)
      • getBasicAuthClientCredentials

        @Nullable
        public static com.helger.http.basicauth.BasicAuthClientCredentials getBasicAuthClientCredentials​(@Nonnull
                                                                                                         jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the Basic authentication credentials from the passed HTTP servlet request from the HTTP header CHttpHeader.AUTHORIZATION.
        Parameters:
        aHttpRequest - The HTTP request to be interpreted. May be null.
        Returns:
        null if the passed request does not contain a valid HTTP Basic Authentication header value.
      • getDigestAuthClientCredentials

        @Nullable
        public static com.helger.http.digestauth.DigestAuthClientCredentials getDigestAuthClientCredentials​(@Nonnull
                                                                                                            jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the Digest authentication credentials from the passed HTTP servlet request from the HTTP header CHttpHeader.AUTHORIZATION.
        Parameters:
        aHttpRequest - The HTTP request to be interpreted. May be null.
        Returns:
        null if the passed request does not contain a valid HTTP Digest Authentication header value.
      • getHttpUserAgentStringFromRequest

        @Nullable
        public static String getHttpUserAgentStringFromRequest​(@Nonnull
                                                               jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the user agent from the given request.
        Parameters:
        aHttpRequest - The HTTP request to get the UA from.
        Returns:
        null if no user agent string is present
      • getUserAgent

        @Nullable
        public static com.helger.useragent.IUserAgent getUserAgent​(@Nonnull
                                                                   jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the user agent object from the given HTTP request.
        Parameters:
        aHttpRequest - The HTTP request to extract the information from.
        Returns:
        A non-null user agent object or null in case of an internal inconsistency.
      • getUAProfile

        @Nonnull
        public static com.helger.useragent.uaprofile.UAProfile getUAProfile​(@Nonnull
                                                                            jakarta.servlet.http.HttpServletRequest aHttpRequest)
        Get the user agent object from the given HTTP request.
        Parameters:
        aHttpRequest - The HTTP request to extract the information from.
        Returns:
        A non-null user agent object.
      • getCheckBoxHiddenFieldName

        @Nonnull
        @Nonempty
        public static String getCheckBoxHiddenFieldName​(@Nonnull @Nonempty
                                                        String sFieldName)
        Get the name of the automatic hidden field associated with a check-box.
        Parameters:
        sFieldName - The name of the check-box.
        Returns:
        The name of the hidden field associated with the given check-box name.