Class HttpRequest<R>

  • Type Parameters:
    R - the entity return type

    public class HttpRequest<R>
    extends Object
    A Request Delegate which aids in building the request that is compatible with the OpenStack Rest API. The request is used to encoding as well as keeping reference to the return type
    Author:
    Jeremy Unruh
    • Constructor Detail

      • HttpRequest

        public HttpRequest()
      • HttpRequest

        public HttpRequest​(String endpoint,
                           String path,
                           HttpMethod method,
                           ModelEntity entity,
                           Class<R> returnType)
        Creates a new HttpRequest
        Parameters:
        endpoint - the endpoint URI
        path - the path which will be appended to the endpoint URI
        method - the method the method type to invoke
        entity - the entity (used for posts)
        returnType - the expected return type
    • Method Detail

      • builder

        public static <R> HttpRequest.RequestBuilder<R> builder​(Class<R> returnType)
        A build for creating HttpRequest objects
        Type Parameters:
        R - the expected return type
        Parameters:
        returnType - the return type
        Returns:
        the request builder
      • getMethod

        public HttpMethod getMethod()
        Returns:
        the method this request will use
      • getContentType

        public String getContentType()
        Returns:
        the content type for the request
      • getEndpoint

        public String getEndpoint()
        Returns:
        the endpoint URI
      • getPath

        public String getPath()
        Returns:
        the http path
      • getJson

        public String getJson()
        If JSON is explicitly set vs an entity then this method will return a JSON String otherwise Empty
        Returns:
        JSON String form or Empty
      • hasJson

        public boolean hasJson()
        Returns:
        true, if a JSON Object has been set
      • getReturnType

        public Class<R> getReturnType()
        Returns:
        the return type expected after invocation
      • getEntity

        public Object getEntity()
        Returns:
        the entity to post
      • hasQueryParams

        public boolean hasQueryParams()
        Returns:
        true, if query params have been added
      • getQueryParams

        public Map<String,​List<Object>> getQueryParams()
        Returns:
        the request query params
      • getHeaders

        public Map<String,​Object> getHeaders()
        Returns:
        the headers to apply
      • hasHeaders

        public boolean hasHeaders()
        Returns:
        true, if headers have been added
      • getConfig

        public Config getConfig()
        Returns:
        the client configuration associated with this request
      • getUrl

        public String getUrl()
        Append query parameters into the url.