5 Replies Latest reply on Dec 17, 2008 10:17 PM by scottdawson

    re: Error handler to interface with browsers

      I would like to be able to run an application we wrote in different browsers. I would like to support IE7, FireFox, Safari, etc. and would like to come up with generic error messages that would apply to a generic class of errors and exceptions that my application would be able to report to the user. I would like to use the ESB to trap all errors recieved in the browsers used, and give them a generic message that would encompass their errors - so that the error message would be general purpose and describe the exception and corrective action. I think I could do this with a webservice and a Consumer/Producer pair used in samples (Quickstart) as a starting point. I think this is feasible. Please advise. IKoren

        • 1. Re: re: Error handler to interface with browsers
          scottdawson

          IKoren,
          Please explain more about what you are trying to do. It's not clear to me how an ESB, listening to HTTP messages, could be aware of browser-specific errors. Can you describe the sequence of messages that you envision?
          Regards,
          Scott

          • 2. Re: re: Error handler to interface with browsers

            Hi Scott,
            The HTTP messages can report errors in the application as well. In IE for instance, not found is a 400 or 500 code error. I'm not sure of the format, I would have to run an instance of it, but if a page that you're trying to load is not found, than the HTTP error not found is reported as a message. I was trying to envision trapping this error at the listener and transforming this error with an action that would map it to a generic message. If another browser reported a different error, that error would also be trapped, and the same generic code would be substituted(provided the same condition existed). I'm trying to see if this can be done or if I need more software, like Dojo for instance?

            • 3. Re: re: Error handler to interface with browsers
              scottdawson

              IKoren,
              HTTP status codes like 404 "Not found" and 500 "Internal server error" are generated by the web server (Apache, Tomcat, IIS, etc.), not by the browser. (You can see the whole list of HTTP status codes here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)
              IE and Firefox may display very different pages in response to specific error codes, but they are not generating the error codes. So, if you have the ESB sitting between the client (browser) and the web server, it's possible that the ESB could intercept and handle various HTTP responses in an application-specific way, but I still don't understand how the particular browser matters. You can determine the brand of the browser by the User-Agent HTTP header on the request message, if you need to.
              Regards,
              Scott

              • 4. Re: re: Error handler to interface with browsers

                Hi Scott,
                What I'd like the browser(s) to do is display something generic, that would apply to the same information that each browser would display. I would like to use a generic format for all the different browsers that my application runs on. Do you think it makes more sense to use the web server(s) instead of using the browser(s) to trap these errors? I do not know why the requirements are what they are, as I don't make the decisions in my organization. Thank you for your input. I appreciate any comments you may have. It sounds as though the ESB is a bit of an over-kill.
                Regards,
                Iris

                • 5. Re: re: Error handler to interface with browsers
                  scottdawson

                  Iris,
                  I agree -- an ESB is probably not the right tool for what you are trying to accomplish.

                  You didn't say what technology you use for your web application. If it's a typical Java web app (servlet, JSP, warfile) then you can probably do what you want by configuring error-page elements in web.xml. If it's some other technology, then there is probably a similar way to accomplish the same thing, that is, specify a custom page to display for a given HTTP status code.

                  Regards,
                  Scott