That is exactly what is happening... the request that is passed to the NHttpRequestHandler.handle() method has the HTTP params set with the characters set = UTF-8. Good catch and makes sense as I basically pass this request on to the client to execute.
I need to look into the async client and see how it would fit into my design. I started with sync for both client & server, and quickly out-grew the server side of things. I keep my NHttpRequestHandler.handle() method async by wrapping the request in a continuation and placing it on a ExecutorCompletionService. Bill- On Wed, Aug 24, 2011 at 10:39 AM, Oleg Kalnichevski <[email protected]> wrote: > On Wed, 2011-08-24 at 10:28 -0400, Bill Speirs wrote: >> I'm working on a proxy server using the 4.2-alpha1 httpcore and 4.1.2 >> httpclient. In the server portion of my code I setup >> SyncBasicHttpParams as follows: >> >> >> HttpParams params = new SyncBasicHttpParams(); >> >> params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0) >> .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, >> 8 * 1024) >> >> .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, >> false) >> .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true) >> .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "FactSet >> Lima Proxy") >> .setParameter(CoreProtocolPNames.PROTOCOL_VERSION, >> HttpVersion.HTTP_1_1.toString()) >> .setParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET, >> HTTP.UTF_8); >> >> I then use them to create an AsyncNHttpServiceHandler and >> DefaultServerIOEventDispatch. >> >> In another portion of code I create a new SyncBasicHttpParams object >> and use it to configure my client: >> final HttpParams params = new SyncBasicHttpParams(); >> >> params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, >> handleRedirects); >> >> params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, false); >> params.setParameter(ClientPNames.COOKIE_POLICY, >> CookiePolicy.IGNORE_COOKIES); >> >> HttpConnectionParams.setSoTimeout(params, maxTimeout); >> HttpConnectionParams.setConnectionTimeout(params, maxTimeout); >> >> this.client = new DefaultHttpClient(this.connManager, params); >> >> However, for some reason the HTTP_ELEMENT_CHARSET parameter is >> "bleeding" over from my server into my client, forcing my client >> requests to be in UTF-8 as well. >> >> Why is this happening? Are the settings for SyncBasicHttpParams global >> somehow? >> > > No should be no global settings anywhere in HttpCore or HttpClient. > Please note, though, that parameters set on the HTTP request level will > always take precedence over parameters set on the HTTP client level. I > suspect that parameters of individual messages received by the async > listener inherit its settings. > > By the way, since you are using a non-blocking listener for incoming > connections, would not HttpAsyncClient be a better match for handling > outgoing connections than HttpClient? > > Cheers > > 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]
