package com.vnadgir.hal;

import com.theoryinpractise.halbuilder.api.RepresentationFactory;
import com.theoryinpractise.halbuilder.standard.StandardRepresentationFactory;
import com.vnadgir.hal.api.resources.TestSessionResource;
import com.vnadgir.hal.api.resources.TestSessionsClientResource;
import com.vnadgir.hal.api.resources.TestSessionsService;
import io.dropwizard.client.JerseyClientBuilder;
import io.dropwizard.setup.Environment;

import javax.ws.rs.client.Client;

public class HalApplication extends io.dropwizard.Application<HalConfiguration> {

    @Override
    public void run(HalConfiguration halConfiguration, Environment environment) throws Exception {
        final Client client = new JerseyClientBuilder(environment)
                .build(getName());

        TestSessionsService testSessionsService = new TestSessionsService();
        RepresentationFactory representationFactory = new StandardRepresentationFactory();

        environment.jersey().register(new TestSessionsClientResource(client));
        environment.jersey().register(new TestSessionResource(testSessionsService, representationFactory));
    }

    @Override
    public String getName(){
        return "hal-dw";
    }

    public static void main(String[] args) throws Exception {
        new HalApplication().run(args);
    }
}


@@ -19,16 +19,252 @@
 r.hal;%0A%0A
+import com.fasterxml.jackson.databind.ObjectMapper;%0Aimport com.fasterxml.jackson.databind.util.ISO8601DateFormat;%0Aimport com.fasterxml.jackson.datatype.joda.JodaModule;%0Aimport com.fasterxml.jackson.datatype.joda.ser.DateTimeSerializer;%0A
 import c
@@ -313,32 +313,32 @@
 ntationFactory;%0A
-
 import com.theor
@@ -704,16 +704,51 @@
 .Client;
+%0Aimport java.text.SimpleDateFormat;
 %0A%0Apublic
@@ -830,32 +830,32 @@
 %0A%0A    @Override%0A
-
     public void 
@@ -929,32 +929,216 @@
 ows Exception %7B%0A
+        ObjectMapper objectMapper = environment.getObjectMapper();%0A        objectMapper.registerModule(new JodaModule());%0A        objectMapper.setDateFormat(new ISO8601DateFormat());%0A%0A
         final Cl

Add default DateTimeFormat to parse/format DateTimes in UTC (ISO8601)