• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

XmlEncoder with Applet

 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am using an applet and data is sent from Applet to Server , and i am writing an object to Applets outputStream using XMLEncoder

connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type",
"application/text-xml");

outStream = connection.getOutputStream();
BufferedOutputStream buffOut = new BufferedOutputStream(outStream);
XMLEncoder encoder = new XMLEncoder(buffOut);
encoder.writeObject("3");
encoder.flush();
buffOut.flush();

And at the Server end when i get the Input Stream of the request , XMLDecoder is not able to parse giving an exception like
org.xml.sax.SAXParseException: Premature end of file.

When i tried to write that input stream to a file , i saw that the closing tags are missing

Can any one let me know if there is some setting that needs to be done while sending this (I had set the content type to text/xml also )
 
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic