Interface HttpRequest

    • Method Detail

      • httpRequest

        static HttpRequest httpRequest​(ByteArray request)
        This is a helper method to create a new instance of HttpRequest.
        Parameters:
        request - The HTTP request
        Returns:
        A new HttpRequest instance.
      • httpRequest

        static HttpRequest httpRequest​(java.lang.String request)
        This is a helper method to create a new instance of HttpRequest.
        Parameters:
        request - The HTTP request.
        Returns:
        A new HttpRequest instance.
      • httpRequest

        static HttpRequest httpRequest​(HttpService service,
                                       java.lang.String request)
        This is a helper method to create a new instance of HttpRequest.
        Parameters:
        service - An HTTP service for the request.
        request - The HTTP request.
        Returns:
        A new HttpRequest instance.
      • httpRequest

        static HttpRequest httpRequest​(HttpService service,
                                       java.util.List<java.lang.String> headers,
                                       ByteArray body)
        This is a helper method to create a new instance of HttpRequest.
        Parameters:
        service - An HTTP service for the request.
        headers - A list of HTTP headers.
        body - A body of the HTTP request.
        Returns:
        A new HttpRequest instance.
      • httpRequest

        static HttpRequest httpRequest​(HttpService service,
                                       java.util.List<java.lang.String> headers,
                                       java.lang.String body)
        This is a helper method to create a new instance of HttpRequest.
        Parameters:
        service - An HTTP service for the request.
        headers - A list of HTTP headers.
        body - A body of the HTTP request.
        Returns:
        A new HttpRequest instance.
      • httpVerbatimRequest

        static HttpRequest httpVerbatimRequest​(HttpService service,
                                               java.util.List<HttpHeader> headers,
                                               ByteArray body)
        This is a helper method to create a new instance of HttpRequest that will only contain the data provided in the arguments.
        Parameters:
        service - An HTTP service for the request.
        headers - A list of HTTP headers.
        body - A body of the HTTP request.
        Returns:
        A new HttpRequest instance.
      • httpVerbatimRequest

        static HttpRequest httpVerbatimRequest​(HttpService service,
                                               java.util.List<HttpHeader> headers,
                                               java.lang.String body)
        This is a helper method to create a new instance of HttpRequest that will only contain the data provided in the arguments.
        Parameters:
        service - An HTTP service for the request.
        headers - A list of HTTP headers.
        body - A body of the HTTP request.
        Returns:
        A new HttpRequest instance.
      • httpRequestFromUrl

        static HttpRequest httpRequestFromUrl​(java.lang.String url)
        This is a helper method to create a new instance of HttpRequest.
        Parameters:
        url - A URL for the request.
        Returns:
        A new HttpRequest instance.
      • httpService

        HttpService httpService()
        This method is used to retrieve the HTTP service for the request.
        Returns:
        An HttpService object containing details of the HTTP service.
      • method

        java.lang.String method()
        Returns:
        The HTTP method used in the request.
      • url

        java.lang.String url()
        Returns:
        The URL in the request.
      • contentType

        ContentType contentType()
        Returns:
        The content type of the message body.
      • parameters

        java.util.List<ParsedHttpParameter> parameters()
        Returns:
        The parameters contained in the request.
      • withService

        HttpRequest withService​(HttpService service)
        This is a helper method that builds a modified request with the new service.
        Parameters:
        service - An HttpService reference to add.
        Returns:
        A new HttpRequest instance.
      • withPath

        HttpRequest withPath​(java.lang.String path)
        This is a helper method that builds a modified request with the new path.
        Parameters:
        path - The path to use.
        Returns:
        A new HttpRequest instance with updated path.
      • withAddedParameters

        HttpRequest withAddedParameters​(java.util.List<HttpParameter> parameters)
        This is a helper method that builds a modified request with the added HTTP parameters.
        Parameters:
        parameters - HTTP parameters to add.
        Returns:
        A new HttpRequest instance.
      • withAddedParameters

        HttpRequest withAddedParameters​(HttpParameter... parameters)
        This is a helper method that builds a modified request with the added HTTP parameters.
        Parameters:
        parameters - HTTP parameters to add.
        Returns:
        A new HttpRequest instance.
      • withRemovedParameters

        HttpRequest withRemovedParameters​(java.util.List<HttpParameter> parameters)
        This is a helper method that builds a modified request with the removed HTTP parameters.
        Parameters:
        parameters - HTTP parameters to remove.
        Returns:
        A new HttpRequest instance.
      • withRemovedParameters

        HttpRequest withRemovedParameters​(HttpParameter... parameters)
        This is a helper method that builds a modified request with the removed HTTP parameters.
        Parameters:
        parameters - HTTP parameters to remove.
        Returns:
        A new HttpRequest instance.
      • withUpdatedParameters

        HttpRequest withUpdatedParameters​(java.util.List<HttpParameter> parameters)
        This is a helper method that builds a modified request with the updated HTTP parameters. If a parameter does not exist in the request, a new one will be added.
        Parameters:
        parameters - HTTP parameters to update.
        Returns:
        A new HttpRequest instance.
      • withUpdatedParameters

        HttpRequest withUpdatedParameters​(HttpParameter... parameters)
        This is a helper method that builds a modified request with the updated HTTP parameters. If a parameter does not exist in the request, a new one will be added.
        Parameters:
        parameters - HTTP parameters to update.
        Returns:
        A new HttpRequest instance.
      • withTransformationApplied

        HttpRequest withTransformationApplied​(HttpTransformation transformation)
        This is a helper method that builds a modified request with the transformation applied.
        Parameters:
        transformation - Transformation to apply.
        Returns:
        A new HttpRequest instance.
      • withBody

        HttpRequest withBody​(java.lang.String body)
        This is a helper method that builds a modified request with the updated body. Updates Content-Length header.
        Parameters:
        body - the new body for the request
        Returns:
        A new HttpRequest instance.
      • withBody

        HttpRequest withBody​(ByteArray body)
        This is a helper method that builds a modified request with the updated body. Updates Content-Length header.
        Parameters:
        body - the new body for the request
        Returns:
        A new HttpRequest instance.
      • addHeader

        HttpRequest addHeader​(java.lang.String name,
                              java.lang.String value)
        Adds an HTTP header to the current request.
        Parameters:
        name - The name of the header.
        value - The value of the header.
        Returns:
        The updated HTTP request with the added header.
      • addHeader

        HttpRequest addHeader​(HttpHeader header)
        Adds an HTTP header to the current request.
        Parameters:
        header - The HttpHeader to add to the HTTP request.
        Returns:
        The updated HTTP request with the added header.
      • updateHeader

        HttpRequest updateHeader​(java.lang.String name,
                                 java.lang.String value)
        Updates an existing HTTP header in the request with a new value.
        Parameters:
        name - The name of the header to update the value of.
        value - The new value of the specified HTTP header.
        Returns:
        The updated request containing the updated header.
      • updateHeader

        HttpRequest updateHeader​(HttpHeader header)
        Updates an existing HTTP header in the request with a new value.
        Parameters:
        header - The HttpHeader to update containing the new value.
        Returns:
        The updated request containing the updated header.
      • removeHeader

        HttpRequest removeHeader​(java.lang.String name)
        Removes an existing HTTP header from the current request.
        Parameters:
        name - The name of the HTTP header to remove from the request.
        Returns:
        The updated request containing the removed header.
      • removeHeader

        HttpRequest removeHeader​(HttpHeader header)
        Removes an existing HTTP header from the current request.
        Parameters:
        header - The HttpHeader to remove from the request.
        Returns:
        The updated request containing the removed header.