Hi, ok i don't get an error anymore (thank you to those who helped me with
that). I removed the ObjectOutputStream from my code, but now my servlet
doesnt seems to not be run even tho a connection to is is established.
(The servletrunner thing where it says the servletname: init thing doesnt
happen, which is why i assume its not run)
in my applet i call a function
downloadFile(data)
which contains the following code
public void downloadFile(UserData data) throws Exception
{
servlet = new URL(webBase, "servlet/FileDownloadServlet");
Serializable objs[] = { data };
URLConnection con = servlet.openConnection();
System.out.println("con open");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
int numObjects = objs.length;
String output = "";
for(int i = 0; i< numObjects; i++)
{
out.writeObject(objs[i]);
output = "done!";
}
out.flush();
out.close();
}
then the servlet is (no database stuff this time, just trying to dl a file
from /tmp )
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
// Open the I/O streams and connection
ObjectInputStream in = new ObjectInputStream(req.getInputStream() );
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
try {
try {
//get parameter from applet
UserData data = (UserData)in.readObject();
out.println("Content-Disposition: attachment;
filename="+data.getFileName());
out.println("Content-Type: application/octet-stream;
name=/tmp/"+data.getFileName());
out.println("Content-Location: /tmp/"+data.getFileName());
out.println("Content-Base: /tmp/"+data.getFileName());
}
catch (java.lang.Exception ex){
ex.printStackTrace ();
}
} catch (Exception e) { e.printStackTrace(); }
in.close();
}
Any suggestions?
Thanks
sohaila
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html