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 {
13 public void contextInitialized(ServletContextEvent event) {
16 // This call to super instantiates and initializes our JAX-RS application class.
17 // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.
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) {
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.");