]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
c7fcf779079feb75ef3fad02caed4edf463a4cba
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.jaxrs;\r
2 \r
3 import javax.servlet.ServletContext;\r
4 import javax.servlet.ServletContextEvent;\r
5 \r
6 import org.jboss.resteasy.core.Dispatcher;\r
7 import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;\r
8 import org.collectionspace.services.common.ResourceMap;\r
9 import org.collectionspace.services.common.ServiceMain;\r
10 \r
11 public class CSpaceResteasyBootstrap extends ResteasyBootstrap {\r
12         \r
13 //      private static final String \r
14         public void  contextInitialized(ServletContextEvent event) {\r
15         if (true) {\r
16                 System.out.print("Pausing 1 seconds in RESTEasy bootstrap for you to attached the debugger");\r
17                 long startTime, currentTime;\r
18                 currentTime = startTime = System.currentTimeMillis();\r
19                 long stopTime = startTime + 1 * 1000; //5 seconds\r
20                 do {\r
21                         if (currentTime % 1000 == 0) {\r
22                                 System.out.print(".");\r
23                         }\r
24                         currentTime = System.currentTimeMillis();\r
25                 } while (currentTime < stopTime);\r
26                         \r
27                 System.out.println();\r
28                 System.out.println("Resuming RESTEasy bootstrap initialization.");\r
29         }\r
30                 \r
31         // Save a copy of the ServletContext inside our ServiceMain singleton\r
32                 ServletContext servletContext = event.getServletContext();\r
33                 ServiceMain.getInstance(servletContext); //First access causes initialization of the Services' main class\r
34                 \r
35                 // This call to super instantiates and initializes our JAX-RS application class (org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication)\r
36                 super.contextInitialized(event);\r
37                 CollectionSpaceJaxRsApplication app = \r
38                         (CollectionSpaceJaxRsApplication)deployment.getApplication();\r
39                 Dispatcher disp = deployment.getDispatcher();\r
40                 disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());\r
41         }\r
42 \r
43 }\r