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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 348
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: 14074
    
  16

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: 348
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: 14074
    
  16

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: 8839
    
    7

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]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File to stream on request !
 
Similar Threads
text field returns null on servlet with file - text field combination
Uploading from a web page
Read large xml file for searching
tracing post parameter
Web Service Request Validation against WSDL