1 package org.collectionspace.services.jaxrs;
3 import javax.servlet.ServletContextEvent;
5 import org.jboss.resteasy.core.Dispatcher;
6 import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;
7 import org.collectionspace.services.common.ResourceMap;
10 public class CSpaceResteasyBootstrap extends ResteasyBootstrap {
12 public void contextInitialized(ServletContextEvent event) {
15 // This call to super instantiates and initializes our JAX-RS application class.
16 // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.
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) {
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.");