Package org.springframework.web.context.support

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


      root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class));

      //Changing session cookie name to avoid conflicts
      root.getSessionHandler().getSessionManager().setSessionCookie("AMBARISESSIONID");

      GenericWebApplicationContext springWebAppContext = new GenericWebApplicationContext();
      springWebAppContext.setServletContext(root.getServletContext());
      springWebAppContext.setParent(springAppContext);
      /* Configure web app context */
      root.setResourceBase(configs.getWebAppDir());

      root.getServletContext().setAttribute(
          WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
View Full Code Here


          ServletContextHandler.SECURITY | ServletContextHandler.SESSIONS);

      //Changing session cookie name to avoid conflicts
      root.getSessionHandler().getSessionManager().setSessionCookie("AMBARISESSIONID");

      GenericWebApplicationContext springWebAppContext = new GenericWebApplicationContext();
      springWebAppContext.setServletContext(root.getServletContext());
      springWebAppContext.setParent(springAppContext);
      /* Configure web app context */
      root.setResourceBase(configuration.getWebAppDir());

      root.getServletContext().setAttribute(
          WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
View Full Code Here

          ServletContextHandler.SECURITY | ServletContextHandler.SESSIONS);

      //Changing session cookie name to avoid conflicts
      root.getSessionHandler().getSessionManager().setSessionCookie("AMBARISESSIONID");

      GenericWebApplicationContext springWebAppContext = new GenericWebApplicationContext();
      springWebAppContext.setServletContext(root.getServletContext());
      springWebAppContext.setParent(springAppContext);
      /* Configure web app context */
      root.setResourceBase(configs.getWebAppDir());

      root.getServletContext().setAttribute(
          WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
View Full Code Here

      }
    };
  }

  public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
    GenericWebApplicationContext context = new GenericWebApplicationContext();
    context.getEnvironment().setActiveProfiles(mergedConfig.getActiveProfiles());
    prepareContext(context);
    loadBeanDefinitions(context, mergedConfig);
    return context;
  }
View Full Code Here

        JstlView testUrlBasedView = new JstlView("myjsp.jsp");

        testUrlBasedView.setServletContext(new MockServletContext());
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                new GenericWebApplicationContext());
        Map<String, Object> model = new HashMap<String, Object>();
        testUrlBasedView.render(model,
                request,
                new MockHttpServletResponse());
View Full Code Here

    ServletContextHandler servletContextHandler = new ServletContextHandler(server, "/", true, false);
 
    //Servlet adress is defined with the bean name
    //try to avoid xml config (dont sacrifice type safety)
    GenericWebApplicationContext genericWebApplicationContext = new GenericWebApplicationContext();
    genericWebApplicationContext.registerBeanDefinition("/loginService",
        BeanDefinitionBuilder.genericBeanDefinition(HttpInvokerServiceExporter.class).
        addPropertyValue("service", loginService).
        addPropertyValue("serviceInterface", LoginService.class.getName()).
        getBeanDefinition());
    genericWebApplicationContext.registerBeanDefinition("/copperMonitoringService",
        BeanDefinitionBuilder.genericBeanDefinition(HttpInvokerServiceExporter.class).
        addPropertyValue("service", copperMonitoringService).
        addPropertyValue("serviceInterface", CopperMonitoringService.class.getName()).
        addPropertyValue("remoteInvocationExecutor", remoteInvocationExecutor).
        getBeanDefinition());
    genericWebApplicationContext.refresh();
   
    DispatcherServlet dispatcherServlet = new DispatcherServlet(genericWebApplicationContext);
    ServletHolder servletHolder = new ServletHolder(dispatcherServlet);
    servletContextHandler.addServlet(servletHolder, "/*");
   
 
View Full Code Here

  private GenericApplicationContext createFlowApplicationContext(Resource[] resources) {
    ApplicationContext parent = getContext().getApplicationContext();
    GenericApplicationContext flowContext;
    if (parent instanceof WebApplicationContext) {
      GenericWebApplicationContext webContext = new GenericWebApplicationContext();
      webContext.setServletContext(((WebApplicationContext) parent).getServletContext());
      flowContext = webContext;
    } else {
      flowContext = new GenericApplicationContext();
    }
    flowContext.setDisplayName("Flow ApplicationContext [" + getContext().getFlowId() + "]");
View Full Code Here

            public Servlet getServletInstance(ServletContext context) {
                ClassLoader orig = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(module.getClassLoader());

                try {
                    final GenericWebApplicationContext mvcContext = new GenericWebApplicationContext(context);

                    mvcContext.setClassLoader(module.getClassLoader());

                    mvcContext.setServletContext(context);
                    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(mvcContext);
                    xmlReader.setBeanClassLoader(module.getClassLoader());
                    xmlReader.loadBeanDefinitions(new ClassPathResource(springMvcApplicationContextLocation,
                            module.getClassLoader()));
                    mvcContext.setParent(existingLilyRuntimeSpringContext);
                    mvcContext.refresh();

                    DispatcherServlet dispatcherServlet = new DispatcherServlet(mvcContext);
                    dispatcherServlet.setDetectAllHandlerMappings(true);
                    return dispatcherServlet;
                } finally {
View Full Code Here

            public Servlet getServletInstance(ServletContext context) {
                ClassLoader orig = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(module.getClassLoader());

                try {
                    final GenericWebApplicationContext mvcContext = new GenericWebApplicationContext(context);

                    mvcContext.setClassLoader(module.getClassLoader());

                    mvcContext.setServletContext(context);
                    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(mvcContext);
                    xmlReader.setBeanClassLoader(module.getClassLoader());
                    xmlReader.loadBeanDefinitions(new ClassPathResource(springMvcApplicationContextLocation,
                            module.getClassLoader()));
                    mvcContext.setParent(existingLilyRuntimeSpringContext);
                    mvcContext.refresh();

                    return new JerseySpringServlet(mvcContext);
                } finally {
                    Thread.currentThread().setContextClassLoader(orig);
                }
View Full Code Here

      root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class));

      //Changing session cookie name to avoid conflicts
      root.getSessionHandler().getSessionManager().setSessionCookie("AMBARISESSIONID");

      GenericWebApplicationContext springWebAppContext = new GenericWebApplicationContext();
      springWebAppContext.setServletContext(root.getServletContext());
      springWebAppContext.setParent(springAppContext);
      /* Configure web app context */
      root.setResourceBase(configs.getWebAppDir());

      root.getServletContext().setAttribute(
          WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
View Full Code Here

TOP

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

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.