Class HttpRequest.Builder

  • Enclosing class:
    HttpRequest

    public static class HttpRequest.Builder
    extends java.lang.Object
    Builder of HTTP requests
    • Method Detail

      • put

        public HttpRequest.Builder put​(java.lang.String key,
                                       java.lang.String value)
        Add a parameter to the request. Multi-value parameters are not supported.
        Parameters:
        key - parameter name
        value - parameter value
        Returns:
        this Builder instance
      • removeProperty

        public HttpRequest.Builder removeProperty​(java.lang.String parameterName)
        Removes the parameter from the request properties. If there is no such parameter, nothing will be done.
      • method

        public HttpRequest.Builder method​(com.yahoo.jdisc.http.HttpRequest.Method method)
        Set the HTTP method for the new request.
        Parameters:
        method - the HTTP method to use for the new request
        Returns:
        this Builder instance
      • jdiscRequest

        public HttpRequest.Builder jdiscRequest​(com.yahoo.jdisc.http.HttpRequest request)
        Define the JDisc parent request.
        Parameters:
        request - a valid JDisc request for the current container
        Returns:
        this Builder instance
      • requestData

        public HttpRequest.Builder requestData​(java.io.InputStream requestData)
        Set an inputstream to use for the request. If not set, the data from the original HttpRequest is used.
        Parameters:
        requestData - data to be consumed, e.g. POST data
        Returns:
        this Builder instance
      • uri

        public HttpRequest.Builder uri​(java.net.URI uri)
        Set the URI of the server request created.
        Parameters:
        uri - a valid URI for a server request
        Returns:
        this Builder instance
      • createDirectRequest

        public HttpRequest createDirectRequest()
        Create a new HTTP request without creating a new JDisc request. This is for scenarios where another HTTP request handler is invoked directly without dispatching through JDisc. The parent JDisc request for the original HttpRequest will be passed on the new HttpRequest instance's JDisc request, but no properties will be propagated into the original JDisc request.
        Returns:
        a new HttpRequest instance reflecting the given request data and parameters
      • createClientRequest

        public HttpRequest createClientRequest()
        Start of API for synchronous HTTP request dispatch. Not yet ready for use.
        Returns:
        a new client request
      • createServerRequest

        public HttpRequest createServerRequest()
        Start of API for synchronous HTTP request dispatch. Not yet ready for use.
        Returns:
        a new server request