Oh, I am very sorry, there is a bug in my code I've sent to this topic:

<code>
...
// Content parameters
// do NOT forget the last "\n"
// it means the end of the request's header!!!
output.println("Content-Encoding: 8859_1\n"
                 +"Content-Type: application/x-www-form-urlencoded\n"
                 +"Content-Length: " + data.length() + "\n");
// and now the data
output.println(java.net.URLEncoder.encode("parameter1="+value1)
                 +"&"+java.net.URLEncoder.encode("parameter2="+value2)
                 // ... more parameters ...
                );
...
</code>

   It will cause problems - you must know the data length befor you send
them to the server and to set their length in "Content-Length:...". So
the proper code should be:

<code>
...
// Prepare data
String data = java.net.URLEncoder.encode("parameter1="+value1)
               +"&"+java.net.URLEncoder.encode("parameter2="+value2)
               // + other URL encoded parameters
               ;
// Content parameters
// do NOT forget the last "\n"
// it means the end of the request's header!!!
output.println("Content-Encoding: 8859_1\n"
+"Content-Type: application/x-www-form-urlencoded\n"
+"Content-Length: " + data.length() + "\n");
// and now the data
output.println(data);
...
</code>

   Regards,

J.Ch.
--
Ing. Jozef Chocholacek                  Qbizm Technologies, Inc.
Chief Project Analyst                   ... the art of internet.
________________________________________________________________
Kralovopolska 139                          tel: +420 5 4124 2414
601 12 Brno, CZ      http://www.qbizm.com  fax: +420 5 4121 2696

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to