Re: problems using gzip encoding

2007-10-09 Thread Jim Alateras

Jerome,

Ignore this last questionbasically i has an invalid test case.

cheers


Jerome Louvel wrote:

Hi Jim,

I'm not 100% sure I understand what you exactly want to do:

 * For the encoding/client side, your approach is OK. 


 * For the decoding/server side, you can directly use the request's entity
as a APPLICATION_XML representation, for example using
req.getEntity().toString().

There is no need to wrap the request entity into a DecodeRepresentation or
even an EncodeRepresentation as this is already done by the
"decoderService".

If you want to encoded representation (GZIP), you have to turn off the
"decoderService" on your application.

 * Note that in the future, we'd like to add a "encoderService":
http://restlet.tigris.org/issues/show_bug.cgi?id=208

Best regards,
Jerome  


-Message d'origine-
De : Jim Alateras [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 9 octobre 2007 14:51

À : discuss@restlet.tigris.org
Objet : Re: problems using gzip encoding

Hey Jerome,

I want the decoder service enabled. I guess my question is 
whether i am 
doing something wrong.


On the client I do something like this

Representation rep = new EncodeRepresentation(Encoding.GZIP,
			new 
StringRepresentation(getXStream().toXML(records),		
			 
MediaType.APPLICATION_XML));


and on the server side i need to do something like this to 
retrieve the 
original StringRepresentation.


(EncodeRepresentation)((DecodeRepresentation)entity).getWrappe

dRepresentation()).getWrappedRepresentation();
So the StringRepresentation is wrapped inside the 
EncodeRepresentation 
which is subsequently wrapped inside a DecodeRepresentation.


Can you confirm

cheers



Jerome Louvel wrote:

Hi Jim,

The Application.decoderService is already able to 

automatically decode

incoming compressed representations. If you prefer to disable this
behavior, just do:

myApp.getDecoderService().setEnabled(false);

before starting the application.

Best,
Jerome


2007/10/9, Jim Alateras <[EMAIL PROTECTED]>:
Okay this is my problem. I was assuming that i would get 

the wrapped

representation once it hits my resource by i get the
DecodeRepresentation instance instead.

Can I configure my Application so that the wrapped 

representation is

sent to my resource class rather than the DecodeRepresentation?


cheers

Jim Alateras wrote:

I am trying use gzip for all my representations and use the tunnel
filter, on the application, to automatically decode the 

body before

passing it to the router.

This how i encode the rep

new EncodeRepresentation(Encoding.GZIP, new

StringRepresentation(getXStream().toXML(records),
MediaType.APPLICATION_XML));

but i end up getting the following error on the server.

java.io.IOException: Not in GZIP format
at
java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:132)
at 

java.util.zip.GZIPInputStream.(GZIPInputStream.java:58)
at 

java.util.zip.GZIPInputStream.(GZIPInputStream.java:68)

at


com.noelios.restlet.application.DecodeRepresentation.getDecode
dStream(DecodeRepresentation.java:138)

at


com.noelios.restlet.application.DecodeRepresentation.getStream
(DecodeRepresentation.java:115)

at


com.noelios.restlet.application.DecodeRepresentation.getText(D
ecodeRepresentation.java:189)

at


au.com.observant.ringocore.resource.syslog.SyslogsResource.pos
t(SyslogsResource.java:103)
at 

org.restlet.resource.Resource.handlePost(Resource.java:479)

at org.restlet.Finder.handle(Finder.java:296)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Router.handle(Router.java:444)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Filter.doHandle(Filter.java:105)
at 

com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:87)

at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at


com.noelios.restlet.application.ApplicationHelper.handle(Appli
cationHelper.java:96)

at org.restlet.Application.handle(Application.java:293)
at org.restlet.Uniform.handle(Uniform.java:97)
at

cheers






RE: problems using gzip encoding

2007-10-09 Thread Jerome Louvel

Hi Jim,

I'm not 100% sure I understand what you exactly want to do:

 * For the encoding/client side, your approach is OK. 

 * For the decoding/server side, you can directly use the request's entity
as a APPLICATION_XML representation, for example using
req.getEntity().toString().

There is no need to wrap the request entity into a DecodeRepresentation or
even an EncodeRepresentation as this is already done by the
"decoderService".

If you want to encoded representation (GZIP), you have to turn off the
"decoderService" on your application.

 * Note that in the future, we'd like to add a "encoderService":
http://restlet.tigris.org/issues/show_bug.cgi?id=208

Best regards,
Jerome  

