Re: Problems extracting a POST request's entity

2008-03-03 Thread Sergio Saugar
Hi,

   Thanks Mitch and Bruno for your answers.

   Bruno, I was using Restlet 1.1M1 and the problem was the same that
yours. The resolution of the POST method took a long time and the
returned entity's value was null (either using getText() or using streams).

   I returned to Restlet 1.07 and now the problem is gone.

Regards,

Sergio.

--

   Sergio Saugar García
   Área de Ciencias de la Computación e Inteligencia Artificial
   Departamento de Ciencias de la Computación
   Edificio Departamental II - Despacho 053
   Escuela Técnica Superior de Ingeniería Informática
   Universidad Rey Juan Carlos
   Móstoles (MADRID)

   Clave PGP:
   http://pgp.rediris.es:11371/pks/lookup?op=getsearch=0xADFA3433



signature.asc
Description: OpenPGP digital signature


Problems extracting a POST request's entity

2008-02-29 Thread Sergio Saugar
Hi all,

  I'm developing a web-based middleware (the software of my PhD) and I'm
trying to use RESTLET. I create a server (and a client) and some
restlets to implement the execution dynamics of  my software.

  I'm using XML for the representation of the resources (using JAXB).

  Well, I tried to implement a GET method and it works, it returns a
response with a XML entity on it. But now I'm programming a POST method
and I have a problem. I create a request with a XML string as an entity
and it seems to be ok (I'm using a StringRepresentation) for this
purpose. The code that I use is one of the following:

Representation rep = new StringRepresentation(xmlString,
MediaType.TEXT_XML);

  I debug the request and it seems to be well formed. But, when I try to
get back the XML string on the handlePost method, I allways obtain a
null value. How could I extract the XML String from a request's
entity??? (i try to do it using an InputStreamReader but the result is
the same)

I would appreciate some help regarding this, it takes me two days!! :-)


P.D.- Please forgive my poor english :-)

-- 

   Sergio Saugar García
   Área de Ciencias de la Computación e Inteligencia Artificial
   Departamento de Ciencias de la Computación
   Edificio Departamental II - Despacho 053
   Escuela Técnica Superior de Ingeniería Informática
   Universidad Rey Juan Carlos
   Móstoles (MADRID)

   Clave PGP:
   http://pgp.rediris.es:11371/pks/lookup?op=getsearch=0xADFA3433



signature.asc
Description: OpenPGP digital signature


RE: Problems extracting a POST request's entity

2008-02-29 Thread Mitch Stewart
If you read the stream from the representation, or call getText(), then the 
stream will be consumed and there will be no more data to read.

This is also true if you debug a POST on the server side, and call getText(). 
Your debugger will consume the stream and no more data will be available to the 
handlePost() method.

Only grab the data from the Representation once. If you need to debug, then 
read it into a temporary variable prior to parsing it, then you can inspect the 
temp variable without losing the data.

Mitch

 -Original Message-
 From: Sergio Saugar [mailto:[EMAIL PROTECTED] 
 Sent: Friday, February 29, 2008 2:30 PM
 To: discuss@restlet.tigris.org
 Subject: Problems extracting a POST request's entity
 
 Hi all,
 
   I'm developing a web-based middleware (the software of my 
 PhD) and I'm trying to use RESTLET. I create a server (and a 
 client) and some restlets to implement the execution dynamics 
 of  my software.
 
   I'm using XML for the representation of the resources (using JAXB).
 
   Well, I tried to implement a GET method and it works, it 
 returns a response with a XML entity on it. But now I'm 
 programming a POST method and I have a problem. I create a 
 request with a XML string as an entity and it seems to be ok 
 (I'm using a StringRepresentation) for this purpose. The code 
 that I use is one of the following:
 
 Representation rep = new StringRepresentation(xmlString, 
 MediaType.TEXT_XML);
   
   I debug the request and it seems to be well formed. But, 
 when I try to get back the XML string on the handlePost 
 method, I allways obtain a null value. How could I extract 
 the XML String from a request's entity??? (i try to do it 
 using an InputStreamReader but the result is the same)
 
 I would appreciate some help regarding this, it takes me two 
 days!! :-)
 
 
 P.D.- Please forgive my poor english :-)
 
 -- 
 
Sergio Saugar García
Área de Ciencias de la Computación e Inteligencia Artificial
Departamento de Ciencias de la Computación
Edificio Departamental II - Despacho 053
Escuela Técnica Superior de Ingeniería Informática
Universidad Rey Juan Carlos
Móstoles (MADRID)
 
Clave PGP:
http://pgp.rediris.es:11371/pks/lookup?op=getsearch=0xADFA3433