use of org.apache.cxf.jaxrs.JAXRSServerFactoryBean in project tomee by apache.
the class CxfRsHttpListener method deploy.
private void deploy(final String contextRoot, final Class<?> clazz, final String address, final ResourceProvider rp, final Object serviceBean, final Application app, final Invoker invoker, final Collection<Object> additionalProviders, final ServiceConfiguration configuration, final WebBeansContext webBeansContext) {
final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(CxfUtil.initBusLoader());
try {
final JAXRSServerFactoryBean factory = newFactory(address, createServiceJmxName(clazz.getClassLoader()), createEndpointName(app));
configureFactory(additionalProviders, configuration, factory, webBeansContext);
factory.setResourceClasses(clazz);
context = contextRoot;
if (context == null) {
context = "";
}
if (!context.startsWith("/")) {
context = "/" + context;
}
if (rp != null) {
factory.setResourceProvider(rp);
}
if (app != null) {
factory.setApplication(app);
}
if (invoker != null) {
factory.setInvoker(invoker);
}
if (serviceBean != null) {
factory.setServiceBean(serviceBean);
} else {
factory.setServiceClass(clazz);
}
server = factory.create();
destination = (HttpDestination) server.getDestination();
fireServerCreated(oldLoader);
} finally {
if (oldLoader != null) {
CxfUtil.clearBusLoader(oldLoader);
}
}
}
use of org.apache.cxf.jaxrs.JAXRSServerFactoryBean in project ddf by codice.
the class TestPlugin method startServer.
private static void startServer() {
LOGGER.info("Starting server.");
endpoint = mock(MockRestEndpoint.class);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(MockRestEndpoint.class);
sf.setAddress(ENDPOINT_ADDRESS);
sf.setResourceProvider(MockRestEndpoint.class, new SingletonResourceProvider(endpoint, true));
LOGGER.info("Creating server.");
server = sf.create();
}
Aggregations