On 13 December 2010 15:08, Oleg Kalnichevski <[email protected]> wrote: > On Mon, 2010-12-13 at 11:20 +0000, sebb wrote: >> For HC 3.1, JMeter supports a configuration file which can be used to >> set up global defaults. >> >> There is no concept of global defaults in HC 4.x, but one can >> initialise HttpClient with a DefaultedHttpParams to get similar >> functionality. >> >> The method DefaultHttpClient.createHttpParams() creates a default set >> of parameters (HttpVersion etc.), however it is not static (so it >> means creating a temporary HttpClient) and it forces one to use >> SyncBasicHttpParams. >> >> This makes it harder than it could be to create the initial parameter set. >> >> I think it would be useful to expose the defaults as a static method, >> with parameter HttpParams, and call that from createHttpParams(). >> >> Any objections to adding that? > > I guess not.
OK, I propose to create: public static void setDefaultHttpParams(HttpParams) >> Or is there a better way of achieving the same goal? >> Perhaps the defaults belong in AbstractHttpClient? >> > > Overriding AbstractHttpClient#determineParams() method and returning a > stack consisting of request, client and global parameters would probably > be the least intrusive. Unfortunately that's not entirely suitable for JMeter, which needs to be able to override the httpclient defaults. And the approach would still use SyncBasicHttpParams for the defaults. It's not easy to copy the parameters from SyncBasicHttpParams into BasicHttpParams, as there is no iterator, and the copy(params) method is protected. Further, all the work re-arranging the parameter stack would have to be done for each request, instead of once per httpclient creation. == I think there should be a public method which gives access to a read-only copy of the parameters. This could either be done by: * changing BasicHttpParams#copyParams(HttpParams target) to be public, in which case we probably need to add a synch. version to the subclass. * or, provide public access to a read-only iterator (again, might need to have synch. version for the subclass). Note: I have got a work-round for JMeter, but it is a bit messy. It seems to me that other application code may have similar use cases - it would certainly be useful to be able to enumerate HttpParams for debugging purposes. > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
