Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with *.do for Compression Filter using Struts

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • 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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried /*?

./pope
 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Yes, it works fine when I comment out the filter from web.xml.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • 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
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • 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.
 
Sean Owen
author
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic