Class Request.Builder

  • Enclosing class:
    Request

    public static class Request.Builder
    extends java.lang.Object
    HTTP Request Builder class
    • Constructor Summary

      Constructors 
      Constructor Description
      Builder​(javax.ws.rs.client.WebTarget service)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Request.Builder atEndPoint​(java.lang.String path)
      Append the given path to the requested URL
      Request.Builder atEndPoint​(API path)
      Append the given path to the requested URL
      void delete()
      Send a DELETE request to the given endpoint
      java.lang.Object delete​(java.lang.Class<?> T)
      Send a DELETE request to the given endpoint
      void delete​(java.lang.String session)
      Send a DELETE request to the given endpoint
      java.lang.Object delete​(java.lang.String session, java.lang.Class<?> T)
      Send a DELETE request with a session header to the given endpoint
      void get()
      Send a GET request to the given endpoint
      java.lang.Object get​(java.lang.Class<?> T)
      Send a GET request to the given endpoint
      java.lang.Object get​(java.lang.String session, java.lang.Class<?> T)
      Send a GET request with a session header to the given endpoint
      void patch​(java.lang.String session)
      Send a PATCH request to the desired endpoint
      java.lang.Object patch​(java.lang.String session, java.lang.Class<?> T)
      Send a PATCh request to the desired enpoint
      void post()
      Send a POST request to the given endpoint
      java.lang.Object post​(java.lang.Class<?> T)
      Send a POST request to the given endpoint.
      void post​(java.lang.String session)
      Send a POST request to the given endpoint
      java.lang.Object post​(java.lang.String session, java.lang.Class<?> T)
      Send a POST request with a session header to the given endpoint
      Request.Builder withBody​(java.lang.Object body)
      Serialize a POJO into JSON
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Builder

        public Builder​(javax.ws.rs.client.WebTarget service)
        Parameters:
        service - target url
    • Method Detail

      • withBody

        public Request.Builder withBody​(java.lang.Object body)
        Serialize a POJO into JSON
        Parameters:
        body - JSON request body
        Returns:
        this
      • atEndPoint

        public Request.Builder atEndPoint​(java.lang.String path)
        Append the given path to the requested URL
        Parameters:
        path - The relative path to the endpoint
        Returns:
        this
      • atEndPoint

        public Request.Builder atEndPoint​(API path)
        Append the given path to the requested URL
        Parameters:
        path - The relative path to the endpoint
        Returns:
        this
      • get

        public void get()
                 throws java.lang.Exception
        Send a GET request to the given endpoint
        Throws:
        java.lang.Exception
      • get

        public java.lang.Object get​(java.lang.Class<?> T)
                             throws java.lang.Exception
        Send a GET request to the given endpoint
        Returns:
        JSON response body
        Throws:
        java.lang.Exception
      • get

        public java.lang.Object get​(java.lang.String session,
                                    java.lang.Class<?> T)
                             throws java.lang.Exception
        Send a GET request with a session header to the given endpoint
        Parameters:
        session -
        T - Desired return type
        Returns:
        JSON response body
        Throws:
        java.lang.Exception
      • post

        public void post()
                  throws java.lang.Exception
        Send a POST request to the given endpoint
        Throws:
        java.lang.Exception
      • post

        public void post​(java.lang.String session)
                  throws java.lang.Exception
        Send a POST request to the given endpoint
        Parameters:
        session - session header
        Throws:
        java.lang.Exception
      • post

        public java.lang.Object post​(java.lang.Class<?> T)
                              throws java.lang.Exception
        Send a POST request to the given endpoint.
        Parameters:
        T - Desired return type
        Returns:
        JSON response body
        Throws:
        java.lang.Exception
      • post

        public java.lang.Object post​(java.lang.String session,
                                     java.lang.Class<?> T)
                              throws java.lang.Exception
        Send a POST request with a session header to the given endpoint
        Parameters:
        session -
        Returns:
        JSON response body
        Throws:
        java.lang.Exception
      • delete

        public void delete()
                    throws java.lang.Exception
        Send a DELETE request to the given endpoint
        Throws:
        java.lang.Exception
      • delete

        public void delete​(java.lang.String session)
                    throws java.lang.Exception
        Send a DELETE request to the given endpoint
        Parameters:
        session - session header
        Throws:
        java.lang.Exception
      • delete

        public java.lang.Object delete​(java.lang.Class<?> T)
                                throws java.lang.Exception
        Send a DELETE request to the given endpoint
        Parameters:
        T - desired return type
        Returns:
        JSON response body
        Throws:
        java.lang.Exception
      • delete

        public java.lang.Object delete​(java.lang.String session,
                                       java.lang.Class<?> T)
                                throws java.lang.Exception
        Send a DELETE request with a session header to the given endpoint
        Parameters:
        session -
        T - desired return type
        Returns:
        JSON response body
        Throws:
        java.lang.Exception
      • patch

        public void patch​(java.lang.String session)
                   throws java.lang.Exception
        Send a PATCH request to the desired endpoint
        Parameters:
        session - session header
        Throws:
        java.lang.Exception
      • patch

        public java.lang.Object patch​(java.lang.String session,
                                      java.lang.Class<?> T)
                               throws java.lang.Exception
        Send a PATCh request to the desired enpoint
        Parameters:
        session - session header
        T - desired return type
        Returns:
        JSON response body
        Throws:
        java.lang.Exception