Posted By:
Yuriy_Zubarev
Posted On:
Saturday, September 8, 2001 07:41 PM
I'm trying to sumbit a form and simultaneously transfer a cookie (that I got from previous response) and so far no luck. Probably someone already solved this problem and it would be great to hear a solution. Here is a snippet of code: ... String cookie = urlConn.getHeaderField("Set-Cookie"); ... url = new URL("http://server/EmailSave.do"); urlConn = (HttpURLConnection) url.openConnection(); urlConn.setDoInput(true); urlConn.setDoOutput(true); urlConn.setUseCaches(false); content = "action=Create" + "&to=email@email.com"; Integer length = new Integer(content.length() + cookie.length()); urlConn.setReq
More>>
I'm trying to sumbit a form and simultaneously transfer a cookie (that I got from previous response) and so far no luck. Probably someone already solved this problem and it would be great to hear a solution. Here is a snippet of code:
...
String cookie = urlConn.getHeaderField("Set-Cookie");
...
url = new URL("http://server/EmailSave.do");
urlConn = (HttpURLConnection) url.openConnection();
urlConn.setDoInput(true);
urlConn.setDoOutput(true);
urlConn.setUseCaches(false);
content = "action=Create" +
"&to=email@email.com";
Integer length = new Integer(content.length() + cookie.length());
urlConn.setRequestProperty("CONTENT_LENGTH", length.toString());
urlConn.setRequestProperty("Cookie", cookie);
printout = new DataOutputStream(urlConn.getOutputStream());
printout.writeBytes(content);
printout.flush();
printout.close();
Best of luck,
Yuriy Zubarev
<<Less