use of org.apache.cxf.jaxrs.JAXRSServerFactoryBean in project cxf by apache.
the class ClientCacheTest method bind.
@BeforeClass
public static void bind() throws Exception {
final JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(TheServer.class);
sf.setResourceProvider(TheServer.class, new SingletonResourceProvider(new TheServer(), false));
sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
sf.setAddress(ADDRESS);
server = sf.create();
}
use of org.apache.cxf.jaxrs.JAXRSServerFactoryBean in project cxf by apache.
the class RESTLoggingTest method createService.
private Server createService(String serviceURI, Object serviceImpl, LoggingFeature loggingFeature) {
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.setAddress(serviceURI);
factory.setFeatures(Collections.singletonList(loggingFeature));
factory.setServiceBean(serviceImpl);
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
return factory.create();
}
use of org.apache.cxf.jaxrs.JAXRSServerFactoryBean in project cxf by apache.
the class BookKerberosServer method run.
protected void run() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(BookStore.class);
// default lifecycle is per-request, change it to singleton
sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStoreImpl()));
KerberosAuthenticationFilter filter = new KerberosAuthenticationFilter();
filter.setLoginContextName("bob");
filter.setCallbackHandler(getCallbackHandler("bob", "bob"));
// filter.setLoginContextName("KerberosServerKeyTab");
// filter.setServicePrincipalName("HTTP/ktab");
sf.setProvider(filter);
sf.setAddress("http://localhost:" + PORT + "/");
sf.create();
}
use of org.apache.cxf.jaxrs.JAXRSServerFactoryBean in project cxf by apache.
the class CompletableFutureServer method run.
protected void run() {
Bus bus = BusFactory.getDefaultBus();
setBus(bus);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setBus(bus);
sf.setResourceClasses(CompletableFutureService.class);
sf.setResourceProvider(CompletableFutureService.class, new SingletonResourceProvider(new CompletableFutureService(), true));
sf.setAddress("http://localhost:" + PORT + "/");
server = sf.create();
BusFactory.setDefaultBus(null);
BusFactory.setThreadDefaultBus(null);
}
use of org.apache.cxf.jaxrs.JAXRSServerFactoryBean in project cxf by apache.
the class RxJava2ObservableServer method run.
protected void run() {
Bus bus = BusFactory.getDefaultBus();
// Make sure default JSONProvider is not loaded
bus.setProperty("skip.default.json.provider.registration", true);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setInvoker(new ReactiveIOInvoker());
sf.setProvider(new JacksonJsonProvider());
sf.getOutInterceptors().add(new LoggingOutInterceptor());
sf.setResourceClasses(RxJava2ObservableService.class);
sf.setResourceProvider(RxJava2ObservableService.class, new SingletonResourceProvider(new RxJava2ObservableService(), true));
sf.setAddress("http://localhost:" + PORT + "/");
server = sf.create();
}
Aggregations