]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
48f79b626f5a866fa546636bd843b9c4f5fc29a1
[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
9 public class CSpaceResteasyBootstrap extends ResteasyBootstrap {
10         
11         public void  contextInitialized(ServletContextEvent event) {
12                 try {
13                         //
14                 // This call to super instantiates and initializes our JAX-RS application class.
15                 // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.
16                 //
17                 System.out.println("[INFO] Starting up the CollectionSpace Services' JAX-RS application.");
18                         super.contextInitialized(event);
19                         CollectionSpaceJaxRsApplication app = 
20                                 (CollectionSpaceJaxRsApplication)deployment.getApplication();
21                         Dispatcher disp = deployment.getDispatcher();
22                         disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());
23                         System.out.println("[INFO] CollectionSpace Services' JAX-RS application started.");
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 }