public class ApiRequest extends Object
| Constructor and Description |
|---|
ApiRequest()
Constructor.
|
ApiRequest(String serviceName)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ApiRequest |
addHeader(String header,
String value)
Sets the header in the request.
|
Map<String,String> |
getHeaders()
Returns a map of all the headers included in this request.
|
HttpMethodName |
getHttpMethod() |
Map<String,String> |
getParameters()
Returns a map of all parameters in this request.
|
String |
getPath()
Returns the path to the resource being requested.
|
ApiRequest |
withBody(byte[] body)
Sets the optional stream containing the payload data from the byte array
to include for this request.
|
ApiRequest |
withBody(InputStream body)
Sets the optional stream containing the payload data to include for this
request.
|
ApiRequest |
withBody(String body)
Sets the optional stream containing the payload data from a string
content to include for this request.
|
ApiRequest |
withHeaders(Map<String,String> headers)
Sets all headers, clearing any existing ones.
|
ApiRequest |
withHttpMethod(HttpMethodName httpMethod)
Sets the HTTP method (GET, POST, etc) to use when sending this request.
|
ApiRequest |
withParameter(String name,
String value)
Set parameters with name and value.
|
ApiRequest |
withParameters(Map<String,String> parameters)
Sets all parameters, clearing any existing values.
|
ApiRequest |
withPath(String path)
Sets the path to the resource being requested.
|
public ApiRequest(String serviceName)
serviceName - The name of the service to which this request is being
sent.public ApiRequest()
public ApiRequest withHeaders(Map<String,String> headers)
headers - A map of all http headerspublic ApiRequest addHeader(String header, String value)
header - the http header name.value - the http header value.public Map<String,String> getHeaders()
public ApiRequest withPath(String path)
path - The path to the resource being requested.public String getPath()
public ApiRequest withParameters(Map<String,String> parameters)
parameters - the http request parameters.public Map<String,String> getParameters()
public ApiRequest withParameter(String name, String value)
name - the parameter name.value - the parameter value.public ApiRequest withHttpMethod(HttpMethodName httpMethod)
httpMethod - The HTTP method to use when sending this request.public HttpMethodName getHttpMethod()
HttpMethodNamepublic ApiRequest withBody(InputStream body)
body - The optional stream containing the payload data to include
for this request.public ApiRequest withBody(byte[] body)
body - The request body represented as a array of bytes.public ApiRequest withBody(String body)
body - the request body represented as a string.Copyright © 2019. All rights reserved.