• 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

GZIPing JSP

 
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
A while ago I read that there is way of gziping a JSP page and then un-gziping in when page is displayed. Anybody got some info on that?
thanks,
Alex
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that's a function of the server (and honored by the browser). I know apache provides such capabilities. Since this isn't really about JSP per se, I'm moving this along to the Apache/Tomcat forum for further discussion.
bear
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read this:
http://www.onjava.com/pub/a/onjava/2003/11/19/filters.html
It discusses a compression filter which may be what you are looking for.
brian
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I read that article and tried to implement the technique. However, I got UnknownHostException error. I e-mail author and this is what I got:


Hi,
You don't need to import the JAR because you aren't using it in the JSP.
The filter relies on the code being in your web applications class path,
which it will be if you put the JAR in the WEB-INF/lib directory.
The JSP error appears to be a problem with your network connection. If
you look at the stack trace, it shows that your computer can't find
"www.yahoo.com". The fix is probably as simple as connecting to the web,
make sure you have a net connection available. BTW, it looks like you
aren't trying the code on a JSP 2.0 container -- you'll have to change
the JSP expressions to be JSP 1.2 expressions (e.g. <%= %> if that is
the case.
Jayson Falkner
jayson@jspinsider.com
On Fri, 2004-01-16 at 18:08, Aleksandr Kravets wrote:
> Hi Jayson,
>
> I read your article on JSP/Servlet compression [http://www.onjava.com/lpt/a/4361] and found it very informative. First of all I copied jspbook.jar into com/jsbook directory and imported it in TestGZIP.jsp. I am not sure why you did not have it, were the *jar classes in same directory as JSP page? However, when I tried to run TestGZIP.jsp something weired happened. Attached is screenshot of that. After entering url and submitting the page I got this error:
>
> Location: /kwi/compress/TestGZIP.jsp
> Internal Servlet Error:
>
> java.net.UnknownHostException: www.yahoo.com
> at java.net.InetAddress.getAllByName0(InetAddress.java:566)
> at java.net.InetAddress.getAllByName0(InetAddress.java:535)
> at java.net.InetAddress.getByName(InetAddress.java:444)
> at java.net.Socket.(Socket.java:95)
> at sun.net.NetworkClient.doConnect(NetworkClient.java:45)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:330)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:516)
> at sun.net.www.http.HttpClient.(HttpClient.java:266)
> at sun.net.www.http.HttpClient.(HttpClient.java:276)
> at sun.net.www.http.HttpClient.New(HttpClient.java:288)
> at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:417)
> at compress._0002fcompress_0002fTestGZIP_0002ejspTestGZIP_jsp_1._jspService(_0002fcompress_0002fTestGZIP_0002ejspTestGZIP_jsp_1.java:72)
>
>
> Not sure what it means.
>
> Can you give any insight on what am I doing wrong?
>
> thanks,
> Alex Kravets


But I don't understand why would I get UnknownHostException if I am executing JSP on company's Intranet.
thanks,
Alex
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, one more thing. The compression technique works only with URLs? Another words do I have to pass the url or can I just point to the File on the server?
Also, if I am getting UnknownHostException, how do I check what's causing it and how do I fix it. Is this firewall issue?
thanks,
Alex
[ January 19, 2004: Message edited by: Alex Kravets ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic