Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Object Output Streams and JApplets

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
please could you give me your thoughts. im attempting to open an object output stream to a servlet from a japplet but the japplet does not call the servlet. i used exactly the same code in an applet and it worked fine. i can also open a stream from the servlet to the japplet just not vice versa.
this is the code
try{
URL url = new URL(LOG_SERVLET);
URLConnection conn = url.openConnection();
conn.setUseCaches (false);
conn.setDefaultUseCaches(false);
conn.setDoOutput(true);
conn.setRequestProperty ("Content-Type", "application/octet-stream");
ObjectOutputStream oos = new ObjectOutputStream(conn.getOutputStream());
oos.writeObject(anObject);
oos.writeObject(anOtherObject);

oos.flush();
oos.close();
} catch(MalformedURLException mue) {
System.out.println(mue);
} catch(IOException ioe) {
System.out.println(ioe);
}
the code executes without throwing any errors but doesn't call the servlet. any ideas would be appricated.
adam
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Code seems to be OK buddy ... are you sure its not calling the servlet at all ?
What about the doInput and doOutput properties of the servlet?
 
There's a way to do it better - find it. -Edison. A better tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic