Package zowe.client.sdk.rest
Class ZoweRequest
- java.lang.Object
-
- zowe.client.sdk.rest.ZoweRequest
-
- Direct Known Subclasses:
JsonDeleteRequest,JsonGetRequest,JsonPostRequest,JsonPutRequest,StreamGetRequest,StreamPutRequest,TextGetRequest,TextPutRequest
public abstract class ZoweRequest extends Object
Base abstract class that conforms to Http CRUD operations- Version:
- 2.0
- Author:
- Frank Giordano
-
-
Field Summary
Fields Modifier and Type Field Description protected ZosConnectionconnectionprotected Map<String,String>headersprotected Stringurlstatic StringX_CSRF_ZOSMF_HEADER_KEYstatic StringX_CSRF_ZOSMF_HEADER_VALUE
-
Constructor Summary
Constructors Constructor Description ZoweRequest(ZosConnection connection)ZoweRequest constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ResponseexecuteRequest()Perform the http rest requestprotected static ResponsegetJsonResponse(kong.unirest.HttpResponse<kong.unirest.JsonNode> reply)Retrieve the http response informationabstract voidsetBody(Object body)Set the body information for the http requestvoidsetHeaders(Map<String,String> headers)Set any headers needed for the http requestabstract voidsetStandardHeaders()Set the standard headers for the http requestvoidsetUrl(String url)Set the url needed for the http request
-
-
-
Constructor Detail
-
ZoweRequest
public ZoweRequest(ZosConnection connection)
ZoweRequest constructor- Parameters:
connection- connection information, see ZosConnection object
-
-
Method Detail
-
getJsonResponse
protected static Response getJsonResponse(kong.unirest.HttpResponse<kong.unirest.JsonNode> reply)
Retrieve the http response information- Parameters:
reply- json http response object- Returns:
- Response object
-
executeRequest
public abstract Response executeRequest() throws kong.unirest.UnirestException
Perform the http rest request- Returns:
- Response object
- Throws:
kong.unirest.UnirestException- processing request error
-
setBody
public abstract void setBody(Object body) throws kong.unirest.UnirestException
Set the body information for the http request- Parameters:
body- object value- Throws:
kong.unirest.UnirestException- error setting body
-
setHeaders
public void setHeaders(Map<String,String> headers)
Set any headers needed for the http request- Parameters:
headers- headers to add to the request
-
setStandardHeaders
public abstract void setStandardHeaders()
Set the standard headers for the http request
-
setUrl
public void setUrl(String url) throws IllegalArgumentException
Set the url needed for the http request- Parameters:
url- rest url end point- Throws:
IllegalArgumentException- error setting valid url string
-
-