Encoder changes in Restlet 1.1.1

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Encoder changes in Restlet 1.1.1

Tamás Cservenák
Hi there,

i had an Application that was using restlet 1.1-RC2 with following snippet:

    public Restlet createRoot()
    {
        // configure
        configure();

        // encoder support
        Encoder encoder = new Encoder( getContext() );

        // create root
        Router root = new Router( getContext() );

        encoder.setNext( root );

...
        return encoder;
    }

And it was working just perfect, was returning GZIP transfer-encoding when asked for it (without any trickery in resources et al, just adding this filter as first in root). Example:

$ curl -v http://localhost:8081/webapp/js/utils.js -H "Accept-Encoding: gzip" -H "Accept: application/x-javascript"
* About to connect() to localhost port 8081 (#0)
*   Trying ::1... Connection refused
*   Trying fe80::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /webapp/js/utils.js HTTP/1.1
> User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
> Host: localhost:8081
> Accept-Encoding: gzip
> Accept: text/html
< HTTP/1.1 200 OK
< Content-Encoding: gzip
< Content-Language: en-us
< Content-Type: application/x-javascript
< Date: Sat, 01 Nov 2008 19:41:41 GMT
< Accept-Ranges: bytes
< Server: Noelios-Restlet-Engine/1.1.rc2
< Transfer-Encoding: chunked
GZIP CONTENT FOLLOWS...


That was fine. Then, i simply upgraded the project dependencies to restlet 1.1.1, without _any_ code change in app, and it stopped serving GZIP. Everything works, except GZIP. Like restlet is simply neglecting the Accept-Encoding header anymore...

(Yes, there is the path problem, look at Content-Location of response, and it is broken in 1.1.1 too, but was working for me).

Any thoughts?


--
Thanks,
~t~
Reply | Threaded
Open this post in threaded view
|

Re: Encoder changes in Restlet 1.1.1

Thierry Boileau
Hello Tamás

I've tested with the jar of the 1.1rc2 and the 1.1.1 and I obtain the same results with the curl client, that is to say the zipped content of the requested file.
When I test with a Internet browser (Firefox in my case), I obtain the "real" file, either with 1.1rc2 or 1.1.1.
I precise that the source code of this filter has not been updated since the release of the 1.1RC1.
There may be a probleme with the metadata service. Does your application update this service?

>(Yes, there is the path problem, look at Content-Location of response, and it is broken in 1.1.1 too, but was working for me).

I don't notice this problem in my environment, could you send a sample code that illustrates this bug?

best regards,
Thierry Boileau


Hi there,

i had an Application that was using restlet 1.1-RC2 with following snippet:

    public Restlet createRoot()
    {
        // configure
        configure();

        // encoder support
        Encoder encoder = new Encoder( getContext() );

        // create root
        Router root = new Router( getContext() );

        encoder.setNext( root );

...
        return encoder;
    }

And it was working just perfect, was returning GZIP transfer-encoding when asked for it (without any trickery in resources et al, just adding this filter as first in root). Example:

$ curl -v http://localhost:8081/webapp/js/utils.js -H "Accept-Encoding: gzip"
* About to connect() to localhost port 8081 (#0)
*   Trying ::1... Connection refused
*   Trying fe80::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /webapp/js/utils.js HTTP/1.1
> User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
> Host: localhost:8081
> Accept-Encoding: gzip
> Accept: text/html
< HTTP/1.1 200 OK
< Content-Encoding: gzip
< Content-Language: en-us
< Content-Type: application/x-javascript
< Date: Sat, 01 Nov 2008 19:41:41 GMT
< Accept-Ranges: bytes
< Server: Noelios-Restlet-Engine/1.1.rc2
< Transfer-Encoding: chunked
GZIP CONTENT FOLLOWS...


That was fine. Then, i simply upgraded the project dependencies to restlet 1.1.1, without _any_ code change in app, and it stopped serving GZIP. Everything works, except GZIP. Like restlet is simply neglecting the Accept-Encoding header anymore...

(Yes, there is the path problem, look at Content-Location of response, and it is broken in 1.1.1 too, but was working for me).

Any thoughts?


--
Thanks,
~t~
Reply | Threaded
Open this post in threaded view
|

Re: Encoder changes in Restlet 1.1.1

Tamás Cservenák
Hi Thierry!

Sorry for this "false alarm", but it seems i have some problem in my restlet app that causes this.

I created a simple "demo" application and it really works (with both 1.1-RC2 and 1.1.1), but in my app it won't. No, i am not touching the metadata service.... will keep looking.

~t~

On Tue, Nov 4, 2008 at 6:19 PM, Thierry Boileau <[hidden email]> wrote:
Hello Tamás

I've tested with the jar of the 1.1rc2 and the 1.1.1 and I obtain the same results with the curl client, that is to say the zipped content of the requested file.
When I test with a Internet browser (Firefox in my case), I obtain the "real" file, either with 1.1rc2 or 1.1.1.
I precise that the source code of this filter has not been updated since the release of the 1.1RC1.
There may be a probleme with the metadata service. Does your application update this service?

>(Yes, there is the path problem, look at Content-Location of response, and it is broken in 1.1.1 too, but was working for me).

I don't notice this problem in my environment, could you send a sample code that illustrates this bug?

best regards,
Thierry Boileau


Hi there,

i had an Application that was using restlet 1.1-RC2 with following snippet:

    public Restlet createRoot()
    {
        // configure
        configure();

        // encoder support
        Encoder encoder = new Encoder( getContext() );

        // create root
        Router root = new Router( getContext() );

        encoder.setNext( root );

...
        return encoder;
    }

And it was working just perfect, was returning GZIP transfer-encoding when asked for it (without any trickery in resources et al, just adding this filter as first in root). Example:

$ curl -v http://localhost:8081/webapp/js/utils.js -H "Accept-Encoding: gzip"
* About to connect() to localhost port 8081 (#0)
*   Trying ::1... Connection refused
*   Trying fe80::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /webapp/js/utils.js HTTP/1.1
> User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
> Host: localhost:8081
> Accept-Encoding: gzip
> Accept: text/html
< HTTP/1.1 200 OK
< Content-Encoding: gzip
< Content-Language: en-us
< Content-Type: application/x-javascript
< Date: Sat, 01 Nov 2008 19:41:41 GMT
< Accept-Ranges: bytes
< Server: Noelios-Restlet-Engine/1.1.rc2
< Transfer-Encoding: chunked
GZIP CONTENT FOLLOWS...


That was fine. Then, i simply upgraded the project dependencies to restlet 1.1.1, without _any_ code change in app, and it stopped serving GZIP. Everything works, except GZIP. Like restlet is simply neglecting the Accept-Encoding header anymore...

(Yes, there is the path problem, look at Content-Location of response, and it is broken in 1.1.1 too, but was working for me).

Any thoughts?


--
Thanks,
~t~



--
Thanks,
~t~