code: @GET
      @Path("/mbeans")
      public Response getMBeansByRegex(
              @QueryParam("objNameRegex") String objNameRegex,
              @QueryParam("jsonp") @DefaultValue("") String jsonp) {
          try {
              ObjectName objNameForRegex = new ObjectName(objNameRegex);
              MBeanServer mBeanServer = ManagementFactory
                      .getPlatformMBeanServer();
              Set<ObjectName> objs = mBeanServer
                      .queryNames(objNameForRegex, null);
              JSONObject result = new JSONObject();
              for (ObjectName objName : objs) {
                  JSONObject json = new JSONObject();
                  try {
                      json.put("attributes", emitAttributes(objName));
                  } catch (Exception e) {
                      json.put("attributes", emitAttributes(objName));
                  }
                  json.put("operations", emitOperations(objName));
                  result.put(objName.getCanonicalName(), json);
              }
              StringWriter out = new StringWriter();
              if (jsonp.isEmpty()) {
                  result.write(out);
              } else {
                  out.append(jsonp).append("(");
                  result.write(out);
                  out.append(");");
              }
              return Response.ok(out.toString()).type(MediaType.APPLICATION_JSON)
                      .build();
          } catch (Exception e) {
              LOG.error(
                      "Error while retrieving mbeans for regex:" + objNameRegex,
                      e);
              return Response.serverError().entity(e.getMessage()).build();
          }
      }
docs: Return all the attributes and operations for a MBeans whose
  {@link ObjectName}s match the passed in regex.
  
  @param objNameRegex
  regex for {@link ObjectName} of MBean(s). The
  {@link ObjectName} documentation explains what kinds of regex
  expressions are valid
  @param jsonp
  if non-empty, Jsonp output is returned instead of Json