use of org.neo4j.server.rest.domain.JsonParseException in project neo4j by neo4j.
the class JmxService method queryBeans.
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path(QUERY_PATH)
@SuppressWarnings("unchecked")
public Response queryBeans(String query) {
try {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
String json = dodgeStartingUnicodeMarker(query);
Collection<Object> queries = (Collection<Object>) JsonHelper.readJson(json);
ArrayList<JmxMBeanRepresentation> beans = new ArrayList<JmxMBeanRepresentation>();
for (Object queryObj : queries) {
assert queryObj instanceof String;
for (Object objName : server.queryNames(new ObjectName((String) queryObj), null)) {
beans.add(new JmxMBeanRepresentation((ObjectName) objName));
}
}
return output.ok(new ListRepresentation("jmxBean", beans));
} catch (JsonParseException e) {
return output.badRequest(e);
} catch (MalformedObjectNameException e) {
return output.badRequest(e);
}
}
use of org.neo4j.server.rest.domain.JsonParseException in project neo4j by neo4j.
the class RowFormatMetaFieldTest method setUp.
@Before
public void setUp() {
// begin
Response begin = http.POST("/db/data/transaction");
assertThat(begin.status(), equalTo(201));
assertHasTxLocation(begin);
try {
commitResource = begin.stringFromContent("commit");
} catch (JsonParseException e) {
fail("Exception caught when setting up test: " + e.getMessage());
}
assertThat(commitResource, equalTo(begin.location() + "/commit"));
}
Aggregations