Class HttpUtils

java.lang.Object
org.codice.ddf.platform.util.HttpUtils

public class HttpUtils extends Object
  • Method Details

    • stripQueryString

      public static String stripQueryString(String url)
      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

      public static String validateAndStripQueryString(String url) throws MalformedURLException
      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 request
      response - 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