public void testRestURLPostfix3() throws Exception { API api = new API(TEST_API, "/services/Foo"); SynapseConfiguration synapseConfig = new SynapseConfiguration(); synapseConfig.addAPI(TEST_API, api); RESTRequestHandler handler = new RESTRequestHandler(); MessageContext synCtx = getMessageContext(synapseConfig, false, "/services/Foo/test", "GET"); // When the service path is in the URL, NHTTP transport removes that portion // from the postfix ((Axis2MessageContext) synCtx) .getAxis2MessageContext() .setProperty(NhttpConstants.REST_URL_POSTFIX, "/test"); handler.process(synCtx); checkRestURLPostfix(synCtx, "/test"); }
public void testRestURLPostfix2() throws Exception { API api = new API(TEST_API, "/"); SynapseConfiguration synapseConfig = new SynapseConfiguration(); synapseConfig.addAPI(TEST_API, api); RESTRequestHandler handler = new RESTRequestHandler(); MessageContext synCtx = getMessageContext(synapseConfig, false, "/test", "GET"); handler.process(synCtx); checkRestURLPostfix(synCtx, "/test"); synCtx = getMessageContext(synapseConfig, false, "/test/me/now", "GET"); handler.process(synCtx); checkRestURLPostfix(synCtx, "/test/me/now"); synCtx = getMessageContext(synapseConfig, false, "/test?a=5", "GET"); handler.process(synCtx); checkRestURLPostfix(synCtx, "/test?a=5"); }
public void testRestURLPostfix1() throws Exception { API api = new API(TEST_API, "/test"); SynapseConfiguration synapseConfig = new SynapseConfiguration(); synapseConfig.addAPI(TEST_API, api); RESTRequestHandler handler = new RESTRequestHandler(); MessageContext synCtx = getMessageContext(synapseConfig, false, "/test", "GET"); handler.process(synCtx); checkRestURLPostfix(synCtx, ""); synCtx = getMessageContext(synapseConfig, false, "/test/me/now", "GET"); handler.process(synCtx); checkRestURLPostfix(synCtx, "/me/now"); synCtx = getMessageContext(synapseConfig, false, "/test?a=5", "GET"); handler.process(synCtx); checkRestURLPostfix(synCtx, "?a=5"); api.setVersionStrategy(new URLBasedVersionStrategy(api, "1.0.0", null)); synCtx = getMessageContext(synapseConfig, false, "/test/1.0.0?a=5", "GET"); handler.process(synCtx); checkRestURLPostfix(synCtx, "?a=5"); synCtx = getMessageContext(synapseConfig, false, "/test/1.0.0/foo?a=5", "GET"); handler.process(synCtx); checkRestURLPostfix(synCtx, "/foo?a=5"); }