use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class JaxWsServerFactoryBean method create.
public Server create() {
ClassLoaderHolder orig = null;
try {
if (bus != null) {
ClassLoader loader = bus.getExtension(ClassLoader.class);
if (loader != null) {
orig = ClassLoaderUtils.setThreadContextClassloader(loader);
}
}
Server server = super.create();
initializeResourcesAndHandlerChain(server);
checkPrivateEndpoint(server.getEndpoint());
return server;
} finally {
if (orig != null) {
orig.reset();
}
}
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class NamespaceConfusionTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
Server s = createService(NameServiceImpl.class);
service = s.getEndpoint().getService();
databinding = (AegisDatabinding) service.getDataBinding();
tm = databinding.getAegisContext().getTypeMapping();
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class ExplicitPrefixTest method setupService.
private ServiceAndMapping setupService(Class<?> seiClass, Map<String, String> namespaces) {
AegisDatabinding db = new AegisDatabinding();
db.setNamespaceMap(namespaces);
Server s = createService(seiClass, null, db);
ServiceAndMapping serviceAndMapping = new ServiceAndMapping();
serviceAndMapping.setServer(s);
serviceAndMapping.setService(s.getEndpoint().getService());
serviceAndMapping.setTypeMapping((TypeMapping) serviceAndMapping.getService().get(TypeMapping.class.getName()));
return serviceAndMapping;
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class JAXRSUtilsTest method testInjectApplicationInPerRequestResource.
@Test
public void testInjectApplicationInPerRequestResource() throws Exception {
CustomerApplication app = new CustomerApplication();
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setServiceClass(Customer.class);
sf.setApplication(app);
sf.setStart(false);
Server server = sf.create();
@SuppressWarnings("unchecked") ThreadLocalProxy<UriInfo> proxy = (ThreadLocalProxy<UriInfo>) app.getUriInfo();
assertNotNull(proxy);
ClassResourceInfo cri = sf.getServiceFactory().getClassResourceInfo().get(0);
Customer customer = (Customer) cri.getResourceProvider().getInstance(createMessage());
assertNull(customer.getApplication1());
assertNull(customer.getApplication2());
invokeCustomerMethod(cri, customer, server);
assertSame(app, customer.getApplication1());
assertSame(app, customer.getApplication2());
assertTrue(proxy.get() instanceof UriInfo);
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class RESTLoggingTest method testNonBinary.
@Test
public void testNonBinary() throws IOException, InterruptedException {
LoggingFeature loggingFeature = new LoggingFeature();
TestEventSender sender = new TestEventSender();
loggingFeature.setSender(sender);
Server server = createService(SERVICE_URI_BINARY, new TestServiceRestBinary(), loggingFeature);
server.start();
WebClient client = createClient(SERVICE_URI_BINARY, loggingFeature);
client.get(InputStream.class).close();
client.close();
List<LogEvent> events = sender.getEvents();
await().until(() -> events.size(), is(4));
server.stop();
server.destroy();
Assert.assertEquals(4, events.size());
assertContentLogged(events.get(0));
assertContentLogged(events.get(1));
assertContentNotLogged(events.get(2));
assertContentNotLogged(events.get(3));
}
Aggregations