• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GZIP Filter

 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone !!!

I am not sure that this section is right place for my post

have any one used GZIPFiler in his applicationm, I am facing some problem in implementing same. There is an article about in at onjava.com

Two Servlet Filters Every Web Application Should Have
[ October 12, 2004: Message edited by: Shailesh Chandra ]
 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What type of problem are you facing using GZIP filter?
Do you want compress your jsp/html files from ur webapplication ?
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear glkrr

I want to avail maximum benefit of it.

but when I add *.do ( in my struts application) for compression IE cause a
problem. First It try open like a file resource on server etc then prompt an error that coulnt open resource.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shailesh Chandra:
hi everyone !!!

I am not sure that this section is right place for my post

have any one used GZIPFiler in his applicationm, I am facing some problem in iplementing sqme. There is an article about in at onjava.com

Two Servlet Filters Every Web Application Should Have

[ October 08, 2004: Message edited by: Shailesh Chandra ]




Yeah, it really is the wrong forum for such a question. This forum is for Servlets questions only.

Mark
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark,

Which would be the correct forum for this question?

-Susanta
 
Graham Thorpe
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try at web.xml

<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>com.cj.gzipflt.GzipFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>/*.do</url-pattern>
</filter-mapping>
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>compression.Test</filter-class>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>/*.do</url-pattern>
</filter-mapping>



for servlet



import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.zip.*;
import java.net.*;

public class DemoTest extends HttpServlet {

public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException {
StringBuffer sb = new StringBuffer();
String s = "";
byte b;
System.out.println ("Entered DemoTEST");
res.setHeader("Content-Encoding","gzip");
res.setContentType ("text/html");
System.out.println("Enter");
try {
System.out.println ("Just after try");
URL url = new URL ("http://portalsit.ceemea.citibank.pl");
System.out.println ("one");
URLConnection urlc = url.openConnection();
System.out.println ("two");
DataInputStream dis = new DataInputStream (urlc.getInputStream());
while ((s=dis.readLine())!=null) {
sb.append(s);
System.out.println ("Data is :" + s);
}

GZIPOutputStream goz = new GZIPOutputStream(res.getOutputStream());
System.out.println("Enter1");

goz.write(sb.toString().getBytes());
System.out.println ("three");
goz.close();
}catch (Exception e) { System.out.println ("Exception is :" + e); }
}
}
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear glkrr

my web.xml look like exactly same as you pasted here.
butmy application is creating problem only when there is *.do is added in web.xml but works fine with *.jpg,*.txt etc

even on some machine I get problem with these settnig seems there is some bug in Internet explorer

I found this article from microsoft for
Problem in IE
 
Graham Thorpe
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did u test NetscapeNavigator?
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually I didn't try netscape because my application supports IE only.
but I will install netscape and will verify same .

since my application supports IE only so I am looking for a solution on IE

any ways thanks for your co-operation
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, with glkrr's reply, I'd say lets keep it here.

Mark
 
author
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe GZipFilter has a bug -- if the app server applies it twice to a single request, the response gets mangled since it is compressed twice. This can easily happen in a Struts application.

Try this open-source compression filter -- written by yours truly! It does not face this problem, so it may work correctly for you. It was also written to be much faster than GZipFilter and support more compression algorithms. I hope it helps.

PJL Compressing Filter
http://sourceforge.net/projects/pjl-comp-filter/
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Sean Owen !!!

I will give it a try !!!
 
Greenhorn
Posts: 2
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I gave it a try and it work like a charm. Thanks Sean!!!

reply
    Bookmark Topic Watch Topic
  • New Topic