public class ServletUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
encode(java.lang.String string)
Encodes the specified string with a UTF-8 encoding.
|
static java.lang.String |
getRequestPath(javax.servlet.http.HttpServletRequest req)
util function to take a servlet request and compute the path
relative to the server (not relative to the webapp).
|
static java.lang.String |
pathWithParams(java.lang.String base,
java.util.Map params)
Create a URL with parameters tacked on.
|
static java.lang.String |
requestParamsToQueryString(javax.servlet.ServletRequest request)
Creates a encoded URL query string with the parameters from the given request.
|
public static java.lang.String getRequestPath(javax.servlet.http.HttpServletRequest req)
req
- The request to inspectpublic static java.lang.String pathWithParams(java.lang.String base, java.util.Map params)
base
- baseUrl to compute path fromparams
- params to fillout on the URLpublic static java.lang.String requestParamsToQueryString(javax.servlet.ServletRequest request)
Note: This method does not support multi-value parameters.
request
- The request for which the query string will be generated.public static java.lang.String encode(java.lang.String string)
string
- The String to encode.