Package edu.tufts.hrilab.util
Class Http
java.lang.Object
edu.tufts.hrilab.util.Http
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImagesendGetImage(String endpointUrl) Get an image as a BufferedImage from a remote source.static Http.HTTPRequestResponsesendGetRequest(String endpointUrl, Map<String, String> headers) Returns the JSON string response from an endpoint via GET.static Http.HTTPRequestResponseReturns the JSON string response from an endpoint via POST.
-
Field Details
-
log
protected static org.slf4j.Logger log
-
-
Constructor Details
-
Http
public Http()
-
-
Method Details
-
sendGetRequest
public static Http.HTTPRequestResponse sendGetRequest(String endpointUrl, Map<String, String> headers) Returns the JSON string response from an endpoint via GET.- Parameters:
endpointUrl- URL, including path, to make request toheaders- Headers for request in a map- Returns:
- Response from the endpoint as JSON string
-
sendPostRequestStreaming
-
sendPostRequest
public static Http.HTTPRequestResponse sendPostRequest(String endpointUrl, Object requestBody, Map<String, String> headers) Returns the JSON string response from an endpoint via POST.- Parameters:
endpointUrl- URL, including path, to make request torequestBody- Body payload of requestheaders- Headers for request in a map- Returns:
- Response from the endpoint as JSON string
-
sendGetImage
Get an image as a BufferedImage from a remote source.- Parameters:
endpointUrl- url of image to get- Returns:
- image data as BufferedImage
-