Dmitry Beransky wrote:
> Hi,
> 
> Is there the best of a preferred way to parse a session id from a cookie
> header?
> I could just run this trough a regexp, but I've been wondering if there is
> something in the httpclient api that will do that for me already with a
> simple call like Header.getCookieValue("JSESSIONID").

Not quite, because HttpClient doesn't need to access cookie values.
The way to go is:

[1] - take all cookies you've collected
[2] - select the one you're interested in
[3] - get it's value

hope that helps,
  Roland

[1]
http://jakarta.apache.org/httpcomponents/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpState.html#getCookies()
[2]
http://jakarta.apache.org/httpcomponents/httpclient-3.x/apidocs/org/apache/commons/httpclient/cookie/CookieSpec.html#match(java.lang.String,%20int,%20java.lang.String,%20boolean,%20org.apache.commons.httpclient.Cookie[])
[3]
http://jakarta.apache.org/httpcomponents/httpclient-3.x/apidocs/org/apache/commons/httpclient/NameValuePair.html#getValue()

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to