"Dola Woolfe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> This question will reveal how little I know about
> networking or http or something else.
>
> Basically I wrote an applet that sends data to a
> servlet. I do it by forming a url with a query string
> (GET). But this doesn't work when there's too much
> data.
>
> What are my options?
> Is it possible to use POST?
> Or, better yet, is it possible to send a java object
> by creating a socket connection with the servlet?
>

Actually, combining these two is often easiest (of course, your java Object 
must implement Serializable for this to work).  Something like (Applet 
code):

     URL servlet = new URL(getDocumentBase(), "/path/to/my/servlet");
     HttpURLConnection conn = (HttpURLConnection)servlet.openConnection();
     conn.setDoInput(true);
     conn.setDoOutput(true);
     conn.setRequestMethod("POST");
     conn.setHeaderField("Content-Type", "application/x-java");
     ObjectOutputStream out = new 
ObjectOutputStream(conn.getOutputStream());
     out.writeObject(myObject);
     int status = conn.getResponseCode();
     if(isOK(status)) {
         InputStream in = conn.getInputStream();
        // Handle response here.
     }


> Very many thanks in advance!
>
> Dola
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com 




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

Reply via email to