[Off Topic] Where to stuff java server-side error message in Response for flex FaultEvent to have access to it?
I posted to this to the Flex forums, but didn't get a response, but since I'm using Robot Legs and see how smart you guys are, I'd be curious on your solutions to this. I apologize for posting this sort of question to this list, and if it's totally inappropriate feel free to remove it.
We have a simple Java midtier that returns xml via Flex HttpService calls (not relying on BlazeDS.)
In the midtier any internal exceptions thrown are captured by an exception handler and I can do whatever I want before sending back the Response.
When certain errors occur on the server-side I wrap my custom error message and any exception in some xml error/message tags.
What I was hoping I could do, is have all my flex service classes extend from a BaseService which has a generic faultHandler(fault:FaultEvent) implementation that can then popup the error message returned somewhere in the HttpResponse.
The issue I have is where should I stuff my custom server side error message? Once I set the response to 500 on the server side, it doesn't look like I have access to any returned body in the response sent back, so where should my returned error message be stuffed? I suppose I could stuff it into a custom response header? Is a custom header an ok approach for what I'm trying to achieve?
Right now I'm doing this sort of thing in my http service handlers, but I'd like to remove the "error" in XML check and just use a default faultHandler to process any error message (which requires me to force an error code into the response which isn't a problem.)
protected function handleRetrievedReportForNew(event:ResultEvent):void {
var xml:XML = event.result as XML;
if ("error" in xml) {
dispatch(new NotificationEvent(NotificationEvent.DISPLAY_ERROR_NOTIFICATION, "Report Retrieval Error",
"Error trying to retrieve report", xml.error[0].toString()));
} else {
jobsModel.populateForNew(xml);
}
}
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Stray closed this discussion on Feb 12, 2011 @ 01:06 AM.