Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.XmlWebApplicationContext


   *
   * @return application context instance
   */
  protected ConfigurableWebApplicationContext newApplicationContext()
  {
    return new XmlWebApplicationContext();
  }
View Full Code Here


        File appRootDir = new File(appRoot);
        System.setProperty(JetspeedEngineConstants.APPLICATION_ROOT_KEY, appRootDir.getAbsolutePath());

        if (bootConfigs != null && bootConfigs.length > 0)
        {
            bootCtx = new XmlWebApplicationContext();
            ((XmlWebApplicationContext) bootCtx).setServletContext(servletContext);
            ((XmlWebApplicationContext) bootCtx).setConfigLocations(bootConfigs);
        }
        else
        {
            bootCtx = new GenericApplicationContext();
        }

        appContext = new XmlWebApplicationContext();
        ((XmlWebApplicationContext) appContext).setParent(bootCtx);
        ((XmlWebApplicationContext) appContext).setServletContext(servletContext);
        ((XmlWebApplicationContext) appContext).setConfigLocations(appConfigs);

        factories = new ArrayList();
View Full Code Here

        File appRootDir = new File(appRoot);
        System.setProperty(JetspeedEngineConstants.APPLICATION_ROOT_KEY, appRootDir.getAbsolutePath());

        if (bootConfigs != null && bootConfigs.length > 0)
        {
            bootCtx = new XmlWebApplicationContext();
            ((XmlWebApplicationContext) bootCtx).setServletContext(servletContext);
            ((XmlWebApplicationContext) bootCtx).setConfigLocations(bootConfigs);
        }
        else
        {
            bootCtx = new GenericApplicationContext();
        }

        appContext = new XmlWebApplicationContext();
        ((XmlWebApplicationContext) appContext).setParent(bootCtx);
        ((XmlWebApplicationContext) appContext).setServletContext(servletContext);
        ((XmlWebApplicationContext) appContext).setConfigLocations(appConfigs);

        factories = new ArrayList();
View Full Code Here

  }

  protected ApplicationContext getAppContext() {
    WebApplicationContext parent = WebApplicationContextUtils.getRequiredWebApplicationContext( getServletContext() );

    ConfigurableWebApplicationContext wac = new XmlWebApplicationContext() {
      @Override
      protected Resource getResourceByPath( String path ) {
        return new FileSystemResource( new File( path ) );
      }
    };
    wac.setParent( parent );
    wac.setServletContext( getServletContext() );
    wac.setServletConfig( getServletConfig() );
    wac.setNamespace( getServletName() );
    String springFile =
        PentahoSystem.getApplicationContext()
            .getSolutionPath( "system" + File.separator + "pentahoServices.spring.xml" ); //$NON-NLS-1$ //$NON-NLS-2$
    wac.setConfigLocations( new String[] { springFile } );
    wac.refresh();

    return wac;
  }
View Full Code Here

    return new WSServletDelegate( adapters, getServletContext() );
  }

  protected ApplicationContext getAppContext() {
    ConfigurableWebApplicationContext wac = new XmlWebApplicationContext() {
      @Override
      protected Resource getResourceByPath( String path ) {
        return new FileSystemResource( new File( path ) );
      }
    };

    wac.setServletContext( getServletContext() );
    wac.setServletConfig( getServletConfig() );
    wac.setNamespace( getServletName() );
    String springFile =
        PentahoSystem.getApplicationContext()
            .getSolutionPath( "system" + File.separator + "pentahoServices.spring.xml" ); //$NON-NLS-1$ //$NON-NLS-2$
    wac.setConfigLocations( new String[] { springFile } );
    wac.refresh();

    return wac;
  }
View Full Code Here

    }
  }

  protected ApplicationContext getAppContext() {

    ConfigurableWebApplicationContext wac = new XmlWebApplicationContext() {
      @Override
      protected Resource getResourceByPath( String path ) {
        return new FileSystemResource( new File( path ) );
      }
    };

    wac.setServletContext( getServletContext() );
    wac.setServletConfig( getServletConfig() );
    wac.setNamespace( getServletName() );
    String springFile =
        PentahoSystem.getApplicationContext()
            .getSolutionPath( "system" + File.separator + "pentahoServices.spring.xml" ); //$NON-NLS-1$ //$NON-NLS-2$
    wac.setConfigLocations( new String[] { springFile } );
    wac.refresh();

    return wac;
  }
View Full Code Here

     * @return
     */
    private ApplicationContext createSpringContext(ApplicationContext ctx,
                                                   ServletConfig servletConfig,
                                                   String location) {
        XmlWebApplicationContext ctx2 = new XmlWebApplicationContext();
        createdContext = ctx2;
       
        ctx2.setServletConfig(servletConfig);
        Resource r = ctx2.getResource(location);
        try {
            InputStream in = r.getInputStream();
            in.close();
        } catch (IOException e) {
            //ignore
            r = ctx2.getResource("classpath:" + location);
            try {
                r.getInputStream().close();
            } catch (IOException e2) {
                //ignore
                r = null;
            }
        }
        try {
            if (r != null) {
                location = r.getURL().toExternalForm();
            }
        } catch (IOException e) {
            //ignore
        }       
        if (ctx != null) {
            ctx2.setParent(ctx);
            String names[] = ctx.getBeanNamesForType(Bus.class);
            if (names == null || names.length == 0) {
                ctx2.setConfigLocations(new String[] {"classpath:/META-INF/cxf/cxf.xml",
                                                      location});               
            } else {
                ctx2.setConfigLocations(new String[] {location});                               
            }
        } else {
            ctx2.setConfigLocations(new String[] {"classpath:/META-INF/cxf/cxf.xml",
                                                  location});
            createdContext = ctx2;
        }
        ctx2.refresh();
        return ctx2;
    }
View Full Code Here

   *     <li>etc.
   * </ul>
   */
  public static ContextMockMvcBuilder xmlConfigSetup(String... configLocations) {
    Assert.notEmpty(configLocations, "At least one XML config location is required");
    XmlWebApplicationContext context = new XmlWebApplicationContext();
    context.setConfigLocations(configLocations);
    return new ContextMockMvcBuilder(context);
  }
View Full Code Here

 
  /*Application startup event.*/
  public void contextInitialized(ServletContextEvent ce) {
    long init = Calendar.getInstance().getTimeInMillis();
    LOGGER.severe("++ Starting load context");
    XmlWebApplicationContext rootCtx =
      (XmlWebApplicationContext)this.initWebApplicationContext(ce.getServletContext());
    rootCtx.setAllowBeanDefinitionOverriding(true);
    long end = Calendar.getInstance().getTimeInMillis();
    LOGGER.severe("++ Ending load context, elapsed time " + ((end-init)/1000) + " seconds");
    ClassPathXmlApplicationContext servicesContext = (ClassPathXmlApplicationContext) rootCtx.getBean("servicesContext");
    servicesContext.setParent(rootCtx);
   }
View Full Code Here

      }
   }
  
   protected WebApplicationContext createContextLoader(ServletContext servletContext)
   {
      XmlWebApplicationContext xmlWebApplicationContext = new XmlWebApplicationContext();
      xmlWebApplicationContext.setServletContext(servletContext);
      xmlWebApplicationContext.setConfigLocations(getConfigLocations());
      return xmlWebApplicationContext;
   }
View Full Code Here

TOP

Related Classes of org.springframework.web.context.support.XmlWebApplicationContext

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.