]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
bc8108312079c1410234eaecc688e7bca09bc3d4
[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 //              try {\r
34 //                      ServiceMain.getInstance(servletContext); //First access causes initialization of the Services' main class\r
35 //              } catch (RuntimeException e) {\r
36 //                      e.printStackTrace();\r
37 //                      //rethrow the exception\r
38 //                      throw e;\r
39 //              }\r
40                 \r
41                 //\r
42         // This call to super instantiates and initializes our JAX-RS application class.\r
43         // The application class is org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.\r
44         //\r
45                 super.contextInitialized(event);\r
46                 CollectionSpaceJaxRsApplication app = \r
47                         (CollectionSpaceJaxRsApplication)deployment.getApplication();\r
48                 Dispatcher disp = deployment.getDispatcher();\r
49                 disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());\r
50         }\r
51 \r
52 }\r