本文整理匯總了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;
}