Package org.springframework.web.portlet.context

Examples of org.springframework.web.portlet.context.ConfigurablePortletApplicationContext


    if (!ConfigurablePortletApplicationContext.class.isAssignableFrom(contextClass)) {
      throw new ApplicationContextException("Fatal initialization error in portlet with name '" + getPortletName() +
          "': custom ApplicationContext class [" + contextClass.getName() +
          "] is not of type ConfigurablePortletApplicationContext");
    }
    ConfigurablePortletApplicationContext pac =
        (ConfigurablePortletApplicationContext) BeanUtils.instantiateClass(contextClass);

    // Assign the best possible id value.
    String portletContextName = getPortletContext().getPortletContextName();
    if (portletContextName != null) {
      pac.setId(ConfigurablePortletApplicationContext.APPLICATION_CONTEXT_ID_PREFIX + portletContextName + "." + getPortletName());
    }
    else {
      pac.setId(ConfigurablePortletApplicationContext.APPLICATION_CONTEXT_ID_PREFIX + getPortletName());
    }

    pac.setParent(parent);
    pac.setPortletContext(getPortletContext());
    pac.setPortletConfig(getPortletConfig());
    pac.setNamespace(getNamespace());
    pac.setConfigLocation(getContextConfigLocation());
    pac.addApplicationListener(new SourceFilteringListener(pac, this));

    postProcessPortletApplicationContext(pac);
    pac.refresh();

    return pac;
  }
View Full Code Here


      throw new ApplicationContextException("Fatal initialization error in portlet with name '" + getPortletName() +
          "': custom ApplicationContext class [" + getContextClass().getName() +
          "] is not of type ConfigurablePortletApplicationContext");
    }

    ConfigurablePortletApplicationContext pac =
        (ConfigurablePortletApplicationContext) BeanUtils.instantiateClass(getContextClass());
    pac.setParent(parent);
    pac.setPortletContext(getPortletContext());
    pac.setPortletConfig(getPortletConfig());
    pac.setNamespace(getNamespace());
    if (getContextConfigLocation() != null) {
      pac.setConfigLocations(StringUtils.tokenizeToStringArray(getContextConfigLocation(),
          ConfigurablePortletApplicationContext.CONFIG_LOCATION_DELIMITERS));
    }
    pac.addApplicationListener(new SourceFilteringListener(pac, this));

    postProcessPortletApplicationContext(pac);
    pac.refresh();

    return pac;
  }
View Full Code Here

    private PortletWrappingController controller;


    public void setUp() {
        ConfigurablePortletApplicationContext applicationContext = new MyApplicationContext();
        MockPortletConfig config = new MockPortletConfig(new MockPortletContext(), "wrappedPortlet");
        applicationContext.setPortletConfig(config);
        applicationContext.refresh();
        controller = (PortletWrappingController) applicationContext.getBean(PORTLET_WRAPPING_CONTROLLER_BEAN_NAME);
    }
View Full Code Here

      throw new ApplicationContextException("Fatal initialization error in portlet with name '" + getPortletName() +
          "': custom ApplicationContext class [" + getContextClass().getName() +
          "] is not of type ConfigurablePortletApplicationContext");
    }

    ConfigurablePortletApplicationContext pac =
        (ConfigurablePortletApplicationContext) BeanUtils.instantiateClass(getContextClass());
    pac.setParent(parent);
    pac.setPortletContext(getPortletContext());
    pac.setPortletConfig(getPortletConfig());
    pac.setNamespace(getNamespace());
    pac.setConfigLocation(getContextConfigLocation());
    pac.addApplicationListener(new SourceFilteringListener(pac, this));

    postProcessPortletApplicationContext(pac);
    pac.refresh();

    return pac;
  }
View Full Code Here

    if (!ConfigurablePortletApplicationContext.class.isAssignableFrom(contextClass)) {
      throw new ApplicationContextException("Fatal initialization error in portlet with name '" + getPortletName() +
          "': custom ApplicationContext class [" + contextClass.getName() +
          "] is not of type ConfigurablePortletApplicationContext");
    }
    ConfigurablePortletApplicationContext pac =
        (ConfigurablePortletApplicationContext) BeanUtils.instantiateClass(contextClass);

    // Assign the best possible id value.
    String portletContextName = getPortletContext().getPortletContextName();
    if (portletContextName != null) {
      pac.setId(ConfigurablePortletApplicationContext.APPLICATION_CONTEXT_ID_PREFIX + portletContextName + "." + getPortletName());
    }
    else {
      pac.setId(ConfigurablePortletApplicationContext.APPLICATION_CONTEXT_ID_PREFIX + getPortletName());
    }

    pac.setEnvironment(getEnvironment());
    pac.setParent(parent);
    pac.setPortletContext(getPortletContext());
    pac.setPortletConfig(getPortletConfig());
    pac.setNamespace(getNamespace());
    pac.setConfigLocation(getContextConfigLocation());
    pac.addApplicationListener(new SourceFilteringListener(pac, this));

    // The wac environment's #initPropertySources will be called in any case when the context
    // is refreshed; do it eagerly here to ensure portlet property sources are in place for
    // use in any post-processing or initialization that occurs below prior to #refresh
    ConfigurableEnvironment env = pac.getEnvironment();
    if (env instanceof StandardPortletEnvironment) {
      ((StandardPortletEnvironment) env).initPropertySources(pac.getServletContext(), getPortletContext(), getPortletConfig());
    }

    postProcessPortletApplicationContext(pac);
    pac.refresh();

    return pac;
  }
View Full Code Here

  private PortletWrappingController controller;


  @Before
  public void setUp() {
    ConfigurablePortletApplicationContext applicationContext = new MyApplicationContext();
    MockPortletConfig config = new MockPortletConfig(new MockPortletContext(), "wrappedPortlet");
    applicationContext.setPortletConfig(config);
    applicationContext.refresh();
    controller = (PortletWrappingController) applicationContext.getBean(PORTLET_WRAPPING_CONTROLLER_BEAN_NAME);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.portlet.context.ConfigurablePortletApplicationContext

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.