Class RESTResource


  • public class RESTResource
    extends ExternalResource
    Class for working with a REST endpoint as Resource.
    • Constructor Detail

      • RESTResource

        public RESTResource​(java.lang.String endpoint,
                            java.lang.String method,
                            java.lang.String body,
                            java.lang.String fileName,
                            com.google.gson.JsonArray headers,
                            java.lang.String auth)
        Resource from an REST endpoint.
        Parameters:
        endpoint - URL of the data source from where the JSON needs to be read.
        method - HTTP method of the request. "GET" by default.
        body - Body of HTTP request (can be left empty for GET requests)
        fileName - Name of the output file.
        headers - HTTP headers, e.g. [{"Content-Type":"application/json"},{"Custom-Auth-Token":"xysazxklj4568asdf46a5sd4f"}]
        auth - Basic authentication i.e. 'user:password' to compute an Authorization header.
    • Method Detail

      • getMethod

        public java.lang.String getMethod()
        Returns:
        HTTP method of the request.
      • setMethod

        public void setMethod​(java.lang.String method)
        Parameters:
        method - HTTP method of the request. "GET" by default.
      • getBody

        public java.lang.String getBody()
        Returns:
        Body of HTTP request (can be left empty for GET requests).
      • setBody

        public void setBody​(java.lang.String body)
        Parameters:
        body - Body of HTTP request (can be left empty for GET requests).
      • getJSON

        public com.google.gson.JsonObject getJSON()
        Overrides:
        getJSON in class ExternalResource
        Returns:
        JSONObject with the tags for this element for the Cloud Office Print server.
      • getTemplateTags

        public java.util.Set<java.lang.String> getTemplateTags()
        Cannot be used for a resource.
        Specified by:
        getTemplateTags in class RenderElement
        Returns:
        null