> -Message d'origine-
> De : Jim Alateras [mailto:[EMAIL PROTECTED] 
> Envoyé : mardi 9 octobre 2007 14:51
> À : discuss@restlet.tigris.org
> Objet : Re: problems using gzip encoding
> 
> Hey Jerome,
> 
> I want the decoder service enabled. I guess my question is 
> whether i am 
> doing something wrong.
> 
> On the client I do something like this
> 
> Representation rep = new EncodeRepresentation(Encoding.GZIP,  
>   new 
> StringRepresentation(getXStream().toXML(records), 
>
> MediaType.APPLICATION_XML));
> 
> and on the server side i need to do something like this to 
> retrieve the 
> original StringRepresentation.
> 
> (EncodeRepresentation)((DecodeRepresentation)entity).getWrappe
dRepresentation()).getWrappedRepresentation();
> 
> So the StringRepresentation is wrapped inside the 
> EncodeRepresentation 
> which is subsequently wrapped inside a DecodeRepresentation.
> 
> Can you confirm
> 
> cheers
> 
> 
> 
> Jerome Louvel wrote:
> > Hi Jim,
> > 
> > The Application.decoderService is already able to 
> automatically decode
> > incoming compressed representations. If you prefer to disable this
> > behavior, just do:
> > 
> > myApp.getDecoderService().setEnabled(false);
> > 
> > before starting the application.
> > 
> > Best,
> > Jerome
> > 
> > 
> > 2007/10/9, Jim Alateras <[EMAIL PROTECTED]>:
> >> Okay this is my problem. I was assuming that i would get 
> the wrapped
> >> representation once it hits my resource by i get the
> >> DecodeRepresentation instance instead.
> >>
> >> Can I configure my Application so that the wrapped 
> representation is
> >> sent to my resource class rather than the DecodeRepresentation?
> >>
> >>
> >> cheers
> >> 
> >> Jim Alateras wrote:
> >>> I am trying use gzip for all my representations and use the tunnel
> >>> filter, on the application, to automatically decode the 
> body before
> >>> passing it to the router.
> >>>
> >>> This how i encode the rep
> >>>
> >>> new EncodeRepresentation(Encoding.GZIP, new
> >>>
> >>> StringRepresentation(getXStream().toXML(records),
> >>> MediaType.APPLICATION_XML));
> >>>
> >>> but i end up getting the following error on the server.
> >>>
> >>> java.io.IOException: Not in GZIP format
> >>> at
> >>> java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:132)
> >>> at 
> java.util.zip.GZIPInputStream.(GZIPInputStream.java:58)
> >>> at 
> java.util.zip.GZIPInputStream.(GZIPInputStream.java:68)
> >>> at
> >>> 
> com.noelios.restlet.application.DecodeRepresentation.getDecode
> dStream(DecodeRepresentation.java:138)
> >>>
> >>> at
> >>> 
> com.noelios.restlet.application.DecodeRepresentation.getStream
> (DecodeRepresentation.java:115)
> >>>
> >>> at
> >>> 
> com.noelios.restlet.application.DecodeRepresentation.getText(D
> ecodeRepresentation.java:189)
> >>>
> >>> at
> >>> 
> au.com.observant.ringocore.resource.syslog.SyslogsResource.pos
> t(SyslogsResource.java:103)
> >>>
> >>> at 
> org.restlet.resource.Resource.handlePost(Resource.java:479)
> >>> at org.restlet.Finder.handle(Finder.java:296)
> >>> at org.restlet.Filter.doHandle(Filter.java:105)
> >>> at org.restlet.Filter.handle(Filter.java:134)
> >>> at org.restlet.Router.handle(Router.java:444)
> >>> at org.restlet.Filter.doHandle(Filter.java:105)
> >>> at org.restlet.Filter.handle(Filter.java:134)
> >>> at org.restlet.Filter.doHandle(Filter.java:105)
> >>> at 
> com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:87)
> >>> at org.restlet.Filter.handle(Filter.java:134)
> >>> at org.restlet.Filter.doHandle(Filter.java:105)
> >>> at org.restlet.Filter.handle(Filter.java:134)
> >>> at
> >>> 
> com.noelios.restlet.application.ApplicationHelper.handle(Appli
> cationHelper.java:96)
> >>>
> >>> at org.restlet.Application.handle(Application.java:293)
> >>> at org.restlet.Uniform.handle(Uniform.java:97)
> >>> at
> >>>
> >>> cheers
> >>> 
> >>>
> > 


