hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: BasicHttpContext and CookieStore
Date Wed, 13 Aug 2008 17:37:53 GMT
On Wed, 2008-08-13 at 07:35 -0700, Mike Ahlers wrote:
> Hi,
> 
> I am using httpcore-4.-beta2 and httpclient-4.0-alpha4.
> 

There have been lots of changes since alpha4. Please upgrade to the
latest SVN snapshot and re-test

http://people.apache.org/repo/m2-snapshot-repository/org/apache/httpcomponents/httpclient/4.0-alpha5-SNAPSHOT/


Oleg

> When I issue a request with a BasicHttpContext, I see log messages
> indicating:
> 
> 13-aug-2008 16:24:47 org.apache.http.client.protocol.RequestAddCookies
> process
> INFO: Cookie store not available in HTTP context
> 
> Apart that I think these should be warnings, I tried to circumvent these by
> adding a Cookie store:
> 
> context.setAttribute(ClientContext.COOKIE_STORE, new BasicCookieStore());
> 
> Only to find the next message:
> 
> 13-aug-2008 16:26:12 org.apache.http.client.protocol.RequestAddCookies
> process
> INFO: CookieSpec registry not available in HTTP context
> 
> When I proceed, as in, adding a CookieSpecRegistry:
> 
> context.setAttribute(ClientContext.COOKIESPEC_REGISTRY, new
> CookieSpecRegistry());
> 
> It breaks...
> 
> java.lang.IllegalStateException: Unsupported cookie spec: best-match
> 	at
> org.apache.http.cookie.CookieSpecRegistry.getCookieSpec(CookieSpecRegistry.java:115)
> 	at
> org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:147)
> 	at
> org.apache.http.protocol.BasicHttpProcessor.process(BasicHttpProcessor.java:290)
> 	at
> org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:160)
> 	at
> org.apache.http.impl.client.DefaultClientRequestDirector.execute(DefaultClientRequestDirector.java:356)
> 	at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:501)
> 	at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:456)
> 	at
> com.thespeechcorporation.service.RequestCallable.call(RequestCallable.java:33)
> 	at
> com.thespeechcorporation.service.RequestCallable.call(RequestCallable.java:1)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
> 	at java.util.concurrent.FutureTask.run(Unknown Source)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> 	at java.lang.Thread.run(Unknown Source)
> 
> Basically, I want to do a request without to bother with Cookie's for my
> application isn't dealing with these. I was hoping/expecting that the
> BasicHttpContext would take care of defaults...
> 
> Unless, I am doing something terribly wrong and/or make wrong assumptions.
> 
> How to proceed? Sure, I can raise/lower debug level so I wont see the log
> messages but that would be the under_the_carpet trick?
> 
> Regards,
> Mike


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


Mime
View raw message