wood burning stoves*
The moose likes Struts and the fly likes Problem with *.do for Compression Filter using Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with *.do for Compression Filter using Struts" Watch "Problem with *.do for Compression Filter using Struts" New topic
Author

Problem with *.do for Compression Filter using Struts

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
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

Joined: Feb 05, 2001
Posts: 17249
    
    6

"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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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

Joined: Jul 12, 2004
Posts: 995
Have you tried /*?

./pope


blog - InfoQ.com
Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
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

Joined: Jul 12, 2004
Posts: 995
Does your application work well without the filter?

./pope
Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
Yes, it works fine when I comment out the filter from web.xml.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
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


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
"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

Joined: Nov 08, 2004
Posts: 21
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

Joined: Jul 21, 2003
Posts: 281
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with *.do for Compression Filter using Struts
 
Similar Threads
Problem with Jayson Falkner's (onJava) Compression Filter
Filter
Gzip Filter in Web Application
filter-mapping excludes?
GZipFilter inside JSP and WSAD 5.1.1