----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi to everyone,

Our client app tries to send a serialized object to a servlet.

The code looks like this

        // prepareConnection
        URL url = new   
URL("http://myserver/servlet/AddressServlet/insert?addrType=15&parentFolder=17");
        URLConnection urlConnection = url.openConnection();
        urlConnection.setDoOutput(true);
        urlConnection.setDoInput(true);
        urlConnection.setUseCaches(false);
        urlConnection.connect();

        // sending Object
        OutputStream urlOutStream = urlConnection.getOutputStream();
        ObjectOutputStream objOut = new ObjectOutputStream(urlOutStream);
        AdressObject newAddress= getNewAddressObject();
        objOut.writeObject(newAddress); // send request

        // cleanup
        objOut.close();

The client app connect to the servlet but at the servlet side the
parameters from the URL are missing. Only the url
"myserver/servlet/AddressServlet/insert" is transmitted but a
request.getParameter("parentFolder") or getQueryString() returns null.

If we omit sending the serialized object and do the following

        // prepareConnection
        URL url = new           
URL("http://myserver/servlet/AddressServlet/insert?addrType=15&parentFolder=17");
        URLConnection urlConnection = url.openConnection();
        urlConnection.setDoOutput(true);
        urlConnection.setDoInput(true);
        urlConnection.setUseCaches(false);
        urlConnection.connect();
        Object obj=urlConnection.getContent()

        // cleanup
        objOut.close();

everything works fine.

Is it possible to transmit a serliazed object via an URLConnection and
transmit also the UrlQueryString (e.g. the parameters
addrType=15&parentFolder=17) ???

Any help is appreciated. 
Thanks in advance, Martin Pfeifer


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to