hi friends i need ur help.
I want to send object from the
applet to the
servlet. Here im pasting the code and im finding problem while transferring the data .. Im getting java.io.InterruptedIOException while reading the data in the servlet.Please help me to resolve the problem..
Code in the applet:
try{
AppletContext ac = this.getAppletContext();
URL dataDBservlet = new URL(this.getCodeBase(),"/servlet/CallServlet");
URLConnection servletConnection = dataDBservlet.openConnection();
servletConnection.setUseCaches(false);
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
servletConnection.setRequestProperty ("Content-Type", "application/octet-stream");
ObjectOutputStream oos = new ObjectOutputStream (servletConnection.getOutputStream());
Vector vc = new Vector();
vc.addElement(timeSheetData);
oos.writeObject(vc);
ac.showDocument(dataDBservlet);
oos.flush();
oos.close();
}catch(Exception e){
System.out.println("Error in capplet.java "+e);
}
Im not facing any problem here.Its calling the servlet.
Servlet Code:
public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException{
res.setContentType("application/octet-stream");
PrintWriter out = res.getWriter();
System.out.println("stage 1:");
Vector v = new Vector();
inputFromApplet = new ObjectInputStream ( req.getInputStream());
System.out.println("stage 2:");
v = (Vector) inputFromApplet.readObject();
inputFromApplet.close();
}catch(InterruptedIOException iex){
System.out.println("Error in Call servlet :"+iex);
}catch(Exception e){
System.out.println("Error in CallServlet "+e);
}
Here im getting output in webserver Stage :1
and printing java.io.InterruptedIOException
Please put ur ideas and send me as soon as posible.
venkat