Class ZoweRequest

    • Field Detail

      • X_CSRF_ZOSMF_HEADER_KEY

        public static final String X_CSRF_ZOSMF_HEADER_KEY
      • X_CSRF_ZOSMF_HEADER_VALUE

        public static final String X_CSRF_ZOSMF_HEADER_VALUE
      • client

        protected org.apache.http.client.HttpClient client
      • localContext

        protected final org.apache.http.protocol.HttpContext localContext
      • httpResponse

        protected org.apache.http.HttpResponse httpResponse
    • Constructor Detail

      • ZoweRequest

        public ZoweRequest​(ZOSConnection connection,
                           ZoweRequestType.VerbType requestType)
        ZoweRequest constructor.
        Parameters:
        connection - connection information, see ZOSConnection object
        requestType - request type, see ZoweRequestType.VerbType object
    • Method Detail

      • executeRequest

        public abstract Response executeRequest()
                                         throws Exception
        Abstraction method. Execute the formulated http request
        Returns:
        Response value
        Throws:
        Exception - error executing request
      • setStandardHeaders

        public abstract void setStandardHeaders()
        Abstraction method. Set standard headers for the http request
      • setHeaders

        public abstract void setHeaders​(Map<String,​String> headers)
        Abstraction method. Set any headers needed for the http request
        Parameters:
        headers - headers to add to the request
      • setRequest

        public abstract void setRequest​(String url)
                                 throws Exception
        Abstraction method. Initialize the http request object with an url value
        Parameters:
        url - rest url end point
        Throws:
        Exception - error setting the http request
      • setRequest

        public abstract void setRequest​(String url,
                                        String body)
                                 throws Exception
        Abstraction method. Initialize the http request object with an url and body values
        Parameters:
        url - rest url end point
        body - data to be sent with request
        Throws:
        Exception - error setting the http request
      • setup

        protected void setup()
        Setup to be used first in setting up the http request
      • executeJsonRequest

        protected <T> Response executeJsonRequest​(T request)
                                           throws Exception
        Execute a Zowe rest call request and return a Json object
        Type Parameters:
        T - http verb type
        Parameters:
        request - http verb request
        Returns:
        response object
        Throws:
        Exception - error processing request
      • executeTextRequest

        protected <T> Response executeTextRequest​(T request)
                                           throws Exception
        Execute a Zowe rest call request and return a text object
        Type Parameters:
        T - http verb type
        Parameters:
        request - http verb request
        Returns:
        response object
        Throws:
        Exception - error processing request
      • executeStreamRequest

        protected <T> Response executeStreamRequest​(T request)
                                             throws Exception
        Execute a Zowe rest call request and return a stream object
        Type Parameters:
        T - http verb type
        Parameters:
        request - http verb request
        Returns:
        response object
        Throws:
        Exception - error processing request
      • requestType

        public ZoweRequestType.VerbType requestType()
        Retrieve current request http type
        Returns:
        http request type