List of usage examples for com.fasterxml.jackson.module.jaxb JaxbAnnotationModule JaxbAnnotationModule
public JaxbAnnotationModule()
From source file:org.springframework.boot.actuate.metrics.ambari.restclient.AsyncAmbariMetricsCollectorRestClient.java
private AsyncRestTemplate createTimelineClient() { MappingJackson2HttpMessageConverter mc = new MappingJackson2HttpMessageConverter(); JaxbAnnotationModule module = new JaxbAnnotationModule(); mc.getObjectMapper().registerModule(module); mc.getObjectMapper().setSerializationInclusion(Include.NON_NULL); AsyncRestTemplate restTemplate = new AsyncRestTemplate(); restTemplate.getMessageConverters().clear(); restTemplate.getMessageConverters().add(mc); SimpleClientHttpRequestFactory requestFactory = (SimpleClientHttpRequestFactory) restTemplate .getAsyncRequestFactory();// ww w .j a v a 2s . c om requestFactory.setReadTimeout(5000); requestFactory.setConnectTimeout(5000); return restTemplate; }
From source file:org.springframework.boot.actuate.metrics.ambari.restclient.SyncAmbariMetricsCollectorRestClient.java
private RestTemplate createTimelineClient() { MappingJackson2HttpMessageConverter mc = new MappingJackson2HttpMessageConverter(); JaxbAnnotationModule module = new JaxbAnnotationModule(); mc.getObjectMapper().registerModule(module); mc.getObjectMapper().setSerializationInclusion(Include.NON_NULL); RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().clear(); restTemplate.getMessageConverters().add(mc); SimpleClientHttpRequestFactory requestFactory = (SimpleClientHttpRequestFactory) restTemplate .getRequestFactory();//from w ww . ja v a 2 s . c o m requestFactory.setReadTimeout(2000); requestFactory.setConnectTimeout(2000); return restTemplate; }
From source file:com.codeveo.lago.bot.stomp.client.AbstractHttpLagoBot.java
protected AbstractHttpLagoBot() { objectMapper = new ObjectMapper(); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); /* jaxb only */ JaxbAnnotationModule module = new JaxbAnnotationModule(); objectMapper.registerModule(module); taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setMaxPoolSize(THREAD_POOL_SIZE); taskExecutor.initialize();/* w ww . j a v a 2 s . c o m*/ WebSocketContainer webSocketContainer = ContainerProvider.getWebSocketContainer(); webSocketContainer.setDefaultMaxSessionIdleTimeout(CLIENT_MAX_IDLE_TIMEOUT); webSocketClient = new StandardWebSocketClient(webSocketContainer); webSocketClient.setTaskExecutor(taskExecutor); }
From source file:org.jahia.tools.maven.plugins.LegalArtifactAggregator.java
LegalArtifactAggregator(File scanDirectory, File outputDirectory, RepositorySystem repositorySystem, RepositorySystemSession repositorySystemSession, List<RemoteRepository> remoteRepositories, ScmManager scmManager, boolean verbose, boolean outputDiagnostics) { this.scanDirectory = scanDirectory; this.outputDirectory = outputDirectory; this.repositorySystem = repositorySystem; this.repositorySystemSession = repositorySystemSession; this.remoteRepositories = remoteRepositories; this.scmManager = scmManager; this.verbose = verbose; this.outputDiagnostics = outputDiagnostics; forbiddenKeyWords.add("gpl"); JaxbAnnotationModule jaxbAnnotationModule = new JaxbAnnotationModule(); // configure as necessary mapper.registerModule(jaxbAnnotationModule); mapper.enable(SerializationFeature.INDENT_OUTPUT); loadKnownLicenses();// www .j av a2 s.c om }
From source file:com.cnksi.core.tools.mapper.JsonMapper.java
/** * ?JaxbAnnotationPOJOannotation?Jackson? * jaxbannotation??jackson//www .j av a 2 s . c om */ public void enableJaxbAnnotation() { JaxbAnnotationModule module = new JaxbAnnotationModule(); mapper.registerModule(module); }
From source file:cn.cdwx.jpa.utils.mapper.JsonMapper.java
/** * ?JaxbAnnotationPOJOannotation?Jackson? jaxbannotation??jackson *//* ww w . jav a 2 s .c om*/ public void enableJaxbAnnotation() { JaxbAnnotationModule module = new JaxbAnnotationModule(); mapper.registerModule(module); }
From source file:com.crazy.pss.common.mapper.JsonMapper.java
/** * ?JaxbAnnotationPOJOannotation?Jackson? * jaxbannotation??jackson//from ww w .j a va 2s .c o m */ public JsonMapper enableJaxbAnnotation() { JaxbAnnotationModule module = new JaxbAnnotationModule(); mapper.registerModule(module); return this; }
From source file:$.JsonMapper.java
/** * ?JaxbAnnotationPOJOannotation?Jackson? * jaxbannotation??jackson/*from w ww . j a va 2s . c o m*/ */ public void enableJaxbAnnotation() { JaxbAnnotationModule module = new JaxbAnnotationModule(); mapper.registerModule(module); }
From source file:com.lcw.one.common.mapper.JsonMapper.java
/** * ?JaxbAnnotationPOJOannotation?Jackson? * jaxbannotation??jackson//from ww w . j a v a 2s .com */ public JsonMapper enableJaxbAnnotation() { JaxbAnnotationModule module = new JaxbAnnotationModule(); this.registerModule(module); return this; }
From source file:com.griddynamics.deming.ecommerce.api.endpoint.catalog.CatalogManagerEndpoint.java
@POST @Path("import") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response importCatalog(@FormDataParam("file") InputStream uploadInputStream) throws ServiceException, IOException { removeCatalog();// ww w. java 2s . c o m try { ZipInputStream inputStream = new ZipInputStream(uploadInputStream); try { byte[] buf = new byte[1024]; for (ZipEntry entry = inputStream.getNextEntry(); entry != null; entry = inputStream .getNextEntry()) { try { String entryName = entry.getName(); entryName = entryName.replace('/', File.separatorChar); entryName = entryName.replace('\\', File.separatorChar); LOGGER.debug("Entry name: {}", entryName); if (entry.isDirectory()) { LOGGER.debug("Entry ({}) is directory", entryName); } else if (PRODUCT_CATALOG_FILE.equals(entryName)) { ByteArrayOutputStream jsonBytes = new ByteArrayOutputStream(1024); for (int n = inputStream.read(buf, 0, 1024); n > -1; n = inputStream.read(buf, 0, 1024)) { jsonBytes.write(buf, 0, n); } byte[] bytes = jsonBytes.toByteArray(); ObjectMapper mapper = new ObjectMapper(); JaxbAnnotationModule jaxbAnnotationModule = new JaxbAnnotationModule(); mapper.registerModule(jaxbAnnotationModule); ImportCategoryWrapper catalog = mapper.readValue(bytes, ImportCategoryWrapper.class); escape(catalog); saveCategoryTree(catalog); } else { MultipartFile file = new MultipartFileAdapter(inputStream, entryName); dmgStaticAssetStorageService.createStaticAssetStorageFromFile(file); } } finally { inputStream.closeEntry(); } } } finally { inputStream.close(); } } catch (IOException e) { return Response.status(Response.Status.BAD_REQUEST).entity("Unable load catalog.\n").build(); } Thread rebuildSearchIndex = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(10000); searchService.rebuildIndex(); } catch (Exception e) { /* nothing */} } }); rebuildSearchIndex.start(); return Response.status(Response.Status.OK).entity("Catalog was imported successfully!\n").build(); }