hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd W Lainhart <lainh...@us.ibm.com>
Subject Re: Recommended way of modifying message params?
Date Tue, 08 Jul 2014 14:58:11 GMT
I'm confused by your question - are you talking about URI parameters?

If you're talking about HttpClient request parameters (parameters which 
control the behavior of the request), those get/setParameter methods have 
been deprecated in favor of using RequestConfig on the HttpRequest, and 
various builder parameters on the HttpClient builder.

Todd Lainhart
Rational software
IBM Corporation
550 King Street, Littleton, MA 01460-1250
2-276-4705 (T/L)

From:   Ian Phillips <ianp@ianp.org>
To:     httpclient-users@hc.apache.org, 
Date:   07/08/2014 10:22 AM
Subject:        Recommended way of modifying message params?


What is the recommended ay of modifying message params in HC 4.3? The 
method AbstractHttpMessage.getParams() has the following deprecation note 
on it:

> Deprecated (4.3) use constructor parameters of configuration API 
provided by HttpClient

Which seems fine advice when constructing a new message, but in my case I 
want to modify a message that I already have:

    String link = object.getAsJsonPrimitive(“restApiLink").getAsString();
    URIBuilder builder = new URIBuilder(link).setHost("example.com");
    HttpGet request = new HttpGet(builder.build());
    request.getParams().setParameter("b", 1000);

I don’t know the URI in advance as it is being returned, params and all, 
from a remote API which I do not control. It seems like the recommendation 
is to manually parse out the returned URI and use the components to 
construct a new message via the builder API, that can’t be right can it?


#ifndef  __COMMON_SENSE__
#include <std_disclaimer>

To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message