Package org.springframework.web.context

Examples of org.springframework.web.context.WebApplicationContext


    @Test
    public void bean_name_outside_of_bean_definitions_supported_with_provided_case()
    {
        Log log = mockLog();
        WebApplicationContext webContext = newWebApplicationContext();
        ObjectLocator locator = mockObjectLocator();
        AnnotationProvider annotationProvider = mockAnnotationProvider();
        SpringBean annotation = newSpringBean(BEAN_NAME);

        SampleBean bean = newMock(SampleBean.class);

        train_getBeanDefinitionNames(webContext, "fred", "barney");

        log.info(STARTUP_MESSAGE + "barney, fred");

        train_getAnnotation(annotationProvider, SpringBean.class, annotation);

        expect(webContext.getBean(BEAN_NAME, SampleBean.class)).andReturn(bean);

        replay();

        ObjectProvider provider = new SpringObjectProvider(log, webContext);
View Full Code Here


    }

    @Test
    public void success()
    {
        WebApplicationContext webContext = newMock(WebApplicationContext.class);
        Context context = mockContext(webContext);

        replay();

        assertSame(SpringModule.build(context), webContext);
View Full Code Here

        LOGGER.log(Level.FINE, "WebApplicationContextUtils must be present for SpringProcessApplicationElResolver to work");
        return null;
      }
     
      ServletContext servletContext = servletProcessApplication.getServletContext();
      WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
      if(applicationContext != null) {
        return new ApplicationContextElResolver(applicationContext);
      }
     
    }
View Full Code Here

                            {
                                resources.getLogger().info(
                                        String.format("Starting Spring (version %s)", SpringVersion
                                                .getVersion()));

                                WebApplicationContext context = loader
                                        .initWebApplicationContext(servletContext);

                                shutdownHub.addRegistryShutdownListener(shutdownListener);

                                applicationContextCreated.set(true);
View Full Code Here

   */
  protected void registerMessageDispatcherServlet(ServletContext servletContext) {
    String servletName = this.getServletName();
    Assert.hasLength(servletName, "getServletName() may not return empty or null");

    WebApplicationContext servletAppContext = this.createServletApplicationContext();
    Assert.notNull(servletAppContext,
        "createServletApplicationContext() did not return an application " +
            "context for servlet [" + servletName + "]");

    MessageDispatcherServlet dispatcherServlet =
View Full Code Here

        throws JspException
    {
        DependencyTree deptree;
        try
        {
            WebApplicationContext webApplicationContext =
                WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );

            deptree = webApplicationContext.getBean( "dependencyTree", DependencyTree.class );
        }
        catch ( BeansException e )
        {
            throw new JspException( "Unable to lookup DependencyTree: " + e.getMessage(), e );
        }
View Full Code Here

    public RepositorySearch getNexusSearch()
    {
        if ( nexusSearch == null )
        {
            WebApplicationContext wac =
                WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext());
            nexusSearch = wac.getBean("nexusSearch", RepositorySearch.class);
        }
        return nexusSearch;
    }
View Full Code Here

    }

    public synchronized void initServers( ServletConfig servletConfig )
        throws RepositoryAdminException
    {
        WebApplicationContext wac =
            WebApplicationContextUtils.getRequiredWebApplicationContext( servletConfig.getServletContext() );

        configuration = wac.getBean( "archivaConfiguration#default", ArchivaConfiguration.class );
        configuration.addListener( this );

        managedRepositoryAdmin = wac.getBean( ManagedRepositoryAdmin.class );

        repositoryMap = managedRepositoryAdmin.getManagedRepositoriesAsMap();

        for ( ManagedRepository repo : repositoryMap.values() )
        {
            File repoDir = new File( repo.getLocation() );

            if ( !repoDir.exists() )
            {
                if ( !repoDir.mkdirs() )
                {
                    // Skip invalid directories.
                    log( "Unable to create missing directory for " + repo.getLocation() );
                    continue;
                }
            }
        }

        resourceFactory = wac.getBean( "davResourceFactory#archiva", DavResourceFactory.class );
        locatorFactory = new ArchivaDavLocatorFactory();

        ServletAuthenticator servletAuth = wac.getBean( ServletAuthenticator.class );
        HttpAuthenticator httpAuth = wac.getBean( "httpAuthenticator#basic", HttpAuthenticator.class );

        sessionProvider = new ArchivaDavSessionProvider( servletAuth, httpAuth );

        log.info( "initServers done" );
    }
View Full Code Here

        locatorFactory = null;
        sessionProvider = null;
        repositoryMap.clear();
        repositoryMap = null;

        WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext( getServletContext() );

        if ( wac instanceof ConfigurableApplicationContext )
        {
            ( (ConfigurableApplicationContext) wac ).close();
        }
View Full Code Here

    private NexusIndexer nexusIndexer;

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

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

        repositoryTaskScheduler =
            wac.getBean( "archivaTaskScheduler#repository", RepositoryArchivaTaskScheduler.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

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.