Constructor and Description |
---|
RestUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
getHttpResponseText(int rc)
Returns readable text for an HTTP response code.
|
static String |
getPathInfoUndecoded(javax.servlet.http.HttpServletRequest req)
Identical to
HttpServletRequest.getPathInfo() but doesn't decode encoded characters. |
static Map<String,String[]> |
parseQuery(Object qs)
Parses a URL query string or form-data body.
|
static Map<String,String[]> |
parseQuery(Object qs,
Map<String,String[]> map)
Same as
parseQuery(Object) but allows you to specify the map to insert values into. |
static StringBuffer |
trimPathInfo(StringBuffer requestURI,
String contextPath,
String servletPath)
Efficiently trims the path info part from a request URI.
|
public RestUtils()
public static String getHttpResponseText(int rc)
rc
- The HTTP response code.public static String getPathInfoUndecoded(javax.servlet.http.HttpServletRequest req)
HttpServletRequest.getPathInfo()
but doesn't decode encoded characters.req
- The HTTP requestpublic static StringBuffer trimPathInfo(StringBuffer requestURI, String contextPath, String servletPath)
The result is the URI of the servlet itself.
requestURI
- The value returned by HttpServletRequest.getRequestURL()
contextPath
- The value returned by HttpServletRequest.getContextPath()
servletPath
- The value returned by HttpServletRequest.getServletPath()
public static Map<String,String[]> parseQuery(Object qs) throws Exception
qs
- A reader or string containing the query string to parse.Exception
public static Map<String,String[]> parseQuery(Object qs, Map<String,String[]> map) throws Exception
parseQuery(Object)
but allows you to specify the map to insert values into.qs
- A reader containing the query string to parse.map
- The map to pass the values into.Exception
Copyright © 2018 Apache. All rights reserved.