public void contextInitialized(final ServletContextEvent event) {
   super.contextInitialized(event);
   final ServletContext context = event.getServletContext();
   final Registry registry = (Registry) context.getAttribute(Registry.class.getName());
   final ResteasyProviderFactory providerFactory =
       (ResteasyProviderFactory) context.getAttribute(ResteasyProviderFactory.class.getName());
   final ModuleProcessor processor = new ModuleProcessor(registry, providerFactory);
   final List<Module> modules = getModules(context);
   final Stage stage = getStage(context);
   if (stage == null) {
     processor.process(modules);
   } else {
     processor.process(stage, modules);
   }
 }
コード例 #2
0
 public void contextInitialized(ServletContextEvent event) {
   try {
     //
     // This call to super instantiates and initializes our JAX-RS application class.
     // The application class is
     // org.collectionspace.services.jaxrs.CollectionSpaceJaxRsApplication.
     //
     System.out.println("[INFO] Starting up the CollectionSpace Services' JAX-RS application.");
     super.contextInitialized(event);
     CollectionSpaceJaxRsApplication app =
         (CollectionSpaceJaxRsApplication) deployment.getApplication();
     Dispatcher disp = deployment.getDispatcher();
     disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap());
     System.out.println("[INFO] CollectionSpace Services' JAX-RS application started.");
   } catch (Throwable e) {
     e.printStackTrace();
   }
 }