Re: Restlet Component Fault Handling

2009-02-27 Thread tfredrich

A proposed change to DefaultRestletBinding is attached.  This patch worked
great for me, enabling me to set the fault header and exception (without
having to also set headers on the out message), and get the expected result
in response.  
http://www.nabble.com/file/p22248469/DefaultRestletBinding.java
DefaultRestletBinding.java   I simply created a new version of
populateRestletResponseFromExchange() which checks the fault before calling
populateRestletResponseFromMessage(Message, Response) --which was refactored
from the previous populateRestletResponseFromExchange(Exchange, Response).

--Todd
-- 
View this message in context: 
http://www.nabble.com/Restlet-Component-Fault-Handling-tp22173327p22248469.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Re: Restlet Component Fault Handling

2009-02-27 Thread William Tam
Hi Todd,

I submitted a fix which is along the same line as your proposed
change.  I believe it should work in your case.   Let me know it goes.
 Thanks.

Cheers,
William

On Fri, Feb 27, 2009 at 10:48 AM, tfredrich tfredr...@yahoo.com wrote:

 A proposed change to DefaultRestletBinding is attached.  This patch worked
 great for me, enabling me to set the fault header and exception (without
 having to also set headers on the out message), and get the expected result
 in response.
 http://www.nabble.com/file/p22248469/DefaultRestletBinding.java
 DefaultRestletBinding.java   I simply created a new version of
 populateRestletResponseFromExchange() which checks the fault before calling
 populateRestletResponseFromMessage(Message, Response) --which was refactored
 from the previous populateRestletResponseFromExchange(Exchange, Response).

 --Todd
 --
 View this message in context: 
 http://www.nabble.com/Restlet-Component-Fault-Handling-tp22173327p22248469.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.




Re: Restlet Component Fault Handling

2009-02-26 Thread William Tam
I submitted a fix.  Restlet component now checks for
Exchange.isFailed() and looks at Fault message to prepare a response
when isFailed() is true.   It is consistent with HTTP component.

https://issues.apache.org/activemq/browse/CAMEL-1400


On Thu, Feb 26, 2009 at 10:55 AM, William Tam email.w...@gmail.com wrote:
 Hi Todd,

 Thanks for your feedback.  Fault handler of Restlet component should
 be consistent with other components.  It sounds like it isn't.   Let
 me look into it.

 Cheers,
 William

 On Mon, Feb 23, 2009 at 7:21 PM, tfredrich tfredr...@yahoo.com wrote:

 I'm utilizing the Restlet component (via a Trunk build) and am interested in
 better understanding error handling behavior via the exchange fault message.
 BTW, I appreciate your work on this component!  Good stuff, indeed.

 In essence, I'm simply using camel-restlet to expose a JSON RESTful service
 with CRUD behavior.  The route looks something like this:

 from(restlet:http://localhost:8080/people/person/{userId}?restletMethod=GET;)
    .intercept(new AuthenticationInterceptor())
    .process(new QueryStringProcessor())
    .process(new GetPersonProcessor())
    .marshal(format)
    .process(new JsonpProcessor());

 Of interest for my question is the GetPersonProcessor, which is responsible
 for retrieving the person object from a storage repository.  When a
 non-existent userId is requested, the GetPersonProcessor does not return a
 person object and, instead sets the restlet response header to 404 (not
 found).  After reading the Camel manual, I thought it best to set the 404
 along with a fault message on the exchange, but the restlet component
 doesn't appear to acknowledge the fault and composes its response from the
 out message.  So, unless I misunderstand, I have to set the 404 on the out
 message header (for the restlet component) and set the body on the fault
 message (for camel to terminate the pipeline).

 Now for the question:  Is this the way I should be doing things?  Or
 could/should the DefaultRestletBinding utilize the fault message to compose
 its response, if a fault message exists?  Your feedback is much appreciated.

 Thanks,
 --Todd
 --
 View this message in context: 
 http://www.nabble.com/Restlet-Component-Fault-Handling-tp22173327p22173327.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





Re: Restlet Component Fault Handling

2009-02-25 Thread Claus Ibsen
On Tue, Feb 24, 2009 at 1:21 AM, tfredrich tfredr...@yahoo.com wrote:

 I'm utilizing the Restlet component (via a Trunk build) and am interested in
 better understanding error handling behavior via the exchange fault message.
 BTW, I appreciate your work on this component!  Good stuff, indeed.

 In essence, I'm simply using camel-restlet to expose a JSON RESTful service
 with CRUD behavior.  The route looks something like this:

 from(restlet:http://localhost:8080/people/person/{userId}?restletMethod=GET;)
    .intercept(new AuthenticationInterceptor())
    .process(new QueryStringProcessor())
    .process(new GetPersonProcessor())
    .marshal(format)
    .process(new JsonpProcessor());

 Of interest for my question is the GetPersonProcessor, which is responsible
 for retrieving the person object from a storage repository.  When a
 non-existent userId is requested, the GetPersonProcessor does not return a
 person object and, instead sets the restlet response header to 404 (not
 found).  After reading the Camel manual, I thought it best to set the 404
 along with a fault message on the exchange, but the restlet component
 doesn't appear to acknowledge the fault and composes its response from the
 out message.  So, unless I misunderstand, I have to set the 404 on the out
 message header (for the restlet component) and set the body on the fault
 message (for camel to terminate the pipeline).

 Now for the question:  Is this the way I should be doing things?  Or
 could/should the DefaultRestletBinding utilize the fault message to compose
 its response, if a fault message exists?  Your feedback is much appreciated.
Hi

William Tam or William Jiang is the people behind the camel-restlet component
and will be able to help you.

Whats you current status?

The fault stuff in Camel is put in Camel because of JBI. In pure camel
its not really used as we use Exceptions to indicate failures.
So there can be a few rough spots in the some components that does not
adhere to fault.

And take a look in the source code for restlet. Compare it with
camel-http that should honor the fault stuff.
You might find a gremlin and can point out the problem so we can fix it faster.




 Thanks,
 --Todd
 --
 View this message in context: 
 http://www.nabble.com/Restlet-Component-Fault-Handling-tp22173327p22173327.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Restlet Component Fault Handling

2009-02-23 Thread tfredrich

I'm utilizing the Restlet component (via a Trunk build) and am interested in
better understanding error handling behavior via the exchange fault message. 
BTW, I appreciate your work on this component!  Good stuff, indeed.

In essence, I'm simply using camel-restlet to expose a JSON RESTful service
with CRUD behavior.  The route looks something like this:

from(restlet:http://localhost:8080/people/person/{userId}?restletMethod=GET;)
.intercept(new AuthenticationInterceptor())
.process(new QueryStringProcessor())
.process(new GetPersonProcessor())
.marshal(format)
.process(new JsonpProcessor());

Of interest for my question is the GetPersonProcessor, which is responsible
for retrieving the person object from a storage repository.  When a
non-existent userId is requested, the GetPersonProcessor does not return a
person object and, instead sets the restlet response header to 404 (not
found).  After reading the Camel manual, I thought it best to set the 404
along with a fault message on the exchange, but the restlet component
doesn't appear to acknowledge the fault and composes its response from the
out message.  So, unless I misunderstand, I have to set the 404 on the out
message header (for the restlet component) and set the body on the fault
message (for camel to terminate the pipeline).

Now for the question:  Is this the way I should be doing things?  Or
could/should the DefaultRestletBinding utilize the fault message to compose
its response, if a fault message exists?  Your feedback is much appreciated.

Thanks,
--Todd
-- 
View this message in context: 
http://www.nabble.com/Restlet-Component-Fault-Handling-tp22173327p22173327.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.