• 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

Servlet Filters with struts

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

Have any one used Compression filter in struts.

I am facing little proplem in implementing it.

For compression filter read the article at onjava.com

Two Servlet Filters Every Web Application Should Have

I have implemeted these filter in my struts based application .every thing is running fine with compress jpg .gif but when I add "*.do" to compress it gives me problem.

can any one tell me If we can add *.jsp in compression It gives no problem however it gives me problem for *.do .

thanks.....
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When using Struts, all requests are sent to the Controller Servlet which then executes an Action and finally forwards to a view (I have taken this simple case as an example).

A filter is configured to process the request/response sent to the controller, using <url-pattern> or <servlet-name>. When the controller servlet forwards the request/response to the jsp (view), then the filter (if it is a post-processing filter) tries to write content to the reponse which is currently being used by the jsp (view) to which the forward was made. This causes an Exception to be thrown.

The Servlet 2.3 specification does not state how filters should behave when FORWARDS or INCLUDES are performed using a RequestDispatcher. The 2.4 version of the specification covers this in SRV.6.2.5 Filters and the RequestDispatcher.

Hope this answers your question.

Sheldon Fernandes
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sheldon

Thanks for your valuable input.

but there is no exception at server end in my application every thing works fine when I use my gzip compresson filter.

but when I add *.do to compress I receive an error at IE browser that it tries to download the url.

Shailesh
 
author
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted a similar note to another thread on this subject:

I think that GZipFilter will not work if the app server applies it twice to the same request, which can happen in 2.3 if there are any server-side forwards.

If I may be so bold as to plug my own work, I have created an open-source compression filter that is faster, cleaner and more comprehensive than GZipFilter. If the above is in fact your problem, you should give my filter a try; it works regardless of how the app server behaves in this situation.

PJL Compressing Filter
http://sourceforge.net/projects/pjl-comp-filter/
reply
    Bookmark Topic Watch Topic
  • New Topic