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;
9 public class CSpaceResteasyBootstrap extends ResteasyBootstrap {
11 public void contextInitialized(ServletContextEvent event) {
14 // This call to super instantiates and initializes our JAX-RS application class.
15 // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.
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) {
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.");