/** Adds the header {@code "Accept-Encoding: gzip,deflate"} to the request. */
  public void process(final HttpRequest request, final HttpContext context)
      throws HttpException, IOException {

    /* Signal support for Accept-Encoding transfer encodings. */
    if (!request.containsHeader("Accept-Encoding")) {
      request.addHeader("Accept-Encoding", "gzip,deflate");
    }
  }
示例#2
0
 /**
  * Obtains parameters for executing a request. The default implementation in this class creates a
  * new {@link ClientParamsStack} from the request parameters and the client parameters. <br>
  * This method is called by the default implementation of {@link
  * #execute(HttpHost,HttpRequest,HttpContext)} to obtain the parameters for the {@link
  * DefaultRequestDirector}.
  *
  * @param req the request that will be executed
  * @return the parameters to use
  */
 protected HttpParams determineParams(final HttpRequest req) {
   return new ClientParamsStack(null, getParams(), req.getParams(), null);
 }