public class HttpUtils extends Object
Constructor and Description |
---|
HttpUtils() |
Modifier and Type | Method and Description |
---|---|
static Map<String,javax.servlet.http.Cookie> |
getCookieMap(javax.servlet.http.HttpServletRequest req)
Returns a mapping of cookies from the incoming request.
|
static void |
returnSimpleResponse(int code,
javax.servlet.http.HttpServletResponse response)
Sends the given response code back to the caller.
|
static String |
stripQueryString(String url)
Strip a query string from a url.
|
static String |
validateAndStripQueryString(String url)
Strip a query string from a url.
|
public static String stripQueryString(String url)
NOTE: a url with multiple query strings is still considered valid.
url
- valid urlpublic static String validateAndStripQueryString(String url) throws MalformedURLException
url
- the url to stripMalformedURLException
- if the input url is invalidpublic static void returnSimpleResponse(int code, javax.servlet.http.HttpServletResponse response)
code
- HTTP response code for this requestresponse
- the servlet response objectpublic static Map<String,javax.servlet.http.Cookie> getCookieMap(javax.servlet.http.HttpServletRequest req)
req
- Servlet request for this callThis work is licensed under a Creative Commons Attribution 4.0 International License.