Re: problems using gzip encoding

2007-10-09 Thread Jim Alateras

Hey Jerome,

I want the decoder service enabled. I guess my question is whether i am 
doing something wrong.


On the client I do something like this

Representation rep = new EncodeRepresentation(Encoding.GZIP,new 
StringRepresentation(getXStream().toXML(records),	 
MediaType.APPLICATION_XML));


and on the server side i need to do something like this to retrieve the 
original StringRepresentation.


(EncodeRepresentation)((DecodeRepresentation)entity).getWrappedRepresentation()).getWrappedRepresentation();

So the StringRepresentation is wrapped inside the EncodeRepresentation 
which is subsequently wrapped inside a DecodeRepresentation.


Can you confirm

cheers



Jerome Louvel wrote:

Hi Jim,

The Application.decoderService is already able to automatically decode
incoming compressed representations. If you prefer to disable this
behavior, just do:

myApp.getDecoderService().setEnabled(false);

before starting the application.

Best,
Jerome


2007/10/9, Jim Alateras <[EMAIL PROTECTED]>:

Okay this is my problem. I was assuming that i would get the wrapped
representation once it hits my resource by i get the
DecodeRepresentation instance instead.

Can I configure my Application so that the wrapped representation is
sent to my resource class rather than the DecodeRepresentation?


cheers

Jim Alateras wrote:

I am trying use gzip for all my representations and use the tunnel
filter, on the application, to automatically decode the body before
passing it to the router.

This how i encode the rep

new EncodeRepresentation(Encoding.GZIP, new

StringRepresentation(getXStream().toXML(records),
MediaType.APPLICATION_XML));

but i end up getting the following error on the server.

java.io.IOException: Not in GZIP format
at
java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:132)
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:58)
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:68)
at
com.noelios.restlet.application.DecodeRepresentation.getDecodedStream(DecodeRepresentation.java:138)

at
com.noelios.restlet.application.DecodeRepresentation.getStream(DecodeRepresentation.java:115)

at
com.noelios.restlet.application.DecodeRepresentation.getText(DecodeRepresentation.java:189)

at
au.com.observant.ringocore.resource.syslog.SyslogsResource.post(SyslogsResource.java:103)

at org.restlet.resource.Resource.handlePost(Resource.java:479)
at org.restlet.Finder.handle(Finder.java:296)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Router.handle(Router.java:444)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Filter.doHandle(Filter.java:105)
at com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:87)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at
com.noelios.restlet.application.ApplicationHelper.handle(ApplicationHelper.java:96)

at org.restlet.Application.handle(Application.java:293)
at org.restlet.Uniform.handle(Uniform.java:97)
at

cheers






Re: problems using gzip encoding

2007-10-09 Thread Jerome Louvel
Hi Jim,

The Application.decoderService is already able to automatically decode
incoming compressed representations. If you prefer to disable this
behavior, just do:

myApp.getDecoderService().setEnabled(false);

before starting the application.

Best,
Jerome


2007/10/9, Jim Alateras <[EMAIL PROTECTED]>:
> Okay this is my problem. I was assuming that i would get the wrapped
> representation once it hits my resource by i get the
> DecodeRepresentation instance instead.
>
> Can I configure my Application so that the wrapped representation is
> sent to my resource class rather than the DecodeRepresentation?
>
>
> cheers
> 
> Jim Alateras wrote:
> > I am trying use gzip for all my representations and use the tunnel
> > filter, on the application, to automatically decode the body before
> > passing it to the router.
> >
> > This how i encode the rep
> >
> > new EncodeRepresentation(Encoding.GZIP, new
> >
> > StringRepresentation(getXStream().toXML(records),
> > MediaType.APPLICATION_XML));
> >
> > but i end up getting the following error on the server.
> >
> > java.io.IOException: Not in GZIP format
> > at
> > java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:132)
> > at java.util.zip.GZIPInputStream.(GZIPInputStream.java:58)
> > at java.util.zip.GZIPInputStream.(GZIPInputStream.java:68)
> > at
> > com.noelios.restlet.application.DecodeRepresentation.getDecodedStream(DecodeRepresentation.java:138)
> >
> > at
> > com.noelios.restlet.application.DecodeRepresentation.getStream(DecodeRepresentation.java:115)
> >
> > at
> > com.noelios.restlet.application.DecodeRepresentation.getText(DecodeRepresentation.java:189)
> >
> > at
> > au.com.observant.ringocore.resource.syslog.SyslogsResource.post(SyslogsResource.java:103)
> >
> > at org.restlet.resource.Resource.handlePost(Resource.java:479)
> > at org.restlet.Finder.handle(Finder.java:296)
> > at org.restlet.Filter.doHandle(Filter.java:105)
> > at org.restlet.Filter.handle(Filter.java:134)
> > at org.restlet.Router.handle(Router.java:444)
> > at org.restlet.Filter.doHandle(Filter.java:105)
> > at org.restlet.Filter.handle(Filter.java:134)
> > at org.restlet.Filter.doHandle(Filter.java:105)
> > at com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:87)
> > at org.restlet.Filter.handle(Filter.java:134)
> > at org.restlet.Filter.doHandle(Filter.java:105)
> > at org.restlet.Filter.handle(Filter.java:134)
> > at
> > com.noelios.restlet.application.ApplicationHelper.handle(ApplicationHelper.java:96)
> >
> > at org.restlet.Application.handle(Application.java:293)
> > at org.restlet.Uniform.handle(Uniform.java:97)
> > at
> >
> > cheers
> > 
> >
>


