This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Servlet Filters with struts

 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic