Package org.codice.ddf.platform.util
Class HttpUtils
java.lang.Object
org.codice.ddf.platform.util.HttpUtils
-
Method Summary
Modifier and TypeMethodDescriptiongetCookieMap(javax.servlet.http.HttpServletRequest req) Returns a mapping of cookies from the incoming request.static voidreturnSimpleResponse(int code, javax.servlet.http.HttpServletResponse response) Sends the given response code back to the caller.static StringstripQueryString(String url) Strip a query string from a url.static StringStrip a query string from a url.
-
Method Details
-
stripQueryString
Strip a query string from a url. If the url is not valid, it will be returned as is.NOTE: a url with multiple query strings is still considered valid.
- Parameters:
url- valid url- Returns:
- url query parameters removed
-
validateAndStripQueryString
Strip a query string from a url. If the url is not valid, an exception will be thrown.- Parameters:
url- the url to strip- Returns:
- url with query parameters removed
- Throws:
MalformedURLException- if the input url is invalid
-
returnSimpleResponse
public static void returnSimpleResponse(int code, javax.servlet.http.HttpServletResponse response) Sends the given response code back to the caller.- Parameters:
code- HTTP response code for this requestresponse- the servlet response object
-
getCookieMap
public static Map<String,javax.servlet.http.Cookie> getCookieMap(javax.servlet.http.HttpServletRequest req) Returns a mapping of cookies from the incoming request. Key is the cookie name, while the value is the Cookie object itself.- Parameters:
req- Servlet request for this call- Returns:
- map of Cookie objects present in the current request - always returns a map
-