Re: problems using gzip encoding

2007-10-09 Thread Jim Alateras
Okay this is my problem. I was assuming that i would get the wrapped 
representation once it hits my resource by i get the 
DecodeRepresentation instance instead.


Can I configure my Application so that the wrapped representation is 
sent to my resource class rather than the DecodeRepresentation?



cheers

Jim Alateras wrote:
I am trying use gzip for all my representations and use the tunnel 
filter, on the application, to automatically decode the body before 
passing it to the router.


This how i encode the rep

new EncodeRepresentation(Encoding.GZIP, new
   
StringRepresentation(getXStream().toXML(records),  
MediaType.APPLICATION_XML));


but i end up getting the following error on the server.

java.io.IOException: Not in GZIP format
at 
java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:132)

at java.util.zip.GZIPInputStream.(GZIPInputStream.java:58)
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:68)
at 
com.noelios.restlet.application.DecodeRepresentation.getDecodedStream(DecodeRepresentation.java:138) 

at 
com.noelios.restlet.application.DecodeRepresentation.getStream(DecodeRepresentation.java:115) 

at 
com.noelios.restlet.application.DecodeRepresentation.getText(DecodeRepresentation.java:189) 

at 
au.com.observant.ringocore.resource.syslog.SyslogsResource.post(SyslogsResource.java:103) 


at org.restlet.resource.Resource.handlePost(Resource.java:479)
at org.restlet.Finder.handle(Finder.java:296)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Router.handle(Router.java:444)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Filter.doHandle(Filter.java:105)
at com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:87)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at 
com.noelios.restlet.application.ApplicationHelper.handle(ApplicationHelper.java:96) 


at org.restlet.Application.handle(Application.java:293)
at org.restlet.Uniform.handle(Uniform.java:97)
at

cheers




problems using gzip encoding

2007-10-08 Thread Jim Alateras
I am trying use gzip for all my representations and use the tunnel 
filter, on the application, to automatically decode the body before 
passing it to the router.


This how i encode the rep

new EncodeRepresentation(Encoding.GZIP, new
   StringRepresentation(getXStream().toXML(records), 	 
MediaType.APPLICATION_XML));


but i end up getting the following error on the server.

java.io.IOException: Not in GZIP format
at 
java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:132)

at java.util.zip.GZIPInputStream.(GZIPInputStream.java:58)
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:68)
at 
com.noelios.restlet.application.DecodeRepresentation.getDecodedStream(DecodeRepresentation.java:138)
at 
com.noelios.restlet.application.DecodeRepresentation.getStream(DecodeRepresentation.java:115)
at 
com.noelios.restlet.application.DecodeRepresentation.getText(DecodeRepresentation.java:189)
at 
au.com.observant.ringocore.resource.syslog.SyslogsResource.post(SyslogsResource.java:103)

at org.restlet.resource.Resource.handlePost(Resource.java:479)
at org.restlet.Finder.handle(Finder.java:296)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Router.handle(Router.java:444)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Filter.doHandle(Filter.java:105)
at com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:87)
at org.restlet.Filter.handle(Filter.java:134)
at org.restlet.Filter.doHandle(Filter.java:105)
at org.restlet.Filter.handle(Filter.java:134)
at 
com.noelios.restlet.application.ApplicationHelper.handle(ApplicationHelper.java:96)

at org.restlet.Application.handle(Application.java:293)
at org.restlet.Uniform.handle(Uniform.java:97)
at

cheers