Hi,

Is it possible send/receive serialized object using HttpClient? I always
get java.io.StreamCorruptedException: invalid stream header  Exception.

Here is my server side (servlet code)

    public void doPost (
        HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException
    {
        response.setContentType("application/x-www-form-urlencoded");
        ObjectOutputStream oos = new
ObjectOutputStream(response.getOutputStream());
        ArrayList l = new ArrayList();
        l.add("Index Server is running");
        oos.writeObject(l);
    }

Client side code that access this servlet

    public OutputStream sendRequest (String method, HashMap args)
        throws IOException, IndexServerCommunicationException
    {
        PostMethod post = new PostMethod(m_url);
        try
        {
                post.setRequestEntity(new
StringRequestEntity("something"));
            m_client.executeMethod(post);
            ObjectInputStream ois = new
ObjectInputStream(post.getResponseBodyAsStream());
                return ois;
        }
        finally
        {
            post.releaseConnection();
        }
    }

Any help is appreciated.

Thanks
-Valli


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

Reply via email to