use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project syncope by apache.
the class SyncopeClientFactoryBean method defaultJsonProvider.
protected JacksonJaxbJsonProvider defaultJsonProvider() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JodaModule());
objectMapper.configure(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
return new JacksonJaxbJsonProvider(objectMapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS);
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project incubator-pulsar by apache.
the class ProxyServer 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 incubator-pulsar by apache.
the class WebService method addRestResources.
public void addRestResources(String basePath, String javaPackages, boolean requiresAuthentication, Map<String, Object> attributeMap) {
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
provider.setMapper(ObjectMapperFactory.create());
ResourceConfig config = new ResourceConfig();
config.packages("jersey.config.server.provider.packages", javaPackages);
config.register(provider);
config.register(MultiPartFeature.class);
ServletHolder servletHolder = new ServletHolder(new ServletContainer(config));
servletHolder.setAsyncSupported(true);
addServlet(basePath, servletHolder, requiresAuthentication, attributeMap);
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project kylo by Teradata.
the class NiFiRestClientV1 method registerClientFeatures.
@Override
protected void registerClientFeatures(Client client) {
JacksonJsonProvider jacksonJsonProvider = new JacksonJaxbJsonProvider().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
client.register(jacksonJsonProvider);
client.register(JacksonFeature.class);
}
use of com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider in project athenz by yahoo.
the class ZMSClient method initClient.
/**
* Initialize the client for class constructors
*
* @param url ZMS Server url
* @param sslContext SSLContext for service authentication
*/
private void initClient(String url, SSLContext sslContext) {
if (url == null) {
zmsUrl = lookupZMSUrl();
} else {
zmsUrl = url;
}
if (zmsUrl != null && !zmsUrl.isEmpty()) {
if (!zmsUrl.endsWith("/zms/v1")) {
if (zmsUrl.charAt(zmsUrl.length() - 1) != '/') {
zmsUrl += '/';
}
zmsUrl += "zms/v1";
}
}
/* determine our read and connect timeouts */
int readTimeout = Integer.parseInt(System.getProperty(ZMS_CLIENT_PROP_READ_TIMEOUT, "30000"));
int connectTimeout = Integer.parseInt(System.getProperty(ZMS_CLIENT_PROP_CONNECT_TIMEOUT, "30000"));
if (sslContext == null) {
sslContext = createSSLContext();
}
ClientBuilder builder = getClientBuilder();
if (sslContext != null) {
builder = builder.sslContext(sslContext);
}
final JacksonJsonProvider jacksonJsonProvider = new JacksonJaxbJsonProvider().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ClientConfig clientConfig = new ClientConfig(jacksonJsonProvider);
clientConfig.connectorProvider(new ApacheConnectorProvider());
// JerseyClientBuilder::withConfig() replaces the existing config with the new client
// config. Hence the client config should be added to the builder before the timeouts.
// Otherwise the timeout settings would be overridden.
Client rsClient = builder.withConfig(clientConfig).connectTimeout(connectTimeout, TimeUnit.MILLISECONDS).readTimeout(readTimeout, TimeUnit.MILLISECONDS).build();
client = new ZMSRDLGeneratedClient(zmsUrl, rsClient);
}
Aggregations