Package org.rapidcontext.util
Class HttpUtil.Helper
java.lang.Object
org.rapidcontext.util.HttpUtil.Helper
- Enclosing interface:
HttpUtil
Some static utility methods for HTTP.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringbrowserInfo(String userAgent) Returns the browser best matching the user agent string.static booleanbrowserUnsupported(String userAgent) Checks for known unsupported browser user agents.static StringDecodes a URL from the URL encoding.static intdefaultPort(String protocol) Returns the default port for a protocol.static StringEncodes a URL with proper URL encoding.static booleanhasContent(String method) Checks if the specified HTTP method supports request content.
-
Method Details
-
defaultPort
Returns the default port for a protocol.- Parameters:
protocol- the protocol name (HTTP/HTTPS)- Returns:
- the default HTTP or HTTPS port number
-
hasContent
Checks if the specified HTTP method supports request content.- Parameters:
method- the HTTP method to check- Returns:
- true if content data may be provided, or false otherwise
-
browserInfo
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
-
browserUnsupported
Checks for known unsupported browser user agents.- Parameters:
userAgent- the request User-Agent header- Returns:
- true if the browser is unsupported, or false otherwise
-
encodeUrl
Encodes a URL with proper URL encoding.- Parameters:
href- the URL to encode- Returns:
- the encoded URL
-
decodeUrl
Decodes a URL from the URL encoding.- Parameters:
href- the URL to decode- Returns:
- the decoded URL
-