By the way, this example code of setting cookies in HttpClient doesn't work
either:
http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientCustomContext.java
I copied the code there like this:
DefaultHttpClient client = new DefaultHttpClient();
CookieStore cookieStore = new BasicCookieStore();
cookieStore.addCookie(new BasicClientCookie("JSESSIONID",
getParameter("session")));
HttpContext context = new BasicHttpContext();
context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
client.execute(post, context);
Again, no cookies are specified on the http post. All I want to do is
attach the applet to the same session as the browser. Is there a better way
to do this? Are cookies functional in HttpClient beta 2?
On Fri, Feb 20, 2009 at 1:50 PM, Scott Mueller <[email protected]> wrote:
> I tried to add cookies like this, but no cookies are set as can be seen by
> the actual http post:
> DefaultHttpClient client = new DefaultHttpClient();
> client.getCookieStore().addCookie(new BasicClientCookie("JSESSIONID",
> getParameter("session")));
>
>
> POST /test/edit/image/upload_downloading_image HTTP/1.1
> Content-Length: 37135
> Content-Type: multipart/form-data;
> boundary=BBr9sC_KF9cYDun21feBJ8ZYwyBBkTWBT-Vfbo
> Host: 192.168.1.6:8080
> Connection: Keep-Alive
> User-Agent: Apache-HttpClient/4.0-beta2 (java 1.5)
> Expect: 100-Continue
>
> HTTP/1.1 100 Continue
>
> --BBr9sC_KF9cYDun21feBJ8ZYwyBBkTWBT-Vfbo
> Content-Disposition: form-data; name="id"
> Content-Type: text/plain; charset=windows-1252
> Content-Transfer-Encoding: 8bit
>
> 4
> --BBr9sC_KF9cYDun21feBJ8ZYwyBBkTWBT-Vfbo
> Content-Disposition: form-data; name="file"; filename="Scott_Ken.jpg"
> Content-Type: application/octet-stream
> Content-Transfer-Encoding: binary
>
>
> --
> Scott Mueller
> http://www.appletree.com
> AppleTree - Solve the Puzzle
>
--
Scott Mueller
http://www.appletree.com
AppleTree - Solve the Puzzle