List of usage examples for com.fasterxml.jackson.databind PropertyNamingStrategy CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES
PropertyNamingStrategy CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES
To view the source code for com.fasterxml.jackson.databind PropertyNamingStrategy CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES.
Click Source Link
From source file:org.springframework.social.facebook.web.SignedRequestDecoder.java
/** * @param secret the application secret used in creating and verifying the signature of the signed request. *///from w ww .j a v a 2 s .c om public SignedRequestDecoder(String secret) { this.secret = secret; this.objectMapper = new ObjectMapper(); this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); this.objectMapper .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); }
From source file:monasca.api.resource.AbstractMonApiResourceTest.java
@Override protected void setupResources() throws Exception { addSingletons(new EntityExistsExceptionMapper(), new EntityNotFoundExceptionMapper(), new IllegalArgumentExceptionMapper(), new InvalidEntityExceptionMapper(), new JsonProcessingExceptionMapper(), new JsonMappingExceptionManager(), new ConstraintViolationExceptionMapper(), new ThrowableExceptionMapper<Throwable>() { });//from ww w. jav a 2 s .c o m objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); objectMapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); }
From source file:monasca.log.api.app.ApplicationModule.java
@Named("objectMapper") @Provides//from w w w.j a va 2 s .com public ObjectMapper objectMapper() { return new ObjectMapper() .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, FAIL_ON_UNKNOWN_PROPERTIES) .configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, ACCEPT_SINGLE_VALUE_AS_ARRAY) .configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, ORDER_MAP_ENTRIES_BY_KEYS) .setTimeZone(TimeZone.getTimeZone(TIME_ZONE_UTC)) .setSerializationInclusion(JsonInclude.Include.NON_NULL); }
From source file:monasca.persister.repository.influxdb.InfluxV9AlarmRepo.java
@Inject public InfluxV9AlarmRepo(final Environment env, final InfluxV9RepoWriter influxV9RepoWriter) { super(env);/*from w w w .ja va 2s . c o m*/ this.influxV9RepoWriter = influxV9RepoWriter; this.objectMapper .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); }
From source file:org.mitre.secretsharing.server.JoinServlet.java
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); resp.setContentType("application/json"); try {/*from w ww . j av a2 s . c om*/ Request jreq = mapper.readValue(req.getParameter("q"), Request.class); if (jreq.parts == null) throw new IllegalArgumentException(); Part[] parts = new Part[jreq.parts.size()]; for (int i = 0; i < parts.length; i++) parts[i] = PartFormats.parse(jreq.parts.get(i)); byte[] secret = parts[0].join(Arrays.copyOfRange(parts, 1, parts.length)); Response jresp = new Response(); jresp.status = "ok"; if (jreq.base64 != null && jreq.base64) jresp.secret = Base64Variants.MIME_NO_LINEFEEDS.encode(secret); else jresp.secret = new String(secret, "UTF-8"); mapper.writeValue(resp.getOutputStream(), jresp); } catch (Throwable t) { t.printStackTrace(); Response jresp = new Response(); jresp.status = "error"; mapper.writeValue(resp.getOutputStream(), jresp); } }
From source file:org.mitre.secretsharing.server.SplitServlet.java
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); resp.setContentType("application/json"); try {// w w w. ja v a 2 s. c o m Request jreq = mapper.readValue(req.getParameter("q"), Request.class); byte[] secret; if (jreq.base64 != null && jreq.base64) secret = Base64Variants.MIME_NO_LINEFEEDS.decode(jreq.secret); else secret = jreq.secret.getBytes("UTF-8"); if (jreq.secret == null || jreq.totalParts == null || jreq.requiredParts == null) throw new IllegalArgumentException(); Part[] parts = Secrets.splitPerByte(secret, jreq.totalParts, jreq.requiredParts, rnd); Response jresp = new Response(); jresp.parts = new ArrayList<String>(); for (Part part : parts) jresp.parts.add(part.toString()); jresp.status = "ok"; mapper.writeValue(resp.getOutputStream(), jresp); } catch (Throwable t) { t.printStackTrace(); Response jresp = new Response(); jresp.status = "error"; mapper.writeValue(resp.getOutputStream(), jresp); } }
From source file:monasca.persister.repository.cassandra.CassandraAlarmRepo.java
@Inject public CassandraAlarmRepo(CassandraCluster cluster, PersisterConfig config, Environment environment) throws NoSuchAlgorithmException, SQLException { super(cluster, environment, config.getCassandraDbConfiguration().getMaxWriteRetries(), config.getAlarmHistoryConfiguration().getBatchSize()); this.retention = config.getCassandraDbConfiguration().getRetentionPolicy() * 24 * 3600; logger.debug("Instantiating " + this.getClass().getName()); this.objectMapper .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); session = cluster.getAlarmsSession(); logger.debug(this.getClass().getName() + " is fully instantiated"); }
From source file:monasca.persister.repository.vertica.VerticaAlarmRepo.java
@Inject public VerticaAlarmRepo(DBI dbi, PersisterConfig configuration, Environment environment) throws NoSuchAlgorithmException, SQLException { super(dbi);// w w w .j a v a 2s. c o m logger.debug("Instantiating " + this.getClass().getName()); this.environment = environment; this.commitTimer = this.environment.metrics().timer(this.getClass().getName() + "." + "commit-timer"); this.objectMapper .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); logger.debug("preparing batches..."); handle.getConnection().setAutoCommit(false); batch = handle.prepareBatch(SQL_INSERT_INTO_ALARM_HISTORY); handle.begin(); simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT-0")); logger.debug(this.getClass().getName() + " is fully instantiated"); }
From source file:com.aerofs.baseline.json.TestJSONHandling.java
@Before public void setup() throws Exception { mapper.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES); server.runWithConfiguration(ServiceConfiguration.TEST_CONFIGURATION); }