Package feign

Class Request


  • public final class Request
    extends java.lang.Object
    An immutable request to an http server.
    • Method Detail

      • create

        public static Request create​(java.lang.String method,
                                     java.lang.String url,
                                     java.util.Map<java.lang.String,​java.util.Collection<java.lang.String>> headers,
                                     byte[] body,
                                     java.nio.charset.Charset charset)
        No parameters can be null except body and charset. All parameters must be effectively immutable, via safe copies, not mutating or otherwise.
      • create

        public static Request create​(Request.HttpMethod httpMethod,
                                     java.lang.String url,
                                     java.util.Map<java.lang.String,​java.util.Collection<java.lang.String>> headers,
                                     byte[] body,
                                     java.nio.charset.Charset charset)
        Builds a Request. All parameters must be effectively immutable, via safe copies.
        Parameters:
        httpMethod - for the request.
        url - for the request.
        headers - to include.
        body - of the request, can be null
        charset - of the request, can be null
        Returns:
        a Request
      • create

        public static Request create​(Request.HttpMethod httpMethod,
                                     java.lang.String url,
                                     java.util.Map<java.lang.String,​java.util.Collection<java.lang.String>> headers,
                                     Request.Body body)
        Builds a Request. All parameters must be effectively immutable, via safe copies.
        Parameters:
        httpMethod - for the request.
        url - for the request.
        headers - to include.
        body - of the request, can be null
        Returns:
        a Request
      • method

        public java.lang.String method()
        Deprecated.
        Http Method for this request.
        Returns:
        the HttpMethod string
      • httpMethod

        public Request.HttpMethod httpMethod()
        Http Method for the request.
        Returns:
        the HttpMethod.
      • url

        public java.lang.String url()
      • headers

        public java.util.Map<java.lang.String,​java.util.Collection<java.lang.String>> headers()
      • charset

        public java.nio.charset.Charset charset()
        Deprecated.
        use requestBody() instead
        The character set with which the body is encoded, or null if unknown or not applicable. When this is present, you can use new String(req.body(), req.charset()) to access the body as a String.
      • body

        public byte[] body()
        Deprecated.
        use requestBody() instead
        If present, this is the replayable body to send to the server. In some cases, this may be interpretable as text.
        See Also:
        charset()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object