Hi,

I tested object serialization, and apparently it works fine for me (with JDK
1.3). What could happen is that older versions of the JDK may not support
chunking correctly. In the future, that will be addressed  by looking at the
user-agent and falling back to HTTP/1.0 mode if a broken user agent is
detected.

Here's what I used for testing :

The compilied servlet should be put in webapps/examples/WEB-INF/classes.

Servlet:

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestServlet extends HttpServlet {

    protected void service(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

        OutputStream os = resp.getOutputStream();

        Vector foo = new Vector();
        foo.addElement("test");

        ObjectOutputStream oos = new ObjectOutputStream(os);
        oos.writeObject(foo);
        oos.flush();

        os.write("test2".getBytes());
        oos.close();

    }

}

Client:

import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;

public class TestClient {

    public static void main(String args[])
        throws Exception {

        URL url = new
URL("http://127.0.0.1:8080/examples/servlet/TestServlet");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.connect();

        InputStream is = conn.getInputStream();
        ObjectInputStream ois = new ObjectInputStream(is);
        Object result = ois.readObject();
        System.out.println("Result: " + result);

        byte[] buffer = new byte[256];
        int read = is.read(buffer);
        String readStr = new String(buffer, 0, read);
        System.out.println("Extra bytes: " + readStr);

        ois.close();

        conn.disconnect();

    }

}

Result when running the client:

Result: [test]
Extra bytes: test2

Remy


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

Reply via email to