>>>>> Steinar Bang <[EMAIL PROTECTED]>:

> Platform: SuSE linux 6.2 (w/kernel version 2.2.14), Blackdown JDK 1.1.7v3

> I've been trying to write a small test program that writes a
> multipart/form-data body to an apache Tomcat servlet, using HTTP
> POST.

> What happens is that the servlet sees the headers, but not the body of 
> the message I'm trying to write.  

Seems like the line at the end of the quoted text below, is the
culprit.  If I remove it, then the body of the POSTed message is no
longer empty.

>           String boundary = "12345xyzzy";
>           URL repository = new URL("http://" + server_ + servlet_);
>           HttpURLConnection tc =
>               (HttpURLConnection)repository.openConnection();
>           tc.setDoOutput(true);
>           tc.setDoInput(true);
>           tc.setAllowUserInteraction(false);
>           tc.setRequestMethod("POST");
>           tc.setRequestProperty ("Content-Type",
>                                  "multipart/form-data; "
>                                  + "boundary=" + boundary);
>           PrintWriter out = new PrintWriter(tc.getOutputStream());
>           //PrintWriter out = new PrintWriter(System.out);
>           retval = new BufferedReader(new InputStreamReader(tc.getInputStream()));

However, if I can't do this, how can I read back the result of a POST
command...?  Hm...


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to