• 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

HttpServletResponse Output Stream

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Can I retrieve the HttpServletResponse output to a file in hard disk using JAVA filter.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me see if I understand the problem.

You want, whatever is sent to the client as HTML output, to be saved to a file. Right?

If so, then yes, filters can do that. In the doFilter method, you create an HttpServletResponseWrapper. A quick example:
The TeeOutputStream is similar, but it has no backing writer of itself so you'll need to redirect each call to both output streams:
 
Abhishek Rath
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public PrintWriter format(String format, Object... args)
{
super.format(format, args);
writer.format(format, args);
return this;
}

public PrintWriter format(Locale locale, String format, Object... args)
{
super.format(locale, format, args);
writer.format(locale, format, args);
return this;
}


the format method is no defined.it is not getting compiled.
 
Rob Spoor
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you're not using Java 5.0 or up, and you can remove those methods completely.
 
reply
    Bookmark Topic Watch Topic
  • New Topic