use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project cxf by apache.
the class JAXRS20ClientServerBookTest method testPostGetCollectionGenericEntityAndTypeJson.
@Test
public void testPostGetCollectionGenericEntityAndTypeJson() throws Exception {
String endpointAddress = "http://localhost:" + PORT + "/bookstore/collections";
WebClient wc = WebClient.create(endpointAddress, Collections.singletonList(new JacksonJaxbJsonProvider()));
doTestPostGetCollectionGenericEntityAndType(wc, MediaType.APPLICATION_JSON_TYPE);
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project cxf by apache.
the class BookServer20 method createServer.
@Override
protected Server createServer(Bus bus) throws Exception {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
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());
providers.add(new GregorianCalendarMessageBodyWriter());
sf.setApplication(new Application());
sf.setProviders(providers);
sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore(), true));
sf.setAddress("http://localhost:" + PORT + "/");
return sf.create();
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project cxf by apache.
the class JAXRSMultipartLocalTransportTest method testBookAsMultipleInputStreams.
@Test
public void testBookAsMultipleInputStreams() throws Exception {
final MultipartStore store = JAXRSClientFactory.create(ENDPOINT_ADDRESS, MultipartStore.class, Collections.singletonList(new JacksonJaxbJsonProvider()));
final byte[] books1 = generateBooks(40000).getBytes(StandardCharsets.UTF_8);
final byte[] books2 = generateBooks(2000).getBytes(StandardCharsets.UTF_8);
final List<Book> books = store.addBookJsonTypeFromStreams(new ByteArrayInputStream(books1), new ByteArrayInputStream(books2));
assertThat(books.size(), equalTo(42000));
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project incubator-pulsar by apache.
the class WebServer method addRestResources.
public void addRestResources(String basePath, String javaPackages, String attribute, Object attributeValue) {
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
provider.setMapper(ObjectMapperFactory.create());
ResourceConfig config = new ResourceConfig();
config.packages("jersey.config.server.provider.packages", javaPackages);
config.register(provider);
ServletHolder servletHolder = new ServletHolder(new ServletContainer(config));
servletHolder.setAsyncSupported(true);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath(basePath);
context.addServlet(servletHolder, "/*");
context.setAttribute(attribute, attributeValue);
handlers.add(context);
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project fabric8 by fabric8io.
the class WebClients method createProviders.
public static List<Object> createProviders() {
List<Object> providers = new ArrayList<Object>();
Annotations[] annotationsToUse = JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS;
ObjectMapper objectMapper = createObjectMapper();
providers.add(new JacksonJaxbJsonProvider(objectMapper, annotationsToUse));
providers.add(new ExceptionResponseMapper());
return providers;
}
Aggregations