HTTP compression (http://jira.codehaus.org/browse/WAGON-55)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

HTTP compression (http://jira.codehaus.org/browse/WAGON-55)

Nathan Beyer
I've posted some attachments to the JIRA issue WAGON-55 [1] to implement
support for accepting GZip-based compression with HTTP GETs for HTTP and
WebDAV. I'm hoping these simple changes can help to reduce some bandwidth
needs. I've seen some significant gains from my personal testing.

In any case, a major barrier to getting these patches approved and applied
is the lack of unit tests. I was able to test these patches myself using an
Apache HTTPD server and mod_deflate, but couldn't quite figure out the best
way to test in the JUnits. I tried setting up a Jetty embedded server and I
was able to get a test to executed, but I couldn't get Jetty to compress the
responses. Here's the test method I had so far trying to do this. If anyone
knows how to get this compressing the response, please let me know. Also,
any comments or suggestions on getting this test massaged to use the base
classes embedded server would be appreciated as well.


    public void testGzipGet()
        throws Exception
    {
        HttpServer server = new HttpServer();
        SocketListener listener = new SocketListener();
        listener.setPort(10008);
        server.addListener(listener);
       
        HttpContext context = new HttpContext();
        context.setContextPath("/");
        context.setResourceBase("c:/temp/");
        ResourceHandler rh = new ResourceHandler();
          //The javadoc for these methods is confusing, does this compress
the response?
        rh.setMinGzipLength(1);
        context.addHandler(rh);
        server.addContext(context);
        server.start();
        try
        {
            HttpWagon wagon = new HttpWagon();
            Repository repo = new Repository();
            repo.setUrl("http://localhost:8080");
            repo.setId("gzip-temp");
            wagon.connect(repo);
            wagon.get("hello.txt", new File("c:/temp/hello-copy.txt"));
            wagon.disconnect();
        }
        finally
        {
            server.stop();
        }
    }


Thanks,
-Nathan Beyer

[1] http://jira.codehaus.org/browse/WAGON-55 [Provide support for HTTP
compression (request and response)]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]