Class RequestUrlParamsEncoder<RequestT>

java.lang.Object
com.google.api.gax.rpc.RequestUrlParamsEncoder<RequestT>
Type Parameters:
RequestT - request message type
All Implemented Interfaces:
RequestParamsEncoder<RequestT>

@InternalApi("For use by transport-specific implementations") public class RequestUrlParamsEncoder<RequestT> extends Object implements RequestParamsEncoder<RequestT>
The request params encoder, which encodes URL-encoded parameters in one URL parameters string.
  • Constructor Details

    • RequestUrlParamsEncoder

      public RequestUrlParamsEncoder(RequestParamsExtractor<RequestT> paramsExtractor)
      Creates the encoder.
      Parameters:
      paramsExtractor - parameters extractor which returns already URL-encoded key-value pairs
  • Method Details

    • encode

      public String encode(RequestT request)
      Encodes the request in a form of a URL parameters string, for example "param1=value+1&param2=value2%26". This method may optionally validate that the name-value paris are URL-encoded. It will URL encode the key and values if there are any non-allowed characters. It will then concatenate the valid individual name-value pairs in a valid URL parameters string.

      Note: This will url-encode the key and values during concatenation. Double url-encoding may occur if the input has values that are already url-encoded.

      Specified by:
      encode in interface RequestParamsEncoder<RequestT>
      Parameters:
      request - request message
      Throws:
      IllegalArgumentException - if is not