Hey John, I ran across the same issue. During authorization, I pass post variables to an authorize method.. which means doing a getEntityAsForm(), which reads the input stream..
I'm not sure if it's a viable solution yet, but I read the content-type http header now, and only if it is application/x-www-form-urlencoded do I get the post vars. I don't think this will help in your case though.. It would be nice to be able to reset the input stream after reading it. -Tom On Wed, Feb 11, 2009 at 1:33 PM, Stephan Koops <[email protected]> wrote: > Hi John, > > if you want to create the entity as String, you have to read the String. > But if it is read, the data is read ... and no available in the Stream > anymore. > > best regards > Stephan > > John Prystash schrieb: > > Hey Everyone, I encountered this behavior and was wondering if it is > > intentional. I'm sure it is, but if so I was wondering about the > > reasoning behind it. > > > > In my Guard override, during authorize() I need to inspect the body of > > the request: > > > > @Override > > public boolean authorize(Request request) { > > ... > > String text= request.getEntity().getText(); > > ... > > } > > > > > > When I get the Resource method, the body is null: > > > > @Override > > public void post(Representation entity) { > > ... > > String text = entity.getText(); // is null > > ... > > } > > > > From InputRepresentation: > > > > @Override > > public InputStream getStream() throws IOException { > > final InputStream result = this.stream; > > setStream(null); > > return result; > > } > > > > @Override > > public String getText() throws IOException { > > return ByteUtils.toString(getStream(), getCharacterSet()); > > } > > > > I was wondering if the setStream(null) is intended behavior (or if I'm > > abusing the purpose of the Guard) and if so, some background for my > > education would be much appreciated. Thanks! > > > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1140979 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1141071

