Search in sources :

Example 11 with ISO8601DateFormat

use of com.fasterxml.jackson.databind.util.ISO8601DateFormat in project JMRI by JMRI.

the class TrainCommon method getISO8601Date.

public static String getISO8601Date(boolean isModelYear) {
    Calendar calendar = Calendar.getInstance();
    // use the JMRI Timebase (which may be a fast clock).
    calendar.setTime(jmri.InstanceManager.getDefault(jmri.Timebase.class).getTime());
    if (isModelYear && !Setup.getYearModeled().isEmpty()) {
        try {
            calendar.set(Calendar.YEAR, Integer.parseInt(Setup.getYearModeled().trim()));
        } catch (NumberFormatException e) {
            return Setup.getYearModeled();
        }
    }
    return (new ISO8601DateFormat()).format(calendar.getTime());
}
Also used : Calendar(java.util.Calendar) ISO8601DateFormat(com.fasterxml.jackson.databind.util.ISO8601DateFormat)

Example 12 with ISO8601DateFormat

use of com.fasterxml.jackson.databind.util.ISO8601DateFormat in project verify-hub by alphagov.

the class SamlEngineApplication method run.

@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, "/*");
}
Also used : SessionIdQueryParamLoggingFilter(uk.gov.ida.hub.samlengine.filters.SessionIdQueryParamLoggingFilter) ISO8601DateFormat(com.fasterxml.jackson.databind.util.ISO8601DateFormat) DispatcherType(javax.servlet.DispatcherType) GuavaModule(com.fasterxml.jackson.datatype.guava.GuavaModule)

Example 13 with ISO8601DateFormat

use of com.fasterxml.jackson.databind.util.ISO8601DateFormat in project verify-hub by alphagov.

the class PolicyApplication method run.

@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);
}
Also used : ISO8601DateFormat(com.fasterxml.jackson.databind.util.ISO8601DateFormat)

Aggregations

ISO8601DateFormat (com.fasterxml.jackson.databind.util.ISO8601DateFormat)13 DispatcherType (javax.servlet.DispatcherType)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 JSONSerializer (com.alibaba.fastjson.serializer.JSONSerializer)1 SerializeConfig (com.alibaba.fastjson.serializer.SerializeConfig)1 JtsModule (com.bedatadriven.jackson.datatype.jts.JtsModule)1 JsonGenerationException (com.fasterxml.jackson.core.JsonGenerationException)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 JsonParser (com.fasterxml.jackson.core.JsonParser)1 com.fasterxml.jackson.databind (com.fasterxml.jackson.databind)1 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 BeanPropertyWriter (com.fasterxml.jackson.databind.ser.BeanPropertyWriter)1 BeanSerializerModifier (com.fasterxml.jackson.databind.ser.BeanSerializerModifier)1 GuavaModule (com.fasterxml.jackson.datatype.guava.GuavaModule)1 Provides (com.google.inject.Provides)1 ServletModule (com.google.inject.servlet.ServletModule)1 CmdArgs (com.graphhopper.util.CmdArgs)1 PathDetail (com.graphhopper.util.details.PathDetail)1