server/src/main/java/org/iri_research/renkan/rest/RestApplication.java
author ymh <ymh.work@gmail.com>
Thu, 12 Jun 2014 16:27:35 +0200
changeset 304 8ad1734d9d8a
parent 298 2f35c2ae7de8
permissions -rw-r--r--
add export link on project
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
220
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
package org.iri_research.renkan.rest;
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
import org.glassfish.jersey.server.ResourceConfig;
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
import org.glassfish.jersey.server.spring.SpringLifecycleListener;
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
import org.glassfish.jersey.server.spring.scope.RequestContextFilter;
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
232
b7000ff4989b - Use Joda DateTime instead of java.utils.Date
ymh <ymh.work@gmail.com>
parents: 223
diff changeset
     7
import com.fasterxml.jackson.databind.ObjectMapper;
b7000ff4989b - Use Joda DateTime instead of java.utils.Date
ymh <ymh.work@gmail.com>
parents: 223
diff changeset
     8
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
b7000ff4989b - Use Joda DateTime instead of java.utils.Date
ymh <ymh.work@gmail.com>
parents: 223
diff changeset
     9
220
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
public class RestApplication extends ResourceConfig {
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 232
diff changeset
    11
    
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 232
diff changeset
    12
    private ObjectMapperProvider objectMapperProvider = new ObjectMapperProvider();
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 232
diff changeset
    13
    
220
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
    public RestApplication() {
232
b7000ff4989b - Use Joda DateTime instead of java.utils.Date
ymh <ymh.work@gmail.com>
parents: 223
diff changeset
    15
220
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
        this.packages("org.iri_research.renkan.rest");
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
        this.register(SpringLifecycleListener.class);
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
        this.register(RequestContextFilter.class);
232
b7000ff4989b - Use Joda DateTime instead of java.utils.Date
ymh <ymh.work@gmail.com>
parents: 223
diff changeset
    19
        
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 232
diff changeset
    20
        ObjectMapper objectMapper = this.objectMapperProvider.getContext(ObjectMapper.class);
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 232
diff changeset
    21
        
304
8ad1734d9d8a add export link on project
ymh <ymh.work@gmail.com>
parents: 298
diff changeset
    22
        JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(objectMapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS);
232
b7000ff4989b - Use Joda DateTime instead of java.utils.Date
ymh <ymh.work@gmail.com>
parents: 223
diff changeset
    23
        
b7000ff4989b - Use Joda DateTime instead of java.utils.Date
ymh <ymh.work@gmail.com>
parents: 223
diff changeset
    24
        this.register(provider);
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 232
diff changeset
    25
220
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
    }
ecbb104cf3b6 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more...
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
}