• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Problem with *.do for Compression Filter using Struts

 
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What url-pattern should I use for Struts so that all pages are filtered by Compression Filter? My URLs are like .../mycontextRoot/MyServlet.do

I am using GZipFilter from "Servlets and JavaServer pages; the J2EE Web Tier",http://www.jspbook.com.

<filter>
<filter-name>Compress</filter-name>
<filter-class>com......GZIPFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>Compress</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>

*.do does not work.
I want ALL pages to go through this filter. The url-pattern *.jsp does not go through Compression filter for all pages.

When I use *.do in url-pattern, it goes through Compression filter. However, it gives me a message (in IE) saying Windows cannot open the file myFirstPage[1].do and ultimately, it does not display the page.

I am using WSAD 5.1 (local box) as my server and Struts 1.1.

What url-pattern should I use so that all pages are filtered by Compression Filter?

Any help will be appreciated.
Regards,
SG
sgho@aol.com
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Sam"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sam, you also don't need to post your email address. There is a button on top of your posts that allows users to get to you email address.

Also your question is a Struts question more than a Servlets question, so I am going to move this thread to the more appropriate Web Frameworks forum.

Thanks

Mark
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried /*?

./pope
 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I tried /*.
It calls Compression filter for every display, as expected.
However, blank page is returned.

My WSAD console gives following message when I use .* in url-pattern:
u No message text associated with key WARNING:.Cannot.set.header..Response.already.committed. in bundle com.ibm.ejs.resources.seriousMessages
WARNING: Cannot set header. Response already committed.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does your application work well without the filter?

./pope
 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it works fine when I comment out the filter from web.xml.
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What url-pattern should I use so that all pages are filtered by Compression Filter?



You config ,it's work fine.

You should be redirect all page to some.do
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Sam",

You must have missed Mark's previous request for you to change your display name in order to comply with JavaRanch's naming policy. I would once again ask you to please take care of this. Thanks in advance.
 
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 about GZipFilter:

I have heard that GZipFilter has problems when the app server applies it more than once to a request -- for example, when there are 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. It does not suffer from the problem described above. If you are still having trouble, maybe you can give my filter a try?

PJL Compressing Filter
http://sourceforge.net/projects/pjl-comp-filter/
 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am now using Sean Owen's Filter, instead of Jayson Falkner's filter. My filter mapping is:

<filter-mapping> <filter-name>CompressingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

It works fine without throwing any Exception within Struts framework.

However, if I use /*.do, or /*.jsp, or /*.htm, it does not invoke the filter. It invokes the filter (obviously, for every page) only with /* url-pattern.

Question to Sean: Do you know why?

My Servlet does redirection to another JSP and Sean's filter is working fine within my Struts environment.

Comment to Sean: You have many assert statements like: assert config != null; You might consider removing those lines from published code. Otherwise, users have to comment those lines for the code to compile.
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic