]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
0781ac4f458ba95f8e30a86f1b56fb4a8a9aeb08
[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         @Override
13         public void  contextInitialized(ServletContextEvent event) {
14                 try {
15                         //
16                 // This call to super instantiates and initializes our JAX-RS application class.
17                 // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.
18                 //
19                 System.out.println(String.format("%tc [INFO] Starting up the CollectionSpace Services' JAX-RS application.", new Date()));
20                         super.contextInitialized(event);
21                         CollectionSpaceJaxRsApplication app = (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                         throw e;
28                 }
29         }
30         
31     @Override
32     public void contextDestroyed(ServletContextEvent event) {
33         System.out.println("[INFO] Shutting down the CollectionSpace Services' JAX-RS application.");
34         //Do something if needed.
35         System.out.println("[INFO] CollectionSpace Services' JAX-RS application stopped.");
36     }   
37
38 }