Package zowe.client.sdk.rest
Class ZosmfRequest
- java.lang.Object
-
- zowe.client.sdk.rest.ZosmfRequest
-
- Direct Known Subclasses:
DeleteJsonZosmfRequest,GetJsonZosmfRequest,GetStreamZosmfRequest,GetTextZosmfRequest,PostJsonZosmfRequest,PutJsonZosmfRequest,PutStreamZosmfRequest,PutTextZosmfRequest
public abstract class ZosmfRequest extends Object
Base abstract class that conforms to http CRUD operations- Version:
- 4.0
- Author:
- Frank Giordano
-
-
Field Summary
Fields Modifier and Type Field Description protected ZosConnectionconnection/** ZosConnection objectprotected Map<String,String>headersMap of HTTP headersprotected kong.unirest.core.CookietokenCookie object representing a TOKENprotected StringurlURL stringstatic StringX_CSRF_ZOSMF_HEADER_KEYX_CSRF_ZOSMF_HEADER_KEY header infostatic StringX_CSRF_ZOSMF_HEADER_VALUEX_CSRF_ZOSMF_HEADER_VALUE header info
-
Constructor Summary
Constructors Constructor Description ZosmfRequest(ZosConnection connection)ZosmfRequest constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T> ResponsebuildResponse(kong.unirest.core.HttpResponse<T> reply)Build a Response object from a given HttpResponse replyabstract ResponseexecuteRequest()Perform the http rest requestMap<String,String>getHeaders()Get current http header value(s) for requestStringgetUrl()Retrieve the url string valueabstract 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
-
-
-
Field Detail
-
X_CSRF_ZOSMF_HEADER_KEY
public static final String X_CSRF_ZOSMF_HEADER_KEY
X_CSRF_ZOSMF_HEADER_KEY header info
-
X_CSRF_ZOSMF_HEADER_VALUE
public static final String X_CSRF_ZOSMF_HEADER_VALUE
X_CSRF_ZOSMF_HEADER_VALUE header info
-
connection
protected final ZosConnection connection
/** ZosConnection object
-
url
protected String url
URL string
-
token
protected kong.unirest.core.Cookie token
Cookie object representing a TOKEN
-
-
Constructor Detail
-
ZosmfRequest
public ZosmfRequest(ZosConnection connection)
ZosmfRequest constructor- Parameters:
connection- for connection information, see ZosConnection object
-
-
Method Detail
-
buildResponse
public <T> Response buildResponse(kong.unirest.core.HttpResponse<T> reply) throws ZosmfRequestException
Build a Response object from a given HttpResponse reply- Type Parameters:
T- either JsonNode, String or byte[] type- Parameters:
reply- HttpResponse object- Returns:
- Response object
- Throws:
ZosmfRequestException- request error state
-
executeRequest
public abstract Response executeRequest() throws ZosmfRequestException
Perform the http rest request- Returns:
- Response object
- Throws:
ZosmfRequestException- request error state
-
setBody
public abstract void setBody(Object body)
Set the body information for the http request- Parameters:
body- object value
-
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
-
getUrl
public String getUrl()
Retrieve the url string value- Returns:
- string value
-
-