use of org.apache.cxf.transport.common.gzip.GZIPOutInterceptor in project cxf by apache.
the class Server method run.
protected void run() {
URL url = getClass().getResource("fault-stack-trace.xml");
if (url != null) {
System.setProperty("cxf.config.file.url", url.toString());
}
Object implementor;
String address;
implementor = new AsyncGreeter();
address = "http://localhost:" + PORT + "/SoapContext/AsyncSoapPort";
eps.add(Endpoint.publish(address, implementor));
implementor = new AsyncEchoProvider();
address = "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider";
eps.add(Endpoint.publish(address, implementor));
implementor = new GreeterImplMultiPort();
address = "http://localhost:" + PORT + "/MultiPort/GreeterPort";
eps.add(Endpoint.publish(address, implementor));
implementor = new DocLitBareGreeterMultiPort();
address = "http://localhost:" + PORT + "/MultiPort/DocBarePort";
eps.add(Endpoint.publish(address, implementor));
implementor = new GreeterImpl();
address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
Endpoint ep = Endpoint.publish(address, implementor);
eps.add(ep);
implementor = new GreeterImpl();
address = "http://localhost:" + PORT + "/SoapContext/SoapPortWithGzip";
Endpoint ep2 = Endpoint.publish(address, implementor);
((EndpointImpl) ep2).getService().getInInterceptors().add(new GZIPInInterceptor());
((EndpointImpl) ep2).getService().getOutInterceptors().add(new GZIPOutInterceptor());
eps.add(ep2);
implementor = new RefGreeterImpl();
address = "http://localhost:" + PORT + "/SoapContext/SoapPort2";
eps.add(Endpoint.publish(address, implementor));
// publish port with soap12 binding
address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
EndpointImpl e = (EndpointImpl) Endpoint.create(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING, new Greeter12Impl());
e.publish(address);
eps.add(e);
implementor = new DocLitBareGreeterImpl();
address = "http://localhost:" + BARE_PORT + "/SoapContext/SoapPort";
eps.add(Endpoint.publish(address, implementor));
implementor = new GreeterImplBogus();
address = "http://localhost:" + BOGUS_REAL_PORT + "/SoapContext/SoapPort";
eps.add(Endpoint.publish(address, implementor));
}
use of org.apache.cxf.transport.common.gzip.GZIPOutInterceptor in project cxf by apache.
the class DirectDispatchClientTest method invokeService.
private void invokeService(boolean isDirectDispatch) {
BusFactory.setThreadDefaultBus(staticBus);
Service service = Service.create(serviceName);
service.addPort(localPortName, "http://schemas.xmlsoap.org/soap/", "local://Greeter");
Greeter greeter = service.getPort(localPortName, Greeter.class);
if (isDirectDispatch) {
Client client = ClientProxy.getClient(greeter);
client.getOutInterceptors().add(new GZIPOutInterceptor(50));
client.getInInterceptors().add(new GZIPInInterceptor());
InvocationHandler handler = Proxy.getInvocationHandler(greeter);
BindingProvider bp = null;
if (handler instanceof BindingProvider) {
bp = (BindingProvider) handler;
Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(LocalConduit.DIRECT_DISPATCH, true);
}
}
String reply = greeter.greetMe("test");
assertEquals("Hello test", reply);
reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals("Bonjour", reply);
}
Aggregations