Class RequestBuilder


  • public class RequestBuilder
    extends Object

    Provides a HTTP Request Builder class.

    Examples

    Please find the Components HTTP Request Builder examples below.

    Building Get Request Example

    This Groovy example shows how to build GetRequest object

     import com.avoka.tm.http.*
     import com.avoka.tm.vo.*
    
     SvcConn svcConn = svcDef.svcConn
     String path = "https://service.mycorp.com/..."
    
     GetRequest get = new RequestBuilder()
         .setSvcConn(svcConn)
         .setPath(path)
         .buildGet()  

    Building Post Request Example

    This Groovy example shows how to build PostRequest object.

     import com.avoka.tm.http.*
     import com.avoka.tm.vo.*
    
     SvcConn svcConn = svcDef.svcConn
     String path = "https://service.mycorp.com/..."
    
     PostRequest post = new RequestBuilder()
         .setSvcConn(svcConn)
         .setPath(path)
         .buildPost(); 
    Since:
    5.0.0
    See Also:
    GetRequest, PostRequest
    • Constructor Detail

      • RequestBuilder

        public RequestBuilder()
    • Method Detail

      • setPath

        public RequestBuilder setPath​(String path)
        Set the path to append the to service connection endpoint for the request URL.
        Parameters:
        path - the to append the to service connection endpoint for the request URL
        Returns:
        the request builder
      • setSvcConn

        public RequestBuilder setSvcConn​(SvcConn svcConn)
        Set the service connection parameter.
        Parameters:
        svcConn - the service connection parameter
        Returns:
        the request builder
      • buildDelete

        public DeleteRequest buildDelete()
        Return a new DeleteRequest object from the service connection parameter.
        Returns:
        a new DeleteRequest object from the service connection parameter
      • buildGet

        public GetRequest buildGet()
        Return a new GetRequest object from the service connection parameter.
        Returns:
        a new GetRequest object from the service connection parameter
      • buildPatch

        public PatchRequest buildPatch()
        Return a new PatchRequest object from the service connection parameter.
        Returns:
        a new PatchRequest object from the service connection parameter
      • buildPost

        public PostRequest buildPost()
        Return a new PostRequest object from the service connection parameter.
        Returns:
        a new PostRequest object from the service connection parameter
      • buildPut

        public PutRequest buildPut()
        Return a new PutRequest object from the service connection parameter.
        Returns:
        a new PutRequest object from the service connection parameter