Examples of WebApplicationContext


Examples of org.springframework.web.context.WebApplicationContext

    public void destroy() throws Exception {
        serialize();
    }

    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        WebApplicationContext wac = (WebApplicationContext) applicationContext;
        contextTempDir = (File) wac.getServletContext().getAttribute("javax.servlet.context.tempdir");
    }
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

  }

  public Object createBean(ActionContext context)
  {
    ServletContext servletContext = context.getContext();
    WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

    synchronized (this)
    {
      if (!checkNotSingleton)
      {
        Assert.isTrue(!wac.isSingleton(beanName), "Spring-registered action bean " + beanName
            + " cannot be a singleton");
        checkNotSingleton = true;
      }
    }

    return wac.getBean(beanName, actionBeanClass);
  }
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

   * Returns named Spring bean from <code>ServletContext</code>. Throws
   * <code>ApplicationConfigurationException</code> if Spring context is not present or named bean is not present in context
   */
  public static Object getSpringBean(ServletContext servletContext, String beanName)
  {
    WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);

    if (context == null)
    {
      throw new ApplicationConfigurationException(
          "No spring root context found using "
              + "WebApplicationContextUtils.getWebApplicationContext(servletContext). This is probably an application configuration error");
    }

    Object bean = context.getBean(beanName);
    if (bean == null)
    {
      throw new ApplicationConfigurationException("No spring bean " + beanName
          + " found. This is probably an application configuration error");
    }
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

            servletContext = PortletContext.getContext().getServletContext();
        }
       
        if (logger.isDebugEnabled())
            logger.debug("OpenSessionInXWorkInterceptor: " + servletContext);
        WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

        return (SessionFactory) wac.getBean(getSessionFactoryBeanName());
    }
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

    private static Cipherer cipherer;
    private static Log log = LogFactory.getLog(EncryptedUUIDConverter.class);

    protected void initEncryption() {
        WebContext webCtx = WebContextFactory.get();
        WebApplicationContext springContext = RequestContextUtils.getWebApplicationContext(webCtx.getHttpServletRequest(), webCtx.getServletContext());
        decipherer = (Decipherer) springContext.getBean("cryptographyManager");
        cipherer = (Cipherer) decipherer;
        if (log.isInfoEnabled()) log.info("UUID converter found cipherer/decipherer: " + decipherer.getClass().getName());
    }
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

    private static Cipherer cipherer;
    private static Log log = LogFactory.getLog(EncryptedClassConverter.class);

    protected void initEncryption() {
        WebContext webCtx = WebContextFactory.get();
        WebApplicationContext springContext = RequestContextUtils.getWebApplicationContext(webCtx.getHttpServletRequest(), webCtx.getServletContext());
        decipherer = (Decipherer) springContext.getBean("cryptographyManager");
        cipherer = (Cipherer) decipherer;
        if (log.isInfoEnabled()) log.info("Class converter found cipherer/decipherer: " + decipherer.getClass().getName());
    }
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

    @Before
    public void setup() throws JspException {
        context = new RenderContext();
        service = createNiceMock(RenderService.class);
        scriptManager = createMock(ScriptManager.class);
        WebApplicationContext wContext = createNiceMock(WebApplicationContext.class);
        expect(wContext.getBean(RenderService.class)).andReturn(service).anyTimes();
        expect(wContext.getBean(ScriptManager.class)).andReturn(scriptManager).anyTimes();
        replay(wContext);
        ServletContext servletContext = createNiceMock(ServletContext.class);
        expect(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)).andReturn(wContext).anyTimes();
        replay(servletContext);
        ServletRequest request = new MockHttpServletRequest();
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

     *
     * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
     */
    @SuppressWarnings("unchecked")
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        WebApplicationContext webApplicationContext = (WebApplicationContext) applicationContext;
        ServletContext servletContext = webApplicationContext.getServletContext();
        this.blockContexts = (Map<String, String>) servletContext
                .getAttribute(BlockDeploymentServletContextListener.BLOCK_CONTEXT_MAP);
    }
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

     *
     * @return ValidatorResources from a ValidatorFactory.
     */
    private ValidatorResources getValidatorResources() {
        // look in servlet beans definition (i.e. action-servlet.xml)
        WebApplicationContext ctx = (WebApplicationContext) pageContext.getRequest()
                .getAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE);
        ValidatorFactory factory = null;
        try {
            factory = (ValidatorFactory) BeanFactoryUtils
                    .beanOfTypeIncludingAncestors(ctx, ValidatorFactory.class, true, true);
View Full Code Here

Examples of org.springframework.web.context.WebApplicationContext

    protected void servletInitialized() throws ServletException {
        super.servletInitialized();
        getService().addSessionInitListener(new SessionInitListener() {
            @Override
            public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException {
                WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
                SpringAwareTouchKitUIProvider uiProvider = new SpringAwareTouchKitUIProvider(webApplicationContext);
                sessionInitEvent.getSession().addUIProvider(uiProvider);
            }
        });
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.