- From: Ragna-Lena&Dan <prepare.enrich@telia.com>
- Date: Fri, 17 Sep 1999 23:44:43 +0200
- To: "jigsaw <== dan" <www-jigsaw@w3.org>
- Message-ID: <003701bf0155$da57d360$1cb8143e@dan>
I try to send a number of userdefined strings as a serialized object from
an applet to a servlet (I use Jigsaw 2.0.2 as a server on my localhost).
This is my code for sending the object from the applet:
log("Connecting to servlet...");
URL StakoDBservlet = new URL( urlStr);
URLConnection servletConnection = StakoDBservlet.openConnection();
log("Connected");
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
servletConnection.setUseCaches (false);
servletConnection.setRequestProperty("Content-Type", "application/octet-stream");
sendCustomerToServlet(servletConnection, theCustomer);
servletConnection.connect();
The method sendCustomerToServlet(servletConnection, theCustomer);
// theCustomer is the serialized object
looks like this:
protected void sendCustomerToServlet(URLConnection servletConnection, StakoReg theCustomer)
{
ObjectOutputStream outputToServlet = null;
try
{
log("Sending the customer to the servlet...");
outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());
outputToServlet.writeObject(theCustomer);
outputToServlet.flush();
outputToServlet.close();
log("Complete.");
}
catch (IOException e)
{
log(e.toString());
}
}
I log "Complete" but then I get a java.net socketException
with the message 'Unexpected end of file from server'. (appletviewer)
In ie4 I reach "Sending the customer to the servlet..." and
then I get a com.ms.security.SecurityExceptionEx[StakoDBApplet.sendCustomerToServlet]
with the message 'cannot access "dan":8001'
(to reach my servlet I use the URL "http://dan:8001/servlet/StakoDBServlet";
the path "http://dan:8001/servlet/SomeServlet" runs well for other applications).
Please advise.
-dan
Received on Friday, 17 September 1999 17:43:27 UTC