static ObjectName exportMbean(MBeanServer mbeanServer, ObjectName objectname, Object handler) throws Exception {
String namespace = objectname.getDomain();
if (handler instanceof Context) {
Context ctx = (Context) handler;
objectname = new ObjectName(namespace + ":type=HttpContext" + ", name=[" + ctx.getContextPath() + "]");
for (IHttpRequestHandler hdl : ctx.getHandlers()) {
exportMbean(mbeanServer, objectname, hdl);
}
} else if (handler instanceof RequestHandlerChain) {
RequestHandlerChain chain = (RequestHandlerChain) handler;