use of com.predic8.membrane.core.config.Path in project service-proxy by membrane.
the class SOAPFaultTest method getExchangeCP.
private Exchange getExchangeCP(String path) throws IOException {
Exchange exc = new Exchange(null);
exc.setResponse(Response.ok().contentType("text/xml").body(getClass().getClassLoader().getResourceAsStream(path), true).build());
return exc;
}
use of com.predic8.membrane.core.config.Path in project service-proxy by membrane.
the class HTTP2XMLInterceptorTest method parseXML.
@Test
public void parseXML() throws Exception {
String xml = "<request method='POST' http-version='1.1'><uri value='http://localhost:3011/manager/person?vorname=jim&nachname=panse'><host>localhost</host><port>8080</port><path><component>manager</component><component>person</component></path><query><param name='vorname'>jim</param><param name='nachname'>panse</param></query></uri></request>";
XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
// skip DocumentNode
r.next();
Request req = new Request();
req.parse(r);
assertEquals("POST", req.getMethod());
assertEquals("1.1", req.getHttpVersion());
assertURI(req.getUri());
}
use of com.predic8.membrane.core.config.Path in project service-proxy by membrane.
the class EmbeddingJava method main.
public static void main(String[] args) throws Exception {
String hostname = "*";
String method = "GET";
String path = ".*";
int listenPort = 4000;
ServiceProxyKey key = new ServiceProxyKey(hostname, method, path, listenPort);
String targetHost = "predic8.com";
int targetPort = 80;
ServiceProxy sp = new ServiceProxy(key, targetHost, targetPort);
sp.getInterceptors().add(new AddMyHeaderInterceptor());
HttpRouter router = new HttpRouter();
router.add(sp);
router.init();
}
use of com.predic8.membrane.core.config.Path in project service-proxy by membrane.
the class EtcdBasedConfigurator method setUpModuleServiceProxy.
private ServiceProxy setUpModuleServiceProxy(String name, int port, String path) {
log.info("Creating serviceProxy for module: " + path);
ServiceProxyKey key = new ServiceProxyKey("*", "*", path, port);
key.setUsePathPattern(true);
key.setPathRegExp(false);
ServiceProxy sp = new ServiceProxy(key, null, 0);
sp.getInterceptors().add(new LoadBalancingInterceptor());
try {
sp.init(router);
router.add(sp);
runningServiceProxyForModule.put(path, sp);
} catch (Exception ignored) {
}
return sp;
}
use of com.predic8.membrane.core.config.Path in project service-proxy by membrane.
the class MyApplication method createServiceProxy.
private static ServiceProxy createServiceProxy() {
String hostname = "*";
String method = "*";
String path = ".*";
int listenPort = 8080;
ServiceProxyKey key = new ServiceProxyKey(hostname, method, path, listenPort);
String targetHost = "localhost";
int targetPort = 2001;
return new ServiceProxy(key, targetHost, targetPort);
}
Aggregations