use of org.apache.cxf.transport.common.gzip.GZIPFeature in project jbossws-cxf by jbossws.
the class Helper method testGZIPUsingFeatureOnBus.
public boolean testGZIPUsingFeatureOnBus() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
GZIPFeature gzipFeature = new GZIPFeature();
gzipFeature.setThreshold(0);
gzipFeature.initialize(bus);
HelloWorld port = getPort();
return ("foo".equals(port.echo("foo")));
} finally {
bus.shutdown(true);
}
}
use of org.apache.cxf.transport.common.gzip.GZIPFeature in project jbossws-cxf by jbossws.
the class Helper method testGZIPUsingFeatureOnClient.
public boolean testGZIPUsingFeatureOnClient() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
// CXF way
BusFactory.setThreadDefaultBus(bus);
HelloWorld port = getPort();
Client client = ClientProxy.getClient(port);
GZIPFeature gzipFeature = new GZIPFeature();
gzipFeature.setThreshold(0);
// bus parameter not actually used
gzipFeature.initialize(client, null);
if (!"foo".equals(port.echo("foo"))) {
return false;
}
} finally {
bus.shutdown(true);
}
bus = BusFactory.newInstance().createBus();
try {
// JAX-WS way
BusFactory.setThreadDefaultBus(bus);
GZIPFeature gzipFeature = new GZIPFeature();
gzipFeature.setThreshold(0);
HelloWorld port = getPort(gzipFeature);
if (!"foo".equals(port.echo("foo"))) {
return false;
}
} finally {
bus.shutdown(true);
}
return true;
}
use of org.apache.cxf.transport.common.gzip.GZIPFeature in project cxf by apache.
the class AnnotationsFactoryBeanListener method addGZipSupport.
private void addGZipSupport(Endpoint ep, Bus bus, GZIP annotation) {
if (annotation != null) {
try {
GZIPFeature feature = new GZIPFeature();
feature.setThreshold(annotation.threshold());
feature.setForce(annotation.force());
feature.initialize(ep, bus);
} catch (Exception e) {
// ignore - just assume it's an unsupported/unknown annotation
}
}
}
use of org.apache.cxf.transport.common.gzip.GZIPFeature in project cxf by apache.
the class SoapJmsSpecTest method startServers.
@BeforeClass
public static void startServers() throws Exception {
startBusAndJMS(SoapJmsSpecTest.class);
publish("jms:queue:test.cxf.jmstransport.queue2", new GreeterSpecImpl());
publish("jms:queue:test.cxf.jmstransport.queue5", new GreeterSpecWithPortError());
EndpointImpl ep = (EndpointImpl) Endpoint.create(null, new GreeterSpecImpl());
ep.setBus(bus);
ep.getFeatures().add(new GZIPFeature());
ep.getFeatures().add(cff);
ep.publish("jms:queue:test.cxf.jmstransport.queue6");
}
use of org.apache.cxf.transport.common.gzip.GZIPFeature in project cxf by apache.
the class SoapJmsSpecTest method testGzip.
@Test
public void testGzip() throws Exception {
URL wsdl = getWSDLURL(WSDL);
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setBus(bus);
factory.setServiceClass(JMSGreeterPortType.class);
factory.setWsdlURL(wsdl.toExternalForm());
factory.getFeatures().add(cff);
factory.getFeatures().add(new GZIPFeature());
factory.setAddress("jms:queue:test.cxf.jmstransport.queue6");
JMSGreeterPortType greeter = (JMSGreeterPortType) markForClose(factory.create());
for (int idx = 0; idx < 5; idx++) {
greeter.greetMeOneWay("test String");
String greeting = greeter.greetMe("Milestone-" + idx);
Assert.assertEquals("Hello Milestone-" + idx, greeting);
String reply = greeter.sayHi();
Assert.assertEquals("Bonjour", reply);
}
}
Aggregations