When using URLConnection to upload an object from applet to servlet, the servlet's doGet method is never executed. Why?

URL url=new URL("http://localhost:8080/servlet/ServerServlet?Action=3");
URLConnection servletConnection=url.openConnection();
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
servletConnection.setUseCaches (false);
servletConnection.setDefaultUseCaches (false);
servletConnection.setRequestProperty ("Content-Type", "application/octet-stream");
ObjectOutputStream outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());
outputToServlet.writeObject("asdfa");
outputToServlet.flush();
outputToServlet.close();
I had the same problem and I resolved it reading the response from the servlet. You can do: