Search in sources :

Example 1 with JacksonJaxbJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project microservices by pwillhan.

the class ConsulModule method clientBuilder.

@Provides
@Singleton
public ClientBuilder clientBuilder(ObjectMapper objectMapper) {
    ResteasyClientBuilder builder = new ResteasyClientBuilder();
    builder.connectionPoolSize(20);
    builder.register(new JacksonJaxbJsonProvider(objectMapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS), 100000);
    return builder;
}
Also used : ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) JacksonJaxbJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 2 with JacksonJaxbJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project microservices by pwillhan.

the class ConsulModule method clientBuilder.

@Provides
@Singleton
public ClientBuilder clientBuilder(ObjectMapper objectMapper) {
    ResteasyClientBuilder builder = new ResteasyClientBuilder();
    builder.connectionPoolSize(20);
    builder.register(new JacksonJaxbJsonProvider(objectMapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS), 100000);
    return builder;
}
Also used : ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) JacksonJaxbJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 3 with JacksonJaxbJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project archiva by apache.

the class AbstractArchivaRestTest method getCommonServices.

protected CommonServices getCommonServices(String authzHeader) {
    CommonServices service = JAXRSClientFactory.create(getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", CommonServices.class, Collections.singletonList(new JacksonJaxbJsonProvider()));
    if (authzHeader != null) {
        WebClient.client(service).header("Authorization", authzHeader);
    }
    WebClient.client(service).header("Referer", "http://localhost:" + port);
    WebClient.getConfig(service).getHttpConduit().getClient().setReceiveTimeout(100000000);
    WebClient.client(service).accept(MediaType.APPLICATION_JSON_TYPE);
    WebClient.client(service).type(MediaType.APPLICATION_JSON_TYPE);
    return service;
}
Also used : CommonServices(org.apache.archiva.rest.api.services.CommonServices) JacksonJaxbJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider)

Example 4 with JacksonJaxbJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project archiva by apache.

the class AbstractArchivaRestTest method getProxyConnectorService.

protected ProxyConnectorService getProxyConnectorService() {
    ProxyConnectorService service = JAXRSClientFactory.create(getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", ProxyConnectorService.class, Collections.singletonList(new JacksonJaxbJsonProvider()));
    WebClient.client(service).header("Authorization", authorizationHeader);
    WebClient.client(service).header("Referer", "http://localhost:" + port);
    WebClient.getConfig(service).getHttpConduit().getClient().setReceiveTimeout(300000);
    WebClient.client(service).accept(MediaType.APPLICATION_JSON_TYPE);
    WebClient.client(service).type(MediaType.APPLICATION_JSON_TYPE);
    return service;
}
Also used : ProxyConnectorService(org.apache.archiva.rest.api.services.ProxyConnectorService) JacksonJaxbJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider)

Example 5 with JacksonJaxbJsonProvider

use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project archiva by apache.

the class AbstractArchivaRestTest method getSearchService.

protected SearchService getSearchService(String authzHeader) {
    // START SNIPPET: cxf-searchservice-creation
    SearchService service = JAXRSClientFactory.create(getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", SearchService.class, Collections.singletonList(new JacksonJaxbJsonProvider()));
    // to add authentification
    if (authzHeader != null) {
        WebClient.client(service).header("Authorization", authzHeader);
    }
    // Set the Referer header to your archiva server url
    WebClient.client(service).header("Referer", "http://localhost:" + port);
    // to configure read timeout
    WebClient.getConfig(service).getHttpConduit().getClient().setReceiveTimeout(100000000);
    // if you want to use json as exchange format xml is supported too
    WebClient.client(service).accept(MediaType.APPLICATION_JSON_TYPE);
    WebClient.client(service).type(MediaType.APPLICATION_JSON_TYPE);
    return service;
// END SNIPPET: cxf-searchservice-creation
}
Also used : SearchService(org.apache.archiva.rest.api.services.SearchService) JacksonJaxbJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider)

Aggregations

JacksonJaxbJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider)35 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 URI (java.net.URI)3 Response (javax.ws.rs.core.Response)3 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)2 Provides (com.google.inject.Provides)2 Singleton (com.google.inject.Singleton)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 Annotation (java.lang.annotation.Annotation)2 ElementType (java.lang.annotation.ElementType)2 Retention (java.lang.annotation.Retention)2 RetentionPolicy (java.lang.annotation.RetentionPolicy)2 Target (java.lang.annotation.Target)2 Method (java.lang.reflect.Method)2 Type (java.lang.reflect.Type)2