本文整理汇总了Java中com.fasterxml.jackson.databind.util.ISO8601DateFormat类的典型用法代码示例。如果您正苦于以下问题:Java ISO8601DateFormat类的具体用法?Java ISO8601DateFormat怎么用?Java ISO8601DateFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ISO8601DateFormat类属于com.fasterxml.jackson.databind.util包,在下文中一共展示了ISO8601DateFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: patch
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
private <T> T patch(UriTemplate template, Object body, final Class<T> modelClass)
throws IOException, InterruptedException {
HttpURLConnection connection = (HttpURLConnection) new URL(template.expand()).openConnection();
withAuthentication(connection);
setRequestMethodViaJreBugWorkaround(connection, "PATCH");
byte[] bytes;
if (body != null) {
bytes = mapper.writer(new ISO8601DateFormat()).writeValueAsBytes(body);
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
connection.setDoOutput(true);
} else {
bytes = null;
connection.setDoOutput(false);
}
connection.setDoInput(true);
try {
connection.connect();
if (bytes != null) {
try (OutputStream os = connection.getOutputStream()) {
os.write(bytes);
}
}
int status = connection.getResponseCode();
if (status / 100 == 2) {
if (Void.class.equals(modelClass)) {
return null;
}
try (InputStream is = connection.getInputStream()) {
return mapper.readerFor(modelClass).readValue(is);
}
}
throw new IOException("HTTP " + status + "/" + connection.getResponseMessage());
} finally {
connection.disconnect();
}
}
示例2: run
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Override
public final void run(MatchingServiceAdapterConfiguration configuration, Environment environment) {
IdaSamlBootstrap.bootstrap();
environment.getObjectMapper().setDateFormat(new ISO8601DateFormat());
environment.jersey().register(LocalMetadataResource.class);
environment.jersey().register(MatchingServiceResource.class);
environment.jersey().register(UnknownUserAttributeQueryResource.class);
environment.jersey().register(SamlOverSoapExceptionMapper.class);
environment.jersey().register(ExceptionExceptionMapper.class);
MatchingServiceAdapterHealthCheck healthCheck = new MatchingServiceAdapterHealthCheck();
environment.healthChecks().register(healthCheck.getName(), healthCheck);
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:17,代码来源:MatchingServiceAdapterApplication.java
示例3: CreateCerberusBackupOperation
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Inject
public CreateCerberusBackupOperation(CerberusAdminClientFactory cerberusAdminClientFactory,
ConfigStore configStore,
MetricsService metricsService,
EnvironmentMetadata environmentMetadata) {
objectMapper = new ObjectMapper();
objectMapper.findAndRegisterModules();
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
objectMapper.enable(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS);
objectMapper.setDateFormat(new ISO8601DateFormat());
this.configStore = configStore;
this.metricsService = metricsService;
this.environmentMetadata = environmentMetadata;
cerberusAdminClient = cerberusAdminClientFactory.createCerberusAdminClient(
configStore.getCerberusBaseUrl());
}
示例4: testGenerateRequest
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Test
public void testGenerateRequest() throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.findAndRegisterModules();
objectMapper.setDateFormat(new ISO8601DateFormat());
BausparBerechnungsAnfrage berechnungsdaten = new BausparBerechnungsAnfrage();
berechnungsdaten.setBausparsummeInEuro(new BigDecimal("100000"));
berechnungsdaten.setBerechnungsZiel(BerechnungsZiel.SPARBEITRAG);
SparBeitrag sparBeitrag = new SparBeitrag();
sparBeitrag.setBeitrag(new BigDecimal("100"));
sparBeitrag.setZahlungAb(LocalDate.now());
sparBeitrag.setZahlungBis(LocalDate.now().plusYears(10));
sparBeitrag.setZahlungsrhythmus(Zahlungsrhythmus.MONATLICH);
berechnungsdaten.setSparBeitraege(asList(sparBeitrag));
System.out.println(objectMapper.writeValueAsString(berechnungsdaten));
}
开发者ID:hypoport,项目名称:europace-bauspar-schnittstelle,代码行数:21,代码来源:BausparBerechnungControllerTest.java
示例5: parseResponse
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
private List<Drop> parseResponse(String responseBody) {
try {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setDateFormat(new ISO8601DateFormat());
ArrayNode eventNodes = (ArrayNode) objectMapper.readTree(responseBody);
List<Drop> drops = new ArrayList<>();
for (JsonNode eventNode : eventNodes) {
String type = eventNode.get("type").asText();
if ("PushEvent".equals(type)) {
parsePushEvent(eventNode, objectMapper)
.forEach(drops::add);
}
}
return drops;
}
catch (IOException e) {
throw new RuntimeException("could not parse github api result: " + responseBody, e);
}
}
示例6: test_
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
public void test_() throws Exception {
JSONSerializer ser = new JSONSerializer(new SerializeConfig());
ser.setDateFormat(new ISO8601DateFormat());
Assert.assertEquals(null, ser.getDateFormatPattern());
ser.close();
}
示例7: RestObjectMapper
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
private RestObjectMapper() {
// swagger中要求date使用ISO8601格式传递,这里与之做了功能绑定,这在cse中是没有问题的
setDateFormat(new ISO8601DateFormat());
getFactory().disable(Feature.AUTO_CLOSE_SOURCE);
disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
}
示例8: run
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Override
public final void run(StubEventSinkConfiguration configuration, Environment environment) {
environment.getObjectMapper().setDateFormat(new ISO8601DateFormat());
StubEventSinkHealthCheck healthCheck = new StubEventSinkHealthCheck();
environment.healthChecks().register(healthCheck.getName(), healthCheck);
environment.jersey().register(EventSinkHubEventResource.class);
environment.jersey().register(EventSinkHubEventTestResource.class);
}
示例9: run
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Override
public void run(PolicyConfiguration configuration, Environment environment) throws Exception {
environment.getObjectMapper().setDateFormat(new ISO8601DateFormat());
registerResources(configuration, environment);
registerExceptionMappers(environment);
environment.jersey().register(SessionIdPathParamLoggingFilter.class);
}
示例10: run
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Override
public final void run(SamlEngineConfiguration configuration, Environment environment) {
IdaSamlBootstrap.bootstrap();
environment.getObjectMapper().registerModule(new GuavaModule());
environment.getObjectMapper().setDateFormat(new ISO8601DateFormat());
// register resources
registerResources(environment, configuration);
// register exception mappers
environment.jersey().register(SamlEngineExceptionMapper.class);
environment.servlets().addFilter("Logging SessionId registration Filter", SessionIdQueryParamLoggingFilter.class).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}
示例11: run
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Override
public void run(SamlSoapProxyConfiguration configuration, Environment environment) throws Exception {
IdaSamlBootstrap.bootstrap();
environment.getObjectMapper().setDateFormat(new ISO8601DateFormat());
registerResources(environment);
environment.servlets().addFilter("Logging SessionId registration Filter", SessionIdQueryParamLoggingFilter.class).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}
示例12: post
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
private <T> T post(UriTemplate template, Object body, final Class<T> modelClass)
throws IOException, InterruptedException {
HttpURLConnection connection = (HttpURLConnection) new URL(template.expand()).openConnection();
withAuthentication(connection);
connection.setRequestMethod("POST");
byte[] bytes;
if (body != null) {
bytes = mapper.writer(new ISO8601DateFormat()).writeValueAsBytes(body);
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
connection.setDoOutput(true);
} else {
bytes = null;
connection.setDoOutput(false);
}
connection.setDoInput(!Void.class.equals(modelClass));
try {
connection.connect();
if (bytes != null) {
try (OutputStream os = connection.getOutputStream()) {
os.write(bytes);
}
}
int status = connection.getResponseCode();
if (status / 100 == 2) {
if (Void.class.equals(modelClass)) {
return null;
}
try (InputStream is = connection.getInputStream()) {
return mapper.readerFor(modelClass).readValue(is);
}
}
throw new IOException(
"HTTP " + status + "/" + connection.getResponseMessage() + "\n" + (bytes != null ? new String(bytes,
StandardCharsets.UTF_8) : ""));
} finally {
connection.disconnect();
}
}
示例13: MessageUtils
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
public MessageUtils() {
xmlMapper = new ExtendedXmlMapper();
xmlMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
xmlMapper.setDateFormat(new ISO8601DateFormat());
xmlMapper.registerModule(new JaxbAnnotationModule());
xmlMapper.setSerializationInclusion(Include.NON_NULL);
}
示例14: initialize
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<VerifyServiceProviderConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
new EnvironmentVariableSubstitutor(false)
)
);
IdaSamlBootstrap.bootstrap();
bootstrap.getObjectMapper().setDateFormat(ISO8601DateFormat.getInstance());
}
示例15: objectMapper
import com.fasterxml.jackson.databind.util.ISO8601DateFormat; //导入依赖的package包/类
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.findAndRegisterModules();
mapper.setDateFormat(new ISO8601DateFormat());
mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return mapper;
}