use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project cxf by apache.
the class BookServerWebSocket method run.
protected void run() {
Bus bus = BusFactory.getDefaultBus();
setBus(bus);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setBus(bus);
sf.setResourceClasses(BookStoreWebSocket.class, BookStorePerRequest.class);
sf.setProvider(new StreamingResponseProvider<Book>());
sf.setResourceProvider(BookStoreWebSocket.class, new SingletonResourceProvider(new BookStoreWebSocket(), true));
sf.setAddress("ws://localhost:" + port + "/websocket");
server = sf.create();
BusFactory.setDefaultBus(null);
BusFactory.setThreadDefaultBus(null);
}
use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project cxf by apache.
the class BookServer20 method run.
protected void run() {
Bus bus = BusFactory.getDefaultBus();
setBus(bus);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setBus(bus);
sf.setResourceClasses(BookStore.class);
List<Object> providers = new ArrayList<>();
providers.add(new PreMatchContainerRequestFilter2());
providers.add(new PreMatchContainerRequestFilter());
providers.add(new PostMatchContainerResponseFilter());
providers.add((Feature) context -> {
context.register(new PostMatchContainerResponseFilter3());
return true;
});
providers.add(new PostMatchContainerResponseFilter2());
providers.add(new CustomReaderBoundInterceptor());
providers.add(new CustomReaderInterceptor());
providers.add(new CustomWriterInterceptor());
providers.add(new CustomDynamicFeature());
providers.add(new PostMatchContainerRequestFilter());
providers.add(new FaultyContainerRequestFilter());
providers.add(new PreMatchReplaceStreamOrAddress());
providers.add(new ServerTestFeature());
providers.add(new JacksonJaxbJsonProvider());
providers.add(new IOExceptionMapper());
sf.setApplication(new Application());
sf.setProviders(providers);
sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore(), true));
sf.setAddress("http://localhost:" + PORT + "/");
server = sf.create();
BusFactory.setDefaultBus(null);
BusFactory.setThreadDefaultBus(null);
}
use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project cxf by apache.
the class BookServerAsyncClient method run.
protected void run() {
Bus bus = BusFactory.getDefaultBus();
setBus(bus);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setBus(bus);
sf.setResourceClasses(BookStore.class);
sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore(), true));
sf.setAddress("http://localhost:" + PORT + "/");
sf.setProvider(new BooleanReaderWriter());
sf.getProperties(true).put("default.content.type", "*/*");
server = sf.create();
BusFactory.setDefaultBus(null);
BusFactory.setThreadDefaultBus(null);
}
use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project cxf by apache.
the class BookContinuationServer method run.
protected void run() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(BookContinuationStore.class);
sf.setResourceProvider(BookContinuationStore.class, new SingletonResourceProvider(new BookContinuationStore()));
sf.setAddress("http://localhost:" + PORT + "/");
sf.create();
}
use of org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider in project cxf by apache.
the class BookCxfContinuationServer method run.
protected void run() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(BookCxfContinuationStore.class);
sf.setResourceProvider(BookCxfContinuationStore.class, new SingletonResourceProvider(new BookCxfContinuationStore()));
sf.setAddress("http://localhost:" + PORT + "/");
sf.create();
}
Aggregations