• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Reading the file

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

How can we read the outputstream which we get as a response from webserver ?.
Actually i want to read the outputstream as i am getting a file as response?

Thanks in advance,

Jithesh
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jithesh Kumar wrote:Hi all,

How can we read the outputstream which we get as a response from webserver ?.
Actually i want to read the outputstream as i am getting a file as response?

Thanks in advance,

Jithesh



Don't you mean InputStream ? The server wrote to an OutputStream (or equivalent) and you read the content from an InputStream. How you get access to this InputStream depends on what you are using to connect to the Web Server.
 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



what you are using to connect to the Web Server



I think we are connecting to the webserver using request and response. So the issue is to get the stream of response where the webserver is writing.
 
James Sabre
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jithesh Kumar wrote:



what you are using to connect to the Web Server



I think we are connecting to the webserver using request and response. So the issue is to get the stream of response where the webserver is writing.



The detail matters. What exactly are you using to connect to the web server. If you are using a URLConnection then you can get the response from an InputStream. Check the Javadoc for URLConnection, HttpURLConnection and HttpsURLConnection.
 
Jithesh Kumar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for responding.

for communicating a servlet with another servlet (in same webserver)if i use HttpURLConnection, can we send the request object from one servlet to another servlet or i have to send each parameter one by one to another servlet ?
 
James Sabre
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jithesh Kumar wrote:thank you for responding.

for communicating a servlet with another servlet (in same webserver)if i use HttpURLConnection, can we send the request object from one servlet to another servlet or i have to send each parameter one by one to another servlet ?



You need to spend some time looking at the basics of Servlets.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic