Rename {Default=>Standard}PortletEnvironment
Issue: SPR-8348
This commit is contained in:
parent
f893b62a9b
commit
c481d2e9fb
|
|
@ -74,7 +74,7 @@ import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||||
import org.springframework.web.context.support.XmlWebApplicationContext;
|
import org.springframework.web.context.support.XmlWebApplicationContext;
|
||||||
import org.springframework.web.portlet.context.AbstractRefreshablePortletApplicationContext;
|
import org.springframework.web.portlet.context.AbstractRefreshablePortletApplicationContext;
|
||||||
import org.springframework.web.portlet.context.DefaultPortletEnvironment;
|
import org.springframework.web.portlet.context.StandardPortletEnvironment;
|
||||||
import org.springframework.web.portlet.context.StaticPortletApplicationContext;
|
import org.springframework.web.portlet.context.StaticPortletApplicationContext;
|
||||||
import org.springframework.web.portlet.context.XmlPortletApplicationContext;
|
import org.springframework.web.portlet.context.XmlPortletApplicationContext;
|
||||||
|
|
||||||
|
|
@ -556,7 +556,7 @@ public class EnvironmentIntegrationTests {
|
||||||
public void staticPortletApplicationContext() {
|
public void staticPortletApplicationContext() {
|
||||||
StaticPortletApplicationContext ctx = new StaticPortletApplicationContext();
|
StaticPortletApplicationContext ctx = new StaticPortletApplicationContext();
|
||||||
|
|
||||||
assertHasDefaultPortletEnvironment(ctx);
|
assertHasStandardPortletEnvironment(ctx);
|
||||||
|
|
||||||
registerEnvironmentBeanDefinition(ctx);
|
registerEnvironmentBeanDefinition(ctx);
|
||||||
|
|
||||||
|
|
@ -633,16 +633,17 @@ public class EnvironmentIntegrationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertHasStandardServletEnvironment(WebApplicationContext ctx) {
|
private void assertHasStandardServletEnvironment(WebApplicationContext ctx) {
|
||||||
// ensure a default web environment exists
|
// ensure a default servlet environment exists
|
||||||
Environment defaultEnv = ctx.getEnvironment();
|
Environment defaultEnv = ctx.getEnvironment();
|
||||||
assertThat(defaultEnv, notNullValue());
|
assertThat(defaultEnv, notNullValue());
|
||||||
assertThat(defaultEnv, instanceOf(StandardServletEnvironment.class));
|
assertThat(defaultEnv, instanceOf(StandardServletEnvironment.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertHasDefaultPortletEnvironment(WebApplicationContext ctx) {
|
private void assertHasStandardPortletEnvironment(WebApplicationContext ctx) {
|
||||||
|
// ensure a default portlet environment exists
|
||||||
Environment defaultEnv = ctx.getEnvironment();
|
Environment defaultEnv = ctx.getEnvironment();
|
||||||
assertThat(defaultEnv, notNullValue());
|
assertThat(defaultEnv, notNullValue());
|
||||||
assertThat(defaultEnv, instanceOf(DefaultPortletEnvironment.class));
|
assertThat(defaultEnv, instanceOf(StandardPortletEnvironment.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertHasEnvironment(ApplicationContext ctx, Environment expectedEnv) {
|
private void assertHasEnvironment(ApplicationContext ctx, Environment expectedEnv) {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.ResourceEditor;
|
import org.springframework.core.io.ResourceEditor;
|
||||||
import org.springframework.core.io.ResourceLoader;
|
import org.springframework.core.io.ResourceLoader;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.portlet.context.DefaultPortletEnvironment;
|
import org.springframework.web.portlet.context.StandardPortletEnvironment;
|
||||||
import org.springframework.web.portlet.context.PortletContextResourceLoader;
|
import org.springframework.web.portlet.context.PortletContextResourceLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -76,7 +76,7 @@ public abstract class GenericPortletBean extends GenericPortlet implements Envir
|
||||||
*/
|
*/
|
||||||
private final Set<String> requiredProperties = new HashSet<String>();
|
private final Set<String> requiredProperties = new HashSet<String>();
|
||||||
|
|
||||||
private Environment environment = new DefaultPortletEnvironment();
|
private Environment environment = new StandardPortletEnvironment();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -167,7 +167,7 @@ public abstract class GenericPortletBean extends GenericPortlet implements Envir
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* <p>Any environment set here overrides the {@link DefaultPortletEnvironment}
|
* <p>Any environment set here overrides the {@link StandardPortletEnvironment}
|
||||||
* provided by default.
|
* provided by default.
|
||||||
*/
|
*/
|
||||||
public void setEnvironment(Environment environment) {
|
public void setEnvironment(Environment environment) {
|
||||||
|
|
|
||||||
|
|
@ -152,11 +152,11 @@ public abstract class AbstractRefreshablePortletApplicationContext extends Abstr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and return a new {@link DefaultPortletEnvironment}.
|
* Create and return a new {@link StandardPortletEnvironment}.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected ConfigurableEnvironment createEnvironment() {
|
protected ConfigurableEnvironment createEnvironment() {
|
||||||
return new DefaultPortletEnvironment();
|
return new StandardPortletEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -200,13 +200,13 @@ public abstract class PortletApplicationContextUtils {
|
||||||
|
|
||||||
WebApplicationContextUtils.initServletPropertySources(propertySources, servletContext);
|
WebApplicationContextUtils.initServletPropertySources(propertySources, servletContext);
|
||||||
|
|
||||||
if(portletContext != null && propertySources.contains(DefaultPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME)) {
|
if(portletContext != null && propertySources.contains(StandardPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME)) {
|
||||||
propertySources.replace(DefaultPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME,
|
propertySources.replace(StandardPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME,
|
||||||
new PortletContextPropertySource(DefaultPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME, portletContext));
|
new PortletContextPropertySource(StandardPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME, portletContext));
|
||||||
}
|
}
|
||||||
if(portletConfig != null && propertySources.contains(DefaultPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME)) {
|
if(portletConfig != null && propertySources.contains(StandardPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME)) {
|
||||||
propertySources.replace(DefaultPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME,
|
propertySources.replace(StandardPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME,
|
||||||
new PortletConfigPropertySource(DefaultPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME, portletConfig));
|
new PortletConfigPropertySource(StandardPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME, portletConfig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,16 @@ import org.springframework.web.context.support.StandardServletEnvironment;
|
||||||
* applications. All Portlet-related {@code ApplicationContext} classes initialize an instance
|
* applications. All Portlet-related {@code ApplicationContext} classes initialize an instance
|
||||||
* by default.
|
* by default.
|
||||||
*
|
*
|
||||||
* <p>Contributes {@code ServletContext}-, {@code PortletContext}-, and {@code PortletConfig}-based
|
* <p>Contributes {@code ServletContext}-, {@code PortletContext}-, and
|
||||||
* {@link PropertySource} instances. See the {@link #DefaultPortletEnvironment()} constructor
|
* {@code PortletConfig}-based {@link PropertySource} instances. See the
|
||||||
* for details.
|
* {@link #customizePropertySources} method for details.
|
||||||
*
|
*
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
* @see StandardEnvironment
|
* @see StandardEnvironment
|
||||||
* @see StandardServletEnvironment
|
* @see StandardServletEnvironment
|
||||||
*/
|
*/
|
||||||
public class DefaultPortletEnvironment extends StandardEnvironment {
|
public class StandardPortletEnvironment extends StandardEnvironment {
|
||||||
|
|
||||||
/** Portlet context init parameters property source name: {@value} */
|
/** Portlet context init parameters property source name: {@value} */
|
||||||
public static final String PORTLET_CONTEXT_PROPERTY_SOURCE_NAME = "portletContextInitParams";
|
public static final String PORTLET_CONTEXT_PROPERTY_SOURCE_NAME = "portletContextInitParams";
|
||||||
|
|
@ -59,14 +59,14 @@ public class DefaultPortletEnvironment extends StandardEnvironment {
|
||||||
* </ul>
|
* </ul>
|
||||||
* <p>Properties present in {@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME} will
|
* <p>Properties present in {@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME} will
|
||||||
* take precedence over those in {@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME},
|
* take precedence over those in {@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME},
|
||||||
* which takes precedence over those in
|
* which takes precedence over those in {@linkplain
|
||||||
* {@linkplain StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}.
|
* StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}.
|
||||||
* <p>Properties in any of the above will take precedence over system properties and environment
|
* <p>Properties in any of the above will take precedence over system properties and
|
||||||
* variables contributed by the {@link StandardEnvironment} superclass.
|
* environment variables contributed by the {@link StandardEnvironment} superclass.
|
||||||
* <p>The property sources are added as stubs for now, and will be
|
* <p>The property sources are added as stubs for now, and will be
|
||||||
* {@linkplain PortletApplicationContextUtils#initPortletPropertySources fully initialized}
|
* {@linkplain PortletApplicationContextUtils#initPortletPropertySources fully
|
||||||
* once the actual {@link PortletConfig}, {@link PortletContext}, and {@link ServletContext}
|
* initialized} once the actual {@link PortletConfig}, {@link PortletContext}, and
|
||||||
* objects are available.
|
* {@link ServletContext} objects are available.
|
||||||
* @see StandardEnvironment#customizePropertySources
|
* @see StandardEnvironment#customizePropertySources
|
||||||
* @see PortletConfigPropertySource
|
* @see PortletConfigPropertySource
|
||||||
* @see PortletContextPropertySource
|
* @see PortletContextPropertySource
|
||||||
|
|
@ -65,11 +65,11 @@ public class StaticPortletApplicationContext extends StaticApplicationContext
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new {@link DefaultPortletEnvironment}
|
* Return a new {@link StandardPortletEnvironment}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected ConfigurableEnvironment createEnvironment() {
|
protected ConfigurableEnvironment createEnvironment() {
|
||||||
return new DefaultPortletEnvironment();
|
return new StandardPortletEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ import org.springframework.jndi.JndiPropertySource;
|
||||||
* @author Chris Beams
|
* @author Chris Beams
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
* @see StandardEnvironment
|
* @see StandardEnvironment
|
||||||
* @see DefaultPortletEnvironment
|
* @see StandardPortletEnvironment
|
||||||
*/
|
*/
|
||||||
public class StandardServletEnvironment extends StandardEnvironment {
|
public class StandardServletEnvironment extends StandardEnvironment {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue