Class HttpUtil.Helper

java.lang.Object
org.rapidcontext.util.HttpUtil.Helper
Enclosing interface:
HttpUtil

public static final class HttpUtil.Helper extends Object
Some static utility methods for HTTP.
  • Method Details

    • defaultPort

      public static int defaultPort(String protocol)
      Returns the default port for a protocol.
      Parameters:
      protocol - the protocol name (HTTP/HTTPS)
      Returns:
      the default HTTP or HTTPS port number
    • browserInfo

      public static String browserInfo(String userAgent)
      Returns the browser best matching the user agent string.
      Parameters:
      userAgent - the request User-Agent header
      Returns:
      the browser info matching the user agent, or null for no match
    • encodeUrl

      public static String encodeUrl(String href)
      Encodes a URL with proper URL encoding.
      Parameters:
      href - the URL to encode
      Returns:
      the encoded URL
    • decodeUrl

      public static String decodeUrl(String href)
      Decodes a URL from the URL encoding.
      Parameters:
      href - the URL to decode
      Returns:
      the decoded URL