• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Applet to servlet communication-- Urgent

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"venkat",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
A wop bop a lu bop a womp bam boom! Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic