This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not Compress PDF - using Sean Owen's Compression Filter

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Sean Owen's Compression Filter (http://sourceforge.net/projects/pjl-comp-filter/).

Is there an easy way NOT to compress the returned bytes, if the page returned is of type pdf? I cannot think of any entry in web.xml that will make it happen. The only approach I can think of is modifying the code of Sean Owen.
I can think of 2 ways:
1) Putting relevant packages in url-pattern in web.xml and I do not want to do it.
2) Modify Sean Owne's code so that it does not compress the result if the content type is of type pdf.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam,
I can think of a third alternative: wrap the filter in one of your own and call your filter.

This new filter can check the extension. If it's not PDF, call Sean's filter.
 
Sean Owen
author
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is Sean Owen -- yes, beginning in version 1.3 of the filter, you can include or exclude certain content types from compression.

For example, to only compress HTML and XML, you can add configure the filter with this parameter in web.xml:

<init-param>
<param-name>includeContentTypes</param-name>
<param-value>text/html,text/xml</param-value>
</init-param>

Other content types will not be compressed. Alternatively, to compress everything except PDFs, you can use this parameter:

<init-param>
<param-name>excludeContentTypes</param-name>
<param-value>application/pdf</param-value>
</init-param>

You can't specify both at once though.

You can find javadocs here, and the latest version for download here. Please post messages there if you have any other questions or problems. Thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean,
The "here" doesn't appear to be a link. Could you try reposting that part?
 
Sean Owen
author
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops!

Javadoc is at:
http://pjl-comp-filter.sourceforge.net/
Main page and download link are at:
http://sourceforge.net/projects/pjl-comp-filter/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic