]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
3a9f2b540836e1d419dee9b2080b47451dad2487
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.jaxrs;
2
3 import javax.servlet.ServletContextEvent;
4
5 import org.jboss.resteasy.core.Dispatcher;
6 import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;
7 import org.collectionspace.services.common.ResourceMap;
8 import java.util.Date;
9
10 public class CSpaceResteasyBootstrap extends ResteasyBootstrap {
11         
12         public void  contextInitialized(ServletContextEvent event) {
13                 try {
14                         //
15                 // This call to super instantiates and initializes our JAX-RS application class.
16                 // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.
17                 //
18                 System.out.println(String.format("%tc [INFO] Starting up the CollectionSpace Services' JAX-RS application.", new Date()));
19                         super.contextInitialized(event);
20                         CollectionSpaceJaxRsApplication app = (CollectionSpaceJaxRsApplication)deployment.getApplication();
21                         Dispatcher disp = deployment.getDispatcher();
22                         disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());
23                 System.out.println(String.format("%tc [INFO] CollectionSpace Services' JAX-RS application started.", new Date()));
24                 } catch (Throwable e) {
25                         e.printStackTrace();
26                 }
27         }
28         
29     @Override
30     public void contextDestroyed(ServletContextEvent event) {
31         System.out.println("[INFO] Shutting down the CollectionSpace Services' JAX-RS application.");
32         //Do something if needed.
33         System.out.println("[INFO] CollectionSpace Services' JAX-RS application stopped.");
34     }   
35
36 }