Class HTTPMethods

java.lang.Object
org.opengis.cite.sta10.util.HTTPMethods

public class HTTPMethods extends Object
Sending HTTP Methods: GET, POST, PUT, PATCH, and DELETE
  • Constructor Details

    • HTTPMethods

      public HTTPMethods()
  • Method Details

    • doGet

      public static Map<String,Object> doGet(String urlString)
      Send HTTP GET request to the urlString and return response code and response body
      Parameters:
      urlString - The URL that the GET request should be sent to
      Returns:
      response-code and response(response body) of the HTTP GET in the MAP format. If the response is not 200, the response(response body) will be empty.
    • doPost

      public static Map<String,Object> doPost(String urlString, String postBody)
      Send HTTP POST request to the urlString with postBody and return response code and response body
      Parameters:
      urlString - The URL that the POST request should be sent to
      postBody - The body of the POST request
      Returns:
      response-code and response of the HTTP POST in the MAP format. If the response is 201, the response will contain the self-link to the created entity. Otherwise, it will be empty String.
    • doPut

      public static Map<String,Object> doPut(String urlString, String putBody)
      Send HTTP PUT request to the urlString with putBody and return response code and response body
      Parameters:
      urlString - The URL that the PUT request should be sent to
      putBody - The body of the PUT request
      Returns:
      response-code and response(response body) of the HTTP PUT in the MAP format. If the response is not 200, the response(response body) will be empty.
    • doDelete

      public static Map<String,Object> doDelete(String urlString)
      Send HTTP DELETE request to the urlString and return response code
      Parameters:
      urlString - The URL that the DELETE request should be sent to
      Returns:
      response-code of the HTTP DELETE in the MAP format. The MAP contains an empty response, in order to be consistent with what other HTTP requests return.
    • doPatch

      public static Map<String,Object> doPatch(String urlString, String patchBody)
      Send HTTP PATCH request to the urlString with patchBody and return response code and response body
      Parameters:
      urlString - The URL that the PATCH request should be sent to
      patchBody - The body of the PATCH request
      Returns:
      response-code and response(response body) of the HTTP PATCH in the MAP format. If the response is not 200, the response(response body) will be empty.