{
-
- /**
- * The wrapped portlet request, providing access to the session.
- */
- private PortletRequest request;
-
- /**
- * Create a map wrapping the session of given request.
- */
- public PortletSessionMap(PortletRequest request) {
- this.request = request;
- }
-
- /**
- * Internal helper to get the portlet session associated with the wrapped request, or null if there is no such
- * session.
- *
- * Note that this method will not force session creation.
- */
- private PortletSession getSession() {
- return request.getPortletSession(false);
- }
-
- protected Object getAttribute(String key) {
- PortletSession session = getSession();
- if (session == null) {
- return null;
- }
- Object value = session.getAttribute(key);
- if (value instanceof HttpSessionMapBindingListener) {
- // unwrap
- return ((HttpSessionMapBindingListener) value).getListener();
- } else {
- return value;
- }
- }
-
- protected void setAttribute(String key, Object value) {
- // force session creation
- PortletSession session = request.getPortletSession(true);
- if (value instanceof AttributeMapBindingListener) {
- // wrap
- session.setAttribute(key, new HttpSessionMapBindingListener((AttributeMapBindingListener) value, this));
- } else {
- session.setAttribute(key, value);
- }
- }
-
- protected void removeAttribute(String key) {
- PortletSession session = getSession();
- if (session != null) {
- session.removeAttribute(key);
- }
- }
-
- protected Iterator getAttributeNames() {
- PortletSession session = getSession();
- return session == null ? CollectionUtils. emptyIterator() : CollectionUtils.toIterator(session
- .getAttributeNames());
- }
-
- public Object getMutex() {
- // force session creation
- PortletSession session = request.getPortletSession(true);
- Object mutex = session.getAttribute(WebUtils.SESSION_MUTEX_ATTRIBUTE);
- return mutex != null ? mutex : session;
- }
-}
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/package-info.java b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/package-info.java
deleted file mode 100644
index fdabfe82..00000000
--- a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2004-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Contains the PortletExternalContext implementation for calling into Web Flow from a Portlet.
- */
-package org.springframework.webflow.context.portlet;
-
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/FilenameFlowUrlHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/FilenameFlowUrlHandler.java
index 8493c61b..11bcdcae 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/FilenameFlowUrlHandler.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/FilenameFlowUrlHandler.java
@@ -19,7 +19,6 @@ import javax.servlet.http.HttpServletRequest;
import org.springframework.util.StringUtils;
import org.springframework.web.util.UrlPathHelper;
-import org.springframework.web.util.WebUtils;
import org.springframework.webflow.core.collection.AttributeMap;
import org.springframework.webflow.mvc.servlet.FlowController;
@@ -68,7 +67,30 @@ public class FilenameFlowUrlHandler extends DefaultFlowUrlHandler {
}
public String getFlowId(HttpServletRequest request) {
- return WebUtils.extractFilenameFromUrlPath(urlPathHelper.getLookupPathForRequest(request));
+ return extractFilenameFromUrlPath(urlPathHelper.getLookupPathForRequest(request));
+ }
+
+ public static String extractFilenameFromUrlPath(String urlPath) {
+ String filename = extractFullFilenameFromUrlPath(urlPath);
+ int dotIndex = filename.lastIndexOf('.');
+ if (dotIndex != -1) {
+ filename = filename.substring(0, dotIndex);
+ }
+ return filename;
+ }
+
+ public static String extractFullFilenameFromUrlPath(String urlPath) {
+ int end = urlPath.indexOf('?');
+ if (end == -1) {
+ end = urlPath.indexOf('#');
+ if (end == -1) {
+ end = urlPath.length();
+ }
+ }
+ int begin = urlPath.lastIndexOf('/', end) + 1;
+ int paramIndex = urlPath.indexOf(';', begin);
+ end = (paramIndex != -1 && paramIndex < end ? paramIndex : end);
+ return urlPath.substring(begin, end);
}
/**
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcEnvironment.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcEnvironment.java
index d5c9db86..20c1a9a7 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcEnvironment.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcEnvironment.java
@@ -16,9 +16,7 @@
package org.springframework.webflow.mvc.builder;
import org.springframework.context.ApplicationContext;
-import org.springframework.util.ClassUtils;
import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.portlet.context.ConfigurablePortletApplicationContext;
/**
* Supported Spring Web MVC environments.
@@ -43,18 +41,11 @@ public enum MvcEnvironment {
* @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", MvcEnvironment.class.getClassLoader()) && isPortletApplicationContext(applicationContext)) {
- return MvcEnvironment.PORTLET;
- } else if (applicationContext instanceof WebApplicationContext) {
+ if (applicationContext instanceof WebApplicationContext) {
return MvcEnvironment.SERVLET;
} else {
return null;
}
}
- private static boolean isPortletApplicationContext(ApplicationContext applicationContext) {
- return ClassUtils.isPresent("org.springframework.web.portlet.context.ConfigurablePortletApplicationContext", MvcEnvironment.class.getClassLoader())
- && applicationContext instanceof ConfigurablePortletApplicationContext;
- }
-
}
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcViewFactoryCreator.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcViewFactoryCreator.java
index 3760f8ed..623ab598 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcViewFactoryCreator.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/builder/MvcViewFactoryCreator.java
@@ -33,7 +33,6 @@ import org.springframework.web.servlet.ViewResolver;
import org.springframework.webflow.engine.builder.BinderConfiguration;
import org.springframework.webflow.engine.builder.ViewFactoryCreator;
import org.springframework.webflow.execution.ViewFactory;
-import org.springframework.webflow.mvc.portlet.PortletMvcViewFactory;
import org.springframework.webflow.mvc.servlet.ServletMvcViewFactory;
import org.springframework.webflow.mvc.view.AbstractMvcViewFactory;
import org.springframework.webflow.mvc.view.FlowViewResolver;
@@ -52,7 +51,6 @@ import org.springframework.webflow.validation.WebFlowMessageCodesResolver;
* pre-existing Spring MVC {@link ViewResolver view resolvers}.
*
* @see ServletMvcViewFactory
- * @see PortletMvcViewFactory
* @see FlowResourceFlowViewResolver
* @see DelegatingFlowViewResolver
*
@@ -198,9 +196,6 @@ public class MvcViewFactoryCreator implements ViewFactoryCreator, ApplicationCon
if (environment == MvcEnvironment.SERVLET) {
return new ServletMvcViewFactory(viewId, flowViewResolver, expressionParser, conversionService,
binderConfiguration, messageCodesResolver);
- } else if (environment == MvcEnvironment.PORTLET) {
- return new PortletMvcViewFactory(viewId, flowViewResolver, expressionParser, conversionService,
- binderConfiguration, messageCodesResolver);
} else {
throw new IllegalStateException("Web MVC Environment " + environment + " not supported ");
}
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/portlet/AbstractFlowHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/portlet/AbstractFlowHandler.java
deleted file mode 100644
index e67cab61..00000000
--- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/portlet/AbstractFlowHandler.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2004-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.webflow.mvc.portlet;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletRequest;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.ResourceRequest;
-import javax.portlet.ResourceResponse;
-
-import org.springframework.webflow.core.FlowException;
-import org.springframework.webflow.core.collection.MutableAttributeMap;
-import org.springframework.webflow.execution.FlowExecutionOutcome;
-
-/**
- * Trivial flow handler base class that simply returns null for all operations. Subclasses should extend and override
- * which operations they need.
- *
- * @author Keith Donald
- * @author Rossen Stoyanchev
- */
-public class AbstractFlowHandler implements FlowHandler {
-
- public String getFlowId() {
- return null;
- }
-
- public MutableAttributeMap