Solved

setting Content-Encoding  to gzip to improve the response time

Posted on 2010-11-17
10
667 Views
Last Modified: 2012-05-10
I would like to make use of gzip to compress the file before they are sent in the response object to improve the response time. How can I do it using JSP or web.xml.
0
Comment
Question by:javaCaravan0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 34155476
0
 
LVL 10

Expert Comment

by:Hegemon
ID: 34155570
It is not clear what "the file" is. If you are generating an HTML content, pipe it through a zip stream, possibly using a filter like advised above, the important point is to set proper response header.

If you are sending a file you would like to compress, it might be advantageous to zip it beforehand so that you know its exact size, otherwise you can use the same approach as with HTML content.
0
 
LVL 92

Expert Comment

by:objects
ID: 34159734
most servers have built in support for gzip compression, you just need to enable it
what server are you using?
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:javaCaravan0
ID: 34163937
I'm using JBOSS AS. We need to turn on the compression in JBOSS server to enable gzip compression. For any reason, if we are not able to turn on the compression, is there a way to use the JAR file that JBOSS server uses to compress the files. What is the name of that the JAR file/program name within JBOSS server that it uses to compress the files when compression is turned on in JBOSS server
0
 

Author Comment

by:javaCaravan0
ID: 34167314
we are using JBOSS 4.3 AS. Not sure whether compression="on"  is even possible in JBOSS 4.3.
Can somebody confirm.
here is the site:

http://stackoverflow.com/questions/2994420/enabling-gzip-compression-for-jboss
0
 
LVL 10

Expert Comment

by:Hegemon
ID: 34167839
Yes it works (tested on JBoss 4.2.2) if you define connector properties as above.
0
 

Author Comment

by:javaCaravan0
ID: 34168153
ok that's great. Will I have to define "compressableMimeType"?
If yes, then what is the mime type for .do (all the transactions have .do extension for JSPs)
0
 
LVL 92

Expert Comment

by:objects
ID: 34168560
> If yes, then what is the mime type for .do (all the transactions have .do extension for JSPs)

the mime type depends pn whats being returned, not the file extension (the same file extension could return many different mime types)
If they are are returning html then its text/html
0
 

Author Comment

by:javaCaravan0
ID: 34273698
I'll be closing it by next week
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question