]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
6d32ab644d10b6a50ba76b38f46f54d2440b593f
[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 = 
21                                 (CollectionSpaceJaxRsApplication)deployment.getApplication();
22                         Dispatcher disp = deployment.getDispatcher();
23                         disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());
24                 System.out.println(String.format("%tc [INFO] CollectionSpace Services' JAX-RS application started.", new Date()));
25                 } catch (Throwable e) {
26                         e.printStackTrace();
27                 }
28         }
29         
30     @Override
31     public void contextDestroyed(ServletContextEvent event) {
32         System.out.println("[INFO] Shutting down the CollectionSpace Services' JAX-RS application.");
33         //Do something if needed.
34         System.out.println("[INFO] CollectionSpace Services' JAX-RS application stopped.");
35     }   
36
37 }