aspose file tools*
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: 356
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: 14432
    
  23

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 8 API documentation
Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 356
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: 14432
    
  23

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: 8997
    
    9

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?


[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File to stream on request !