wood burning stoves 2.0*
The moose likes Java in General and the fly likes File to stream on request ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "File to stream on request !" Watch "File to stream on request !" New topic
Author

File to stream on request !

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 339
I have a file, i can se that i on the httprequest have a methoed to get the inputsteram, but what do i do to write my txt file to the request !

Frank
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

Write the file to the request? Are you sure that you don't want to write it to the response?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 339
Yes, im calling from a jsp a servlet, that get that takes the inputstream from the request !

But how can i write something to that inputstream !

Frank
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

You cannot write something to an input stream.

InputStream is for reading. OutputStream is for writing. What you want to do is get the OutputStream of the response object (not the request object) and write the contents of your file there.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

Perhaps Frank is asking how he can get data from the client into the input stream for reading by the server, like posting a file. Is this the case?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
 
subject: File to stream on request !
 
Similar Threads
Web Service Request Validation against WSDL
text field returns null on servlet with file - text field combination
tracing post parameter
Read large xml file for searching
Uploading from a web page