File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not Compress PDF - using Sean Owen's Compression Filter

 
Sam Gehouse
Ranch Hand
Posts: 281
  • 0
  • 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: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • 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
  • 0
  • 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: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • 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
  • 0
  • 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/
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic