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

Call to Servlet with InputStream from application

Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From an Java-application I want to call a servlet with a post request that includes a text-file
in the inputstream.
How do I do that ? I tried the following,but I'm confused about how the servlet can read the stream .
URL url = new URL("http://plovdinger:80/xmlReceiver");
URLConnection uc = url.openConnection();

OutputStream os = uc.getOutputStream();

OutputStream buf = new BufferedOutputStream(os);
OutputStreamWriter out = new OutputStreamWriter(buf,"8859_1");
out.write("one little line\r\n");
out.write("Two little line\r\n");

//return the response
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic