HttpRequestHandler { public JSONAware handleGetRequest(String pUri, String pPathInfo, Map<String, String[]> pParameterMap) { String pathInfo = extractPathInfo(pUri, pPathInfo); JmxRequest jmxReq = JmxRequestFactory.createGetRequest(pathInfo,getProcessingParameter(pParameterMap)); if (backendManager.isDebug()) { logHandler.debug("URI: " + pUri); logHandler.debug("Path-Info: " + pathInfo); logHandler.debug("Request: " + jmxReq.toString()); } return executeRequest(jmxReq); } HttpRequestHandler(Configuration pConfig, BackendManager pBackendManager, LogHandler pLogHandler); JSONAware handleGetRequest(String pUri, String pPathInfo, Map<String, String[]> pParameterMap); JSONAware handlePostRequest(String pUri, InputStream pInputStream, String pEncoding, Map<String, String[]>  pParameterMap); Map<String, String> handleCorsPreflightRequest(String pOrigin, String pRequestHeaders); JSONObject handleThrowable(Throwable pThrowable); JSONObject getErrorJSON(int pErrorCode, Throwable pExp, JmxRequest pJmxReq); void checkAccess(String pHost, String pAddress, String pOrigin); String extractCorsOrigin(String pOrigin);  }
@Test public void get() throws InstanceNotFoundException, IOException, ReflectionException, AttributeNotFoundException, MBeanException { JSONObject resp = new JSONObject(); expect(backend.handleRequest(isA(JmxReadRequest.class))).andReturn(resp); replay(backend); JSONObject response = (JSONObject) handler.handleGetRequest("/jolokia", HttpTestUtil.HEAP_MEMORY_GET_REQUEST, null); assertTrue(response == resp); }
@Test public void getWithDoubleSlashes() throws MBeanException, AttributeNotFoundException, ReflectionException, InstanceNotFoundException, IOException { JSONObject resp = new JSONObject(); expect(backend.handleRequest(eqReadRequest("read", "bla:type=s/lash/", "attribute"))).andReturn(resp); replay(backend); JSONObject response = (JSONObject) handler.handleGetRequest("/read/bla%3Atype%3Ds!/lash! "/read/bla:type=s!/lash!/Ok",null); assertTrue(response == resp); }