Package org.springframework.web.context

Examples of org.springframework.web.context.WebApplicationContext


   * @throws BeansException in case of errors
   * @see #getWebApplicationContext()
   * @see org.springframework.context.ConfigurableApplicationContext#refresh()
   */
  public void refresh() throws BeansException {
    WebApplicationContext wac = getWebApplicationContext();
    if (!(wac instanceof ConfigurableApplicationContext)) {
      throw new IllegalStateException("WebApplicationContext does not support refresh: " + wac);
    }
    ((ConfigurableApplicationContext) wac).refresh();
  }
View Full Code Here


  public void setServlet(ActionServlet actionServlet) {
    super.setServlet(actionServlet);
    if (actionServlet != null) {
      ServletContext servletContext = actionServlet.getServletContext();
      WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
      this.petStore = (PetStoreFacade) wac.getBean("petStore");
    }
  }
View Full Code Here

    public void contextInitialized(ServletContextEvent event) {
        LOG.info("Starting up Pluto Portal Driver. . .");

        ServletContext servletContext = event.getServletContext();

        WebApplicationContext springContext = null;
       
        try {
          springContext = (WebApplicationContext)
            servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
         
        } catch (RuntimeException ex) {
          String msg = "Problem getting Spring context: " + ex.getMessage();
          LOG.error(msg, ex);
          throw ex;
        }
    
        LOG.debug(" [1a] Loading DriverConfiguration. . . ");
        DriverConfiguration driverConfiguration = (DriverConfiguration)
                springContext.getBean("DriverConfiguration");

        driverConfiguration.init(servletContext);

        LOG.debug(" [1b] Registering DriverConfiguration. . .");
        servletContext.setAttribute(DRIVER_CONFIG_KEY, driverConfiguration);


        LOG.debug(" [2a] Loading Optional AdminConfiguration. . .");
        AdminConfiguration adminConfiguration = (AdminConfiguration)
                springContext.getBean("AdminConfiguration");

        if (adminConfiguration != null) {
            LOG.debug(" [2b] Registering Optional AdminConfiguration");
            servletContext.setAttribute(ADMIN_CONFIG_KEY, adminConfiguration);
        } else {
View Full Code Here

     *
     * @param servletContext the servlet context.
     */
    private void initContainer(ServletContext servletContext) {

        WebApplicationContext springContext = (WebApplicationContext)
                servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

        // Retrieve the driver configuration from servlet context.
        DriverConfiguration driverConfig = (DriverConfiguration)
                servletContext.getAttribute(DRIVER_CONFIG_KEY);

        try {
            LOG.info("Initializing Portlet Container. . .");
          
            // Create portlet container.
            LOG.debug(" [1] Creating portlet container...");
            PortletContainerFactory factory =
                    PortletContainerFactory.getInstance();
            PortletContainer container = factory.createContainer(
                driverConfig.getContainerName(), (PortalDriverServices)springContext.getBean("PortalDriverServices")
            );

            // Initialize portlet container.
            LOG.debug(" [2] Initializing portlet container...");
            container.init();
View Full Code Here

        davSessionProvider = new ArchivaDavSessionProvider( servletAuth, httpAuth );

        final MockServletContext mockServletContext = new MockServletContext();

        WebApplicationContext webApplicationContext =
            new AbstractRepositoryServletTestCase.TestWebapplicationContext( applicationContext, mockServletContext );

        mockServletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                                         webApplicationContext );
View Full Code Here

    private NexusIndexer nexusIndexer;

    @Override
    public void contextInitialized( ServletContextEvent contextEvent )
    {
        WebApplicationContext wac =
            WebApplicationContextUtils.getRequiredWebApplicationContext( contextEvent.getServletContext() );

        SecuritySynchronization securitySync = wac.getBean( SecuritySynchronization.class );

        repositoryTaskScheduler =
            wac.getBean( "archivaTaskScheduler#repository", DefaultRepositoryArchivaTaskScheduler.class );

        Properties archivaRuntimeProperties = wac.getBean( "archivaRuntimeProperties", Properties.class );

        tqeRepoScanning = wac.getBean( "taskQueueExecutor#repository-scanning", ThreadedTaskQueueExecutor.class );

        tqeIndexing = wac.getBean( "taskQueueExecutor#indexing", ThreadedTaskQueueExecutor.class );

        plexusSisuBridge = wac.getBean( PlexusSisuBridge.class );

        try
        {
            nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
        }
View Full Code Here

    }

    @Override
    public void contextDestroyed( ServletContextEvent contextEvent )
    {
        WebApplicationContext applicationContext =
            WebApplicationContextUtils.getRequiredWebApplicationContext( contextEvent.getServletContext() );

        // we log using servlet mechanism as due to some possible problem with slf4j when container shutdown
        // so servletContext.log
        ServletContext servletContext = contextEvent.getServletContext();
View Full Code Here

    public void setUp()
        throws Exception
    {
        final MockServletContext mockServletContext = new MockServletContext();

        WebApplicationContext webApplicationContext =
            new TestWebapplicationContext( applicationContext, mockServletContext );

        mockServletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                                         webApplicationContext );
View Full Code Here

        throws Exception
    {

        final MockServletContext mockServletContext = new MockServletContext();

        WebApplicationContext webApplicationContext =
            new TestWebapplicationContext( applicationContext, mockServletContext );

        mockServletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                                         webApplicationContext );
View Full Code Here

    @Override
    public void contextInitialized( ServletContextEvent servletContextEvent )
    {
        try
        {
            WebApplicationContext wacu =
                WebApplicationContextUtils.getRequiredWebApplicationContext( servletContextEvent.getServletContext() );
            plexusSisuBridge = wacu.getBean( PlexusSisuBridge.class );
            cleanupIndex();

        }
        catch ( Exception e )
        {
View Full Code Here

TOP

Related Classes of org.springframework.web.context.WebApplicationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.