[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 713
  • Last Modified:

setting Content-Encoding to gzip to improve the response time

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
javaCaravan0
Asked:
javaCaravan0
  • 4
  • 2
  • 2
  • +1
1 Solution
 
CEHJCommented:
0
 
HegemonCommented:
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
 
objectsCommented:
most servers have built in support for gzip compression, you just need to enable it
what server are you using?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
javaCaravan0Author Commented:
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
 
javaCaravan0Author Commented:
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
 
HegemonCommented:
Yes it works (tested on JBoss 4.2.2) if you define connector properties as above.
0
 
javaCaravan0Author Commented:
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
 
objectsCommented:
> 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
 
javaCaravan0Author Commented:
I'll be closing it by next week
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now