You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Franz Amador <fg...@yahoo.com> on 2008/12/09 20:10:14 UTC
How can my RequestExceptionHandler distinguish event requests from
page requests?
My app responds to Ajax event requests with JSON. If the event handler
throws an exception, I'd like to return a special JSON response with the
error text. Can I decorate RequestExceptionHandler for this? To do so, I'd
need to be able to tell that the request is an Ajax event request; if it
isn't, I'll delegate to the default RequestExceptionHandler. Is there a
service I can use in my RequestExceptionHandler that'll tell me whether the
request is an event request and not, say, a page request?
--
View this message in context: http://n2.nabble.com/How-can-my-RequestExceptionHandler-distinguish-event-requests-from-page-requests--tp1635333p1635333.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How can my RequestExceptionHandler distinguish event requests
from page requests?
Posted by Franz Amador <fg...@yahoo.com>.
Thanks, Peter. I do know about request.isXHR(), but it's actually more important to me to know whether the request is an event request (as opposed to a page request) than if it's an Ajax request. Also, can a service inject the request object?
Franz
________________________________
From: Peter Stavrinides (via Nabble) <ml...@n2.nabble.com>
To: Franz Amador <fg...@yahoo.com>
Sent: Wednesday, December 10, 2008 12:57:15 AM
Subject: Re: How can my RequestExceptionHandler distinguish event requests from page requests?
You can use: request.isXHR() which checks against a header "X-Requested-With" set by the prototype library for AJAX calls. If you write your own AJAX stuff then request.isXHR() probably won't be set so you will have to set it yourself.
Cheers
Peter
--
If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Please visit http://www.albourne.com/email.html for important additional terms relating to this e-mail.
----- Original Message -----
From: "Franz Amador" <fg...@...>
To: users@...
Sent: Tuesday, 9 December, 2008 9:10:14 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: How can my RequestExceptionHandler distinguish event requests from page requests?
My app responds to Ajax event requests with JSON. If the event handler
throws an exception, I'd like to return a special JSON response with the
error text. Can I decorate RequestExceptionHandler for this? To do so, I'd
need to be able to tell that the request is an Ajax event request; if it
isn't, I'll delegate to the default RequestExceptionHandler. Is there a
service I can use in my RequestExceptionHandler that'll tell me whether the
request is an event request and not, say, a page request?
--
View this message in context: http://n2.nabble.com/How-can-my-RequestExceptionHandler-distinguish-event-requests-from-page-requests--tp1635333p1635333.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...
________________________________
This email is a reply to your post @ http://n2.nabble.com/How-can-my-RequestExceptionHandler-distinguish-event-requests-from-page-requests--tp1635333p1637872.html
You can reply by email or by visting the link above.
--
View this message in context: http://n2.nabble.com/How-can-my-RequestExceptionHandler-distinguish-event-requests-from-page-requests--tp1635333p1639644.html
Sent from the Tapestry Users mailing list archive at Nabble.com.