• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dual stream Servlet output

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic