You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Uwe Seimet <Uw...@seimet.de> on 2005/10/23 18:28:11 UTC
[HttpClient] Callback when accepting a cookie?
Hi there!
Is there any way for an application using the HttpClient package to be
called back whenever a new cookie is accepted? I did not find anything
in the API, but maybe I just missed it.
If not I would consider it a useful extension for upcoming releases.
Best regards, Uwe
--
-----------------------------------------------------------------------
Dr. Uwe Seimet http://www.seimet.de
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [HttpClient] Callback when accepting a cookie?
Posted by Uwe Seimet <Uw...@seimet.de>.
Hello Oleg,
> If your application exclusively uses BROWSER_COMPATIBILITY policy, you
> can simply extend the CookieSpecBase class, override the validate method
> and register your custom cookie spec with the CookiePolicy class as the
> default one. In case you want to support any arbitrary cookie policy
Works great, just what I needed! Thank you!
--
-----------------------------------------------------------------------
Dr. Uwe Seimet http://www.seimet.de
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [HttpClient] Callback when accepting a cookie?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2005-10-24 at 19:49 +0200, Uwe Seimet wrote:
> Hello Oleg,
>
> > The recommend way to customize the cookie management with HttpClient is
> > to provide a custom cookie policy or extend an existing one [1].
> >
> > However, if the existing plug-in mechanism does not fully cover your
> > requirements, feel free to file an enhancement request in Bugzilla. We
> > can consider such an extension for inclusion into the 3.1 release
>
> The current functionality is probably sufficient for my purpose, but I
> am not sure how to best implement what I need. My guess is that in order
> for my application to be called back when a cookie is accepted I would have
> to extend the BROWSER_COMPATIBILITY cookie policy, because this is the one
> I am currently using in my application.
> What I do not see, though, is the relationship between the cookie policy
> string, which is set with setCookiePolicy(), and the class implementing
> the CookieSpec interface. Overriding the validate() call of this class is
> what I think I need, but which of the CookieSpec implementation would I
> inherit from?
> Can you give me some advice? Thank you.
>
> Best regards, Uwe
>
Uwe,
If your application exclusively uses BROWSER_COMPATIBILITY policy, you
can simply extend the CookieSpecBase class, override the validate method
and register your custom cookie spec with the CookiePolicy class as the
default one. In case you want to support any arbitrary cookie policy
consider extending the HttpState class and overriding
HttpState#addCookie instead.
Hope this helps.
Oleg
> --
> -----------------------------------------------------------------------
> Dr. Uwe Seimet http://www.seimet.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [HttpClient] Callback when accepting a cookie?
Posted by Uwe Seimet <Uw...@seimet.de>.
Hello Oleg,
> The recommend way to customize the cookie management with HttpClient is
> to provide a custom cookie policy or extend an existing one [1].
>
> However, if the existing plug-in mechanism does not fully cover your
> requirements, feel free to file an enhancement request in Bugzilla. We
> can consider such an extension for inclusion into the 3.1 release
The current functionality is probably sufficient for my purpose, but I
am not sure how to best implement what I need. My guess is that in order
for my application to be called back when a cookie is accepted I would have
to extend the BROWSER_COMPATIBILITY cookie policy, because this is the one
I am currently using in my application.
What I do not see, though, is the relationship between the cookie policy
string, which is set with setCookiePolicy(), and the class implementing
the CookieSpec interface. Overriding the validate() call of this class is
what I think I need, but which of the CookieSpec implementation would I
inherit from?
Can you give me some advice? Thank you.
Best regards, Uwe
--
-----------------------------------------------------------------------
Dr. Uwe Seimet http://www.seimet.de
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [HttpClient] Callback when accepting a cookie?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2005-10-23 at 18:28 +0200, Uwe Seimet wrote:
> Hi there!
>
> Is there any way for an application using the HttpClient package to be
> called back whenever a new cookie is accepted? I did not find anything
> in the API, but maybe I just missed it.
> If not I would consider it a useful extension for upcoming releases.
>
> Best regards, Uwe
>
Uwe,
The recommend way to customize the cookie management with HttpClient is
to provide a custom cookie policy or extend an existing one [1].
However, if the existing plug-in mechanism does not fully cover your
requirements, feel free to file an enhancement request in Bugzilla. We
can consider such an extension for inclusion into the 3.1 release
Oleg
[1] http://jakarta.apache.org/commons/httpclient/cookies.html
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org