fixed environmental bug for portlet
fixed issue preventing rendering of views otuside of view states
This commit is contained in:
@@ -48,8 +48,7 @@ public class MvcEnvironment extends StaticLabeledEnum {
|
||||
* @return the web environment the context is running in, or null if not running in a web environment
|
||||
*/
|
||||
public static MvcEnvironment environmentFor(ApplicationContext applicationContext) {
|
||||
if (ClassUtils.isPresent("javax.portlet.PortletContext")
|
||||
&& applicationContext instanceof ConfigurablePortletApplicationContext) {
|
||||
if (ClassUtils.isPresent("javax.portlet.PortletContext") && isPortletApplicationContext(applicationContext)) {
|
||||
return MvcEnvironment.PORTLET;
|
||||
} else if (applicationContext instanceof WebApplicationContext) {
|
||||
return MvcEnvironment.SERVLET;
|
||||
@@ -58,4 +57,9 @@ public class MvcEnvironment extends StaticLabeledEnum {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPortletApplicationContext(ApplicationContext applicationContext) {
|
||||
return ClassUtils.isPresent("org.springframework.web.portlet.context.ConfigurablePortletApplicationContext")
|
||||
&& applicationContext instanceof ConfigurablePortletApplicationContext;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user