Example usage for javax.management RuntimeMBeanException getTargetException

List of usage examples for javax.management RuntimeMBeanException getTargetException

Introduction

In this page you can find the example usage for javax.management RuntimeMBeanException getTargetException.

Prototype

public java.lang.RuntimeException getTargetException() 

Source Link

Document

Returns the actual RuntimeException thrown.

Usage

From source file:com.nesscomputing.jmx.jolokia.JolokiaServlet.java

private void handle(final ServletRequestHandler reqHandler, final HttpServletRequest req,
        final HttpServletResponse resp) throws IOException {
    JSONAware json = null;/*from ww w . j  a  v  a  2  s .c o  m*/
    try {
        // Check access policy
        requestHandler.checkClientIPAccess(req.getRemoteHost(), req.getRemoteAddr());

        // Dispatch for the proper HTTP request method
        json = reqHandler.handleRequest(req, resp);

        if (backendManager.isDebug()) {
            backendManager.debug("Response: " + json);
        }
    } catch (RuntimeMBeanException rme) {
        json = requestHandler.handleThrowable(rme.getTargetException());
    } catch (Throwable exp) {
        json = requestHandler.handleThrowable(exp);
    } finally {
        final String callback = req.getParameter(ConfigKey.CALLBACK.getKeyValue());
        if (callback != null) {
            // Send a JSONP response
            sendResponse(resp, "text/javascript", callback + "(" + json.toJSONString() + ");");
        } else {
            sendResponse(resp, "application/json", json.toJSONString());
        }
    }
}