Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dual stream Servlet output  RSS feed

 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
Is there a tag for jsp and code snippet for direct servlets that allows the generation of two+ files from one input stream? I have an input file and want to write an ServletOutputStream to the browser and also a FileOutputStream to an area on a the local hd. tia.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For those coming in late, this is a continuation of a thread started here, but we can't send that one here since Chris asked two questions in one thread.
As punishment, Chris must now write JSPs
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know of no such tag library, but I wouldn't do it that way in any case. It would put a lot of goo on the page that really has nothing to do with it.

Rather, I'd implement a servler filter, wrap the response in a response wrapper, and grab the response buffer for writing to disk on the way out.

When you say 'local system', you are talking about the server's file system, correct?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a tag library that provides JSP caching, and a side effect of that is it stores a copy of the output to the file system. This is the one I was thinking of, but I don't know what it is called.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure which library you're thinking of either David. It's not one that I am familiar with.

This sort of thing is quite possible simply using the JSTL, but I'd favor an approach that is independent of on-page code.
[ September 06, 2005: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Rather, I'd implement a servler filter, wrap the response in a response wrapper, and grab the response buffer for writing to disk on the way out.


I roughed out a demo app that does this a while back.
I never posted it on my site but the war file is still there if you want it
http://simple.souther.us/capture.war

It displays the tomcat home page and, at the same time, using the technique that Bear just described, dumps the output to stdout.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It has been a few years since I bothered looking for one. The suggestions above would work, but just to show I'm not going out of my mind here is a sample implementation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!