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
All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson