Interface HttpRequestMetaData

    • Method Detail

      • requestTarget

        java.lang.String requestTarget()
        The request-target.

        No decoding has been done on the request-target.

        Returns:
        The request-target.

        No decoding has been done on the request-target.

      • requestTarget

        HttpRequestMetaData requestTarget​(java.lang.String requestTarget,
                                          java.nio.charset.Charset encoding)
        Set the request-target.

        This may result in clearing of internal caches used by methods that are derived from the request-target, such as path(), rawQuery(), etc.

        Parameters:
        requestTarget - the request-target to set.
        encoding - the Charset to use to encode requestTarget before setting the value.
        Returns:
        this.
      • rawPath

        java.lang.String rawPath()
        The path component derived from requestTarget().

        No decoding has been done on the query component: the value is provided as specified in the request target.

        Returns:
        The path component derived from requestTarget().

        No decoding has been done on the query component: the value is provided as specified in the request target.

      • rawPath

        HttpRequestMetaData rawPath​(java.lang.String path)
        Sets the path to path, without any encoding performed. This assumes that any characters that require encoding have been encoded according to percent-encoding by the caller.

        Because this modifies the request target, this may result in the clearing of internal caches. See requestTarget(String).

        Parameters:
        path - the encoded path to set.
        Returns:
        this.
      • path

        HttpRequestMetaData path​(java.lang.String path)
        Sets the path, performing encoding according to percent-encoding, except for forward-slash ('/') characters. This allows for path("/abc") without it turning into '%2Fabc'.
        Parameters:
        path - the un-encoded path to set.
        Returns:
        this.
      • appendPathSegments

        HttpRequestMetaData appendPathSegments​(java.lang.String... segments)
        Appends segments to the current path(), performing encoding of each segment (including ('/') characters) according to percent-encoding. A / is used to separate each segment and between the current path() and the following segments.
        Parameters:
        segments - the un-encoded path to set.
        Returns:
        this.
      • rawQuery

        @Nullable
        java.lang.String rawQuery()
        The query component derived from requestTarget().

        No decoding has been done on the query component: the value is provided as specified in the request target.

        Returns:
        The query component derived from requestTarget().

        No decoding has been done on the query component: the value is provided as specified in the request target.

      • rawQuery

        HttpRequestMetaData rawQuery​(@Nullable
                                     java.lang.String query)
        Sets the query component to query, without any encoding performed. This assumes that any characters that require encoding have been encoded according to percent-encoding by the caller.

        Because this modifies the request target, this may result in the clearing of internal caches. See requestTarget(String).

        Parameters:
        query - the encoded query to set. null will clear the query value (e.g. no ? present in requestTarget().
        Returns:
        this.
      • query

        HttpRequestMetaData query​(@Nullable
                                  java.lang.String query)
        Sets the path, performing encoding according to rfc3986, Query.
        Parameters:
        query - the un-encoded query to set. null will clear the query value (e.g. no ? present in requestTarget().
        Returns:
        this.
      • queryParameter

        @Nullable
        java.lang.String queryParameter​(java.lang.String key)
        Returns the value of a query parameter with the specified key. If there is more than one value for the specified key, the first value in insertion order is returned.
        Parameters:
        key - the key of the query parameter to retrieve.
        Returns:
        the first query parameter value if the key is found. null if there's no such key.
      • queryParameters

        java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.lang.String>> queryParameters()
        Returns all query parameters as key/value pairs.
        Returns:
        an Iterable of query parameter key/value pairs or an empty Iterable if none present.
      • queryParameters

        java.lang.Iterable<java.lang.String> queryParameters​(java.lang.String key)
        Returns all values for the query parameter with the specified key.
        Parameters:
        key - the key of the query parameter to retrieve.
        Returns:
        an Iterable of query parameter values or an empty Iterable if no values are found.
      • queryParametersIterator

        java.util.Iterator<java.lang.String> queryParametersIterator​(java.lang.String key)
        Returns all values for the query parameter with the specified key.
        Parameters:
        key - the key of the query parameter to retrieve.
        Returns:
        an Iterator of query parameter values or an empty Iterator if no values are found.
      • queryParametersKeys

        java.util.Set<java.lang.String> queryParametersKeys()
        Returns a Set of all query parameter keys. The returned Set cannot be modified.
        Returns:
        a Set of all query parameter keys. The returned Set cannot be modified.
      • hasQueryParameter

        default boolean hasQueryParameter​(java.lang.String key)
        Returns true if a query parameter with the key exists, false otherwise.
        Parameters:
        key - the query parameter name.
        Returns:
        true if key exists.
      • hasQueryParameter

        boolean hasQueryParameter​(java.lang.String key,
                                  java.lang.String value)
        Returns true if a query parameter with the key and value exists, false otherwise.
        Parameters:
        key - the query parameter key.
        value - the query parameter value of the query parameter to find.
        Returns:
        true if a key, value pair exists.
      • queryParametersSize

        int queryParametersSize()
        Returns the number of query parameters.
        Returns:
        the number of query parameters.
      • addQueryParameter

        HttpRequestMetaData addQueryParameter​(java.lang.String key,
                                              java.lang.String value)
        Adds a new query parameter with the specified key and value, which will be percent-encoded if needed.
        Parameters:
        key - the query parameter key.
        value - the query parameter value.
        Returns:
        this.
      • addQueryParameters

        HttpRequestMetaData addQueryParameters​(java.lang.String key,
                                               java.lang.Iterable<java.lang.String> values)
        Adds new query parameters with the specified key and values. This method is semantically equivalent to:
         for (T value : values) {
             addQueryParameter(key, value);
         }
         
        Parameters:
        key - the query parameter key.
        values - the query parameter values.
        Returns:
        this.
      • addQueryParameters

        HttpRequestMetaData addQueryParameters​(java.lang.String key,
                                               java.lang.String... values)
        Adds new query parameters with the specified key and values. This method is semantically equivalent to:
         for (T value : values) {
             query.addQueryParameter(key, value);
         }
         
        Parameters:
        key - the query parameter key.
        values - the query parameter values.
        Returns:
        this.
      • setQueryParameter

        HttpRequestMetaData setQueryParameter​(java.lang.String key,
                                              java.lang.String value)
        Sets a query parameter with the specified key and value, which will be percent-encoded if needed. Any existing query parameters with the same key are overwritten.
        Parameters:
        key - the query parameter key.
        value - the query parameter value.
        Returns:
        this.
      • setQueryParameters

        HttpRequestMetaData setQueryParameters​(java.lang.String key,
                                               java.lang.Iterable<java.lang.String> values)
        Sets new query parameters with the specified key and values. This method is equivalent to:
         removeQueryParameter(key);
         for (T value : values) {
             query.addQueryParameter(key, value);
         }
         
        Parameters:
        key - the query parameter key.
        values - the query parameter values.
        Returns:
        this.
      • setQueryParameters

        HttpRequestMetaData setQueryParameters​(java.lang.String key,
                                               java.lang.String... values)
        Sets new query parameters with the specified key and values. This method is equivalent to:
         removeQueryParameter(key);
         for (T value : values) {
             query.addQueryParameter(key, value);
         }
         
        Parameters:
        key - the query parameter key.
        values - the query parameter values.
        Returns:
        this.
      • removeQueryParameters

        boolean removeQueryParameters​(java.lang.String key)
        Removes all query parameters with the specified key.
        Parameters:
        key - the query parameter key.
        Returns:
        true if at least one entry has been removed.
      • removeQueryParameters

        boolean removeQueryParameters​(java.lang.String key,
                                      java.lang.String value)
        Removes all query parameters with the specified key and value.
        Parameters:
        key - the query parameter key.
        value - the query parameter value.
        Returns:
        true if at least one entry has been removed.
      • addHeader

        default HttpRequestMetaData addHeader​(java.lang.CharSequence name,
                                              java.lang.CharSequence value)
        Description copied from interface: HttpMetaData
        Adds a new header with the specified name and value.
        Specified by:
        addHeader in interface HttpMetaData
        Parameters:
        name - the name of the header.
        value - the value of the header.
        Returns:
        this.
      • setHeader

        default HttpRequestMetaData setHeader​(java.lang.CharSequence name,
                                              java.lang.CharSequence value)
        Description copied from interface: HttpMetaData
        Sets a header with the specified name and value. Any existing headers with the same name are overwritten.
        Specified by:
        setHeader in interface HttpMetaData
        Parameters:
        name - the name of the header.
        value - the value of the header.
        Returns:
        this.
      • setHeaders

        default HttpRequestMetaData setHeaders​(HttpHeaders headers)
        Description copied from interface: HttpMetaData
        Clears the current header entries and copies all header entries of the specified headers object.
        Specified by:
        setHeaders in interface HttpMetaData
        Parameters:
        headers - the headers object which contains new values.
        Returns:
        this.
      • addCookie

        default HttpRequestMetaData addCookie​(java.lang.CharSequence name,
                                              java.lang.CharSequence value)
        Description copied from interface: HttpMetaData
        Adds a cookie with the specified name and value.

        This may result in multiple HttpSetCookies with same name. Added cookie will not be wrapped, not secure, and not HTTP-only, with no path, domain, expire date and maximum age.

        Specified by:
        addCookie in interface HttpMetaData
        Parameters:
        name - the name of the cookie.
        value - the value of the cookie.
        Returns:
        this.
      • addSetCookie

        default HttpRequestMetaData addSetCookie​(java.lang.CharSequence name,
                                                 java.lang.CharSequence value)
        Description copied from interface: HttpMetaData
        Adds a set-cookie with the specified name and value.

        This may result in multiple HttpSetCookies with same name. Added cookie will not be wrapped, not secure, and not HTTP-only, with no path, domain, expire date and maximum age.

        Specified by:
        addSetCookie in interface HttpMetaData
        Parameters:
        name - the name of the cookie.
        value - the value of the cookie.
        Returns:
        this.