Hi John, > Using the Restlet API, can an application handle an Exception that > propagates out of the Jakarta Commons HTTP client software? > It doesn't > propagate out of the Restlet API, and I haven't found a way > to get it from > the Restlet objects. I hope you can tell me where to look.
The exceptions are converted into custom statuses. See the Status.CONNECTOR_ERROR_* constants. > An exception is often more useful than a Status. The > exception has a stack > trace and perhaps a chain of causes (nested exceptions), > which often clarify > what happened. You still have the original exception logged by the connector. Just configure the JDK's logging properties to see them (WARNING level). > There was a previous discussion of this: > http://article.gmane.org/gmane.comp.java.restlet/2217 > I would suggest a different approach; that is to contain the > Exception > somewhere within the Response, perhaps as an attribute. For > example, an > application might choose to propagate the exception thus: > > throw (Exception) > response.getAttributes().get("org.restlet.status.exception"); That's a possibility but that would make your code dependent on a specific HTTP client connector. Best regards, Jerome