You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by ta...@apache.org on 2008/10/22 04:05:17 UTC
svn commit: r706847 - in /portals/pluto/branches/2.0-spi-refactoring:
pluto-container-api/src/main/java/org/apache/pluto/spi/
pluto-container-api/src/main/java/org/apache/pluto/spi/optional/
pluto-container/src/main/java/org/apache/pluto/core/ pluto-co...
Author: taylor
Date: Tue Oct 21 19:05:16 2008
New Revision: 706847
URL: http://svn.apache.org/viewvc?rev=706847&view=rev
Log:
https://issues.apache.org/jira/browse/PLUTO-481
Added:
portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/RequestPropertyProvider.java
portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/RequestPropertyProviderImpl.java
Modified:
portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/PortalCallbackService.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultRequestAttributeService.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PlutoContainerServices.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderRequestImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java
portals/pluto/branches/2.0-spi-refactoring/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/PortalCallbackService.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/PortalCallbackService.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/PortalCallbackService.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/PortalCallbackService.java Tue Oct 21 19:05:16 2008
@@ -16,14 +16,10 @@
*/
package org.apache.pluto.spi;
-import java.util.Map;
-
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import org.apache.pluto.PortletWindow;
import org.apache.pluto.om.portlet.PortletApplicationDefinition;
-import org.w3c.dom.Element;
/**
* The callback service interface defining callback methods that will be invoked
@@ -62,36 +58,14 @@
public ResourceURLProvider getResourceURLProvider(HttpServletRequest request,
PortletWindow portletWindow);
- public Map getRequestProperties(HttpServletRequest request,
- PortletWindow portletWindow);
-
- public void setResponseProperty(HttpServletRequest request,
- PortletWindow portletWindow,
- String property,
- String value);
-
- public void addResponseProperty(HttpServletRequest request,
- PortletWindow portletWindow,
- String property,
- String value);
- public void addResponseProperty(HttpServletRequest request,
- PortletWindow portletWindow,
- String property,
- Element value);
-
- public void addResponseProperty(HttpServletRequest request,
- PortletWindow portletWindow,
- Cookie cookie);
-
- public Cookie[] getRequestPropertyCookie(HttpServletRequest request, PortletWindow portletWindow);
+ public RequestPropertyProvider getRequestPropertyProvider();
+
public EventProvider getEventProvider(HttpServletRequest request,
PortletWindow portletWindow);
public EventProvider getEventProvider();
-
-
/**
* Returns the FilterManager, this is used to process the filter.
* @return FilterManager
Added: portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/RequestPropertyProvider.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/RequestPropertyProvider.java?rev=706847&view=auto
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/RequestPropertyProvider.java (added)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/RequestPropertyProvider.java Tue Oct 21 19:05:16 2008
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.pluto.spi;
+
+import java.util.Map;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.pluto.PortletWindow;
+import org.w3c.dom.Element;
+
+public interface RequestPropertyProvider
+{
+ public Map getProperties(HttpServletRequest request,
+ PortletWindow portletWindow);
+
+ public void setProperty(HttpServletRequest request,
+ PortletWindow portletWindow, String property, String value);
+
+ public void addProperty(HttpServletRequest request,
+ PortletWindow portletWindow, String property, String value);
+
+ public void addProperty(HttpServletRequest request,
+ PortletWindow portletWindow, String property, Element value);
+
+ public void addCookieProperty(HttpServletRequest request,
+ PortletWindow portletWindow, Cookie cookie);
+
+ public Cookie[] getCookieProperty(
+ HttpServletRequest request, PortletWindow portletWindow);
+
+}
+
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container-api/src/main/java/org/apache/pluto/spi/optional/PortalAdministrationService.java Tue Oct 21 19:05:16 2008
@@ -44,10 +44,8 @@
* </li>
* </ul>
*/
-public interface PortalAdministrationService {
-
- List getAdministrativeRequestListeners();
-
- List getPortletInvocationListeners();
-
+public interface PortalAdministrationService
+{
+ List<AdministrativeRequestListener> getAdministrativeRequestListeners();
+ List<PortletInvocationListener> getPortletInvocationListeners();
}
\ No newline at end of file
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java Tue Oct 21 19:05:16 2008
@@ -58,8 +58,8 @@
portletInfoService = new DefaultPortletInfoService();
portalAdministrationService = new DefaultPortalAdministrationService();
userInfoService = new DefaultUserInfoService();
- requestAttributeService = new DefaultRequestAttributeService(this);
namespaceMapper = new DefaultNamespaceMapper();
+ requestAttributeService = new DefaultRequestAttributeService(namespaceMapper, userInfoService);
}
/**
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortalAdministrationService.java Tue Oct 21 19:05:16 2008
@@ -24,35 +24,38 @@
import org.apache.pluto.spi.optional.PortalAdministrationService;
import org.apache.pluto.spi.optional.PortletInvocationListener;
-public class DefaultPortalAdministrationService implements PortalAdministrationService {
+public class DefaultPortalAdministrationService implements PortalAdministrationService
+{
+ private List<AdministrativeRequestListener> administrativeRequestListeners =new ArrayList<AdministrativeRequestListener>();
+ private List<PortletInvocationListener> portletInvocationListeners = new ArrayList<PortletInvocationListener>();
- private List administrativeRequestListeners =
- new ArrayList();
-
- private List portletInvocationListeners =
- new ArrayList();
-
- public List getAdministrativeRequestListeners() {
+ public List<AdministrativeRequestListener> getAdministrativeRequestListeners()
+ {
return administrativeRequestListeners;
}
- public void setAdministrativeRequestListeners(List administrativeRequestListeners) {
+ public void setAdministrativeRequestListeners(List<AdministrativeRequestListener> administrativeRequestListeners)
+ {
this.administrativeRequestListeners = administrativeRequestListeners;
}
- public void addAdministrativeRequestListener(AdministrativeRequestListener listener) {
+ public void addAdministrativeRequestListener(AdministrativeRequestListener listener)
+ {
administrativeRequestListeners.add(listener);
}
- public List getPortletInvocationListeners() {
+ public List<PortletInvocationListener> getPortletInvocationListeners()
+ {
return portletInvocationListeners;
}
- public void setPortletInvocationListeners(List portletInvocationListeners) {
+ public void setPortletInvocationListeners(List<PortletInvocationListener> portletInvocationListeners)
+ {
this.portletInvocationListeners = portletInvocationListeners;
}
- public void addPortletInvocationListener(PortletInvocationListener listener) {
+ public void addPortletInvocationListener(PortletInvocationListener listener)
+ {
portletInvocationListeners.add(listener);
}
}
\ No newline at end of file
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultRequestAttributeService.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultRequestAttributeService.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultRequestAttributeService.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/DefaultRequestAttributeService.java Tue Oct 21 19:05:16 2008
@@ -18,7 +18,6 @@
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -29,12 +28,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pluto.NamespaceMapper;
-import org.apache.pluto.OptionalContainerServices;
import org.apache.pluto.PortletContainerException;
import org.apache.pluto.PortletWindow;
import org.apache.pluto.PortletWindowID;
-import org.apache.pluto.om.portlet.UserAttribute;
-import org.apache.pluto.spi.optional.PortletRegistryService;
import org.apache.pluto.spi.optional.RequestAttributeService;
import org.apache.pluto.spi.optional.UserInfoService;
@@ -49,21 +45,19 @@
private static final Log LOG = LogFactory.getLog(DefaultRequestAttributeService.class);
- private OptionalContainerServices optionalContainerServices;
+ private NamespaceMapper namespaceMapper;
+ private UserInfoService userInfoService;
- public DefaultRequestAttributeService() {
+ public DefaultRequestAttributeService()
+ {
}
- public DefaultRequestAttributeService(OptionalContainerServices optionalContainerServices) {
- this.optionalContainerServices = optionalContainerServices;
+ public DefaultRequestAttributeService(NamespaceMapper namespaceMapper, UserInfoService userInfoService)
+ {
+ this.namespaceMapper = namespaceMapper;
+ this.userInfoService = userInfoService;
}
- public OptionalContainerServices getOptionalContainerServices() {
- return optionalContainerServices;
- }
- public void setOptionalContainerServices(OptionalContainerServices optionalContainerServices) {
- this.optionalContainerServices = optionalContainerServices;
- }
/* (non-Javadoc)
* @see org.apache.pluto.spi.optional.RequestAttributeService#getAttribute(javax.portlet.PortletRequest, javax.servlet.http.HttpServletRequest, org.apache.pluto.PortletWindow, java.lang.String)
@@ -105,7 +99,7 @@
}
else {
final PortletWindowID portletWindowId = portletWindow.getId();
- final NamespaceMapper namespaceMapper = this.optionalContainerServices.getNamespaceMapper();
+ final NamespaceMapper namespaceMapper = this.namespaceMapper;
portletAttribute = namespaceMapper.decode(portletWindowId, attribute);
}
@@ -162,7 +156,7 @@
}
else {
final PortletWindowID portletWindowId = portletWindow.getId();
- final NamespaceMapper namespaceMapper = this.optionalContainerServices.getNamespaceMapper();
+ final NamespaceMapper namespaceMapper = this.namespaceMapper;
encodedName = namespaceMapper.encode(portletWindowId, name);
}
return encodedName;
@@ -175,7 +169,7 @@
protected Map<String, String> createUserInfoMap(PortletRequest portletRequest, PortletWindow portletWindow) {
Map<String, String> userInfoMap = null;
try {
- final UserInfoService userInfoService = this.optionalContainerServices.getUserInfoService();
+ final UserInfoService userInfoService = this.userInfoService;
userInfoMap = userInfoService.getUserInfo(portletRequest, portletWindow);
if (userInfoMap != null) {
userInfoMap = Collections.unmodifiableMap(userInfoMap);
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PlutoContainerServices.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PlutoContainerServices.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PlutoContainerServices.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PlutoContainerServices.java Tue Oct 21 19:05:16 2008
@@ -114,7 +114,7 @@
userInfoService = new DefaultUserInfoService();
requestAttributeService = optionalServices.getRequestAttributeService();
if (requestAttributeService == null)
- requestAttributeService = new DefaultRequestAttributeService(this);
+ requestAttributeService = new DefaultRequestAttributeService(optionalServices.getNamespaceMapper(), optionalServices.getUserInfoService());
namespaceMapper = optionalServices.getNamespaceMapper();
if (namespaceMapper == null)
namespaceMapper = new DefaultNamespaceMapper();
@@ -130,8 +130,9 @@
portletInfoService = new DefaultPortletInfoService();
portalAdministrationService = new DefaultPortalAdministrationService();
userInfoService = new DefaultUserInfoService();
- requestAttributeService = new DefaultRequestAttributeService(this);
namespaceMapper = new DefaultNamespaceMapper();
+ requestAttributeService = new DefaultRequestAttributeService(namespaceMapper, userInfoService);
+
}
protected void createDefaultRequiredServices()
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java Tue Oct 21 19:05:16 2008
@@ -279,12 +279,13 @@
PortletURLProvider portletURLProvider = requiredContainerServices.getPortalCallbackService().getPortletURLProvider(request, portletWindow);
portletURLProvider.savePortalURL(request);
- saveChangedParameters((PortletRequest)actionRequest, (StateAwareResponseImpl)actionResponse, portletURLProvider);
+ saveChangedParameters(request, (PortletRequest)actionRequest, (StateAwareResponseImpl)actionResponse, portletURLProvider);
EventProvider provider = this.getRequiredContainerServices().getPortalCallbackService().
getEventProvider(request,portletWindow);
provider.fireEvents(this);
+
// After processing action, send a redirect URL for rendering.
String location = actionResponse.getRedirectLocation();
@@ -296,18 +297,23 @@
.getPortalCallbackService()
.getPortletURLProvider(request, portletWindow);
- saveChangedParameters((PortletRequest)actionRequest, (StateAwareResponseImpl)actionResponse, redirectURL);
+ saveChangedParameters(request, (PortletRequest)actionRequest, (StateAwareResponseImpl)actionResponse, redirectURL);
// Encode the redirect URL to a string.
location = actionResponse.encodeRedirectURL(redirectURL.toString());
}
+ redirect(request, response, location);
+ }
+
+ protected void redirect(HttpServletRequest request, HttpServletResponse response, String location) throws IOException
+ {
// Here we intentionally use the original response
- // instead of the wrapped internal response.
+ // instead of the wrapped internal response.
response.sendRedirect(location);
- debugWithName("Redirect URL sent.");
+ debugWithName("Redirect URL sent.");
}
-
+
/**
* Loads the portlet associated with the specified portlet window.
* @param portletWindow the portlet window.
@@ -457,7 +463,7 @@
.getPortalCallbackService()
.getPortletURLProvider(request, window);
- saveChangedParameters(eventRequest, eventResponse, redirectURL);
+ saveChangedParameters(request, eventRequest, eventResponse, redirectURL);
// save redirectURL in request
redirectURL.savePortalURL(request);
@@ -517,7 +523,8 @@
* @param response
* @param redirectURL
*/
- private void saveChangedParameters(PortletRequest request, StateAwareResponseImpl response, PortletURLProvider redirectURL) {
+ protected void saveChangedParameters(HttpServletRequest servletRequest, PortletRequest request, StateAwareResponseImpl response, PortletURLProvider redirectURL)
+ {
// Encode portlet mode if it is changed.
if (response.getChangedPortletMode() != null) {
redirectURL.setPortletMode(
@@ -564,7 +571,8 @@
*
* @return true, if already cleared
*/
- private boolean isAlreadyCleared(PortletRequest request) {
+ protected boolean isAlreadyCleared(PortletRequest request)
+ {
String cleared = (String) request.getAttribute(Constants.RENDER_ALREADY_CLEARED);
if (cleared == null || cleared.equals("false")) {
request.setAttribute(Constants.RENDER_ALREADY_CLEARED,"true");
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionRequestImpl.java Tue Oct 21 19:05:16 2008
@@ -83,7 +83,7 @@
}
public Cookie[] getCookieProperties() {
- return container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyCookie(getHttpServletRequest(), portletWindow);
+ return container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyProvider().getCookieProperty(getHttpServletRequest(), portletWindow);
}
/////////////////////////////////////////////////////////////////////////////////////////
//for RequestDispatcher include and forward
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java Tue Oct 21 19:05:16 2008
@@ -376,12 +376,12 @@
}
public void addProperty(String key, String value) {
- container.getRequiredContainerServices().getPortalCallbackService().addResponseProperty(servletRequest, portletWindow, key, value);
+ container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyProvider().addProperty(servletRequest, portletWindow, key, value);
}
public void setProperty(String key, String value) {
- container.getRequiredContainerServices().getPortalCallbackService().setResponseProperty(servletRequest, portletWindow, key, value);
+ container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyProvider().setProperty(servletRequest, portletWindow, key, value);
}
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/EventRequestImpl.java Tue Oct 21 19:05:16 2008
@@ -97,7 +97,7 @@
}
public Cookie[] getCookieProperties() {
- return container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyCookie(super.getHttpServletRequest(), super.getPortletWindow());
+ return container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyProvider().getCookieProperty(super.getHttpServletRequest(), super.getPortletWindow());
}
public String getMethod(){
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java Tue Oct 21 19:05:16 2008
@@ -284,8 +284,8 @@
String property = this.getHttpServletRequest().getHeader(name);
if (property == null) {
Map propertyMap = container.getRequiredContainerServices()
- .getPortalCallbackService()
- .getRequestProperties(
+ .getPortalCallbackService().getRequestPropertyProvider()
+ .getProperties(
getHttpServletRequest(),
portletWindow);
@@ -311,11 +311,7 @@
// get properties from PropertyManager
Map map = container.getRequiredContainerServices()
- .getPortalCallbackService()
- .getRequestProperties(
- getHttpServletRequest(),
- portletWindow);
-
+ .getPortalCallbackService().getRequestPropertyProvider().getProperties(getHttpServletRequest(), portletWindow);
if (map != null) {
String[] properties = (String[]) map.get(name);
@@ -335,8 +331,8 @@
// get properties from PropertyManager
Map map = container.getRequiredContainerServices()
- .getPortalCallbackService()
- .getRequestProperties(getHttpServletRequest(), portletWindow);
+ .getPortalCallbackService().getRequestPropertyProvider()
+ .getProperties(getHttpServletRequest(), portletWindow);
if (map != null) {
v.addAll(map.keySet());
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java Tue Oct 21 19:05:16 2008
@@ -100,8 +100,8 @@
public void addProperty(String name, String value) {
ArgumentUtility.validateNotNull("propertyName", name);
container.getRequiredContainerServices()
- .getPortalCallbackService()
- .addResponseProperty(
+ .getPortalCallbackService().getRequestPropertyProvider()
+ .addProperty(
getHttpServletRequest(),
portletWindow,
name, value);
@@ -111,27 +111,27 @@
// FIXME: What should this do? (scope seems to be new)
ArgumentUtility.validateNotNull("propertyName", name);
container.getRequiredContainerServices()
- .getPortalCallbackService()
- .addResponseProperty(
+ .getPortalCallbackService().getRequestPropertyProvider()
+ .addProperty(
getHttpServletRequest(),
portletWindow,
name, value);
}
public void addProperty(String key, Element element) {
- container.getRequiredContainerServices().getPortalCallbackService().addResponseProperty(getHttpServletRequest(), portletWindow, key, element);
+ container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyProvider().addProperty(getHttpServletRequest(), portletWindow, key, element);
}
public void addProperty(Cookie cookie) {
- container.getRequiredContainerServices().getPortalCallbackService().addResponseProperty(getHttpServletRequest(), portletWindow, cookie);
+ container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyProvider().addCookieProperty(getHttpServletRequest(), portletWindow, cookie);
}
public void setProperty(String name, String value) {
ArgumentUtility.validateNotNull("propertyName", name);
container.getRequiredContainerServices()
- .getPortalCallbackService()
- .setResponseProperty(
+ .getPortalCallbackService().getRequestPropertyProvider()
+ .setProperty(
getHttpServletRequest(),
portletWindow,
name, value);
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderRequestImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderRequestImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/RenderRequestImpl.java Tue Oct 21 19:05:16 2008
@@ -265,6 +265,6 @@
}
public Cookie[] getCookieProperties() {
- return container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyCookie(this, portletWindow);
+ return container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyProvider().getCookieProperty(this, portletWindow);
}
}
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java Tue Oct 21 19:05:16 2008
@@ -147,7 +147,7 @@
}
public Cookie[] getCookieProperties() {
- return container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyCookie(this, portletWindow);
+ return container.getRequiredContainerServices().getPortalCallbackService().getRequestPropertyProvider().getCookieProperty(this, portletWindow);
}
public ServletInputStream getInputStream() throws IOException {
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortalCallbackServiceImpl.java Tue Oct 21 19:05:16 2008
@@ -31,6 +31,7 @@
import org.apache.pluto.spi.PortalCallbackService;
import org.apache.pluto.spi.PortletURLListener;
import org.apache.pluto.spi.PortletURLProvider;
+import org.apache.pluto.spi.RequestPropertyProvider;
import org.apache.pluto.spi.ResourceURLProvider;
import org.w3c.dom.Element;
@@ -40,20 +41,15 @@
* @version 1.0
* @since Sep 22, 2004
*/
-public class PortalCallbackServiceImpl implements PortalCallbackService {
-
- // Constructor -------------------------------------------------------------
-
- /**
- * Default no-arg constructor.
- */
- public PortalCallbackServiceImpl() {
- // Do nothing.
+public class PortalCallbackServiceImpl implements PortalCallbackService
+{
+ RequestPropertyProvider propertyProvider;
+
+ public PortalCallbackServiceImpl(RequestPropertyProvider provider)
+ {
+ this.propertyProvider = provider;
}
-
-
- // PortalCallbackService Impl ----------------------------------------------
-
+
/**
* Method invoked by the container when the portlet sets its title. This
* method binds the dynamic portlet title to the servlet request for later
@@ -77,69 +73,9 @@
return new ResourceURLProviderImpl(request, portletWindow);
}
- public Map getRequestProperties(HttpServletRequest request,
- PortletWindow portletWindow) {
- // TODO: currently this method returns an empty map.
- return Collections.EMPTY_MAP;
- }
-
- public void setResponseProperty(HttpServletRequest request,
- PortletWindow portletWindow,
- String property,
- String value) {
- request.setAttribute(property + portletWindow.getId().getStringId() + "__str", value);
- }
-
- public void addResponseProperty(HttpServletRequest request,
- PortletWindow portletWindow,
- String property,
- String value) {
- if(request.getAttribute(property+portletWindow.getId().getStringId())== null){
- request.setAttribute(property + portletWindow.getId().getStringId(), value);
- }
- else{
- String[] tmp = (String[]) request.getAttribute(property+portletWindow.getId().getStringId()+"__str");
- String[] values = new String[tmp.length];
- for (int i = 0; i < tmp.length;i++) {
- values[i] = tmp[i];
- }
- values[tmp.length]= value;
- }
- }
-
- public void addResponseProperty(HttpServletRequest request, PortletWindow portletWindow, String property, Element value) {
- if(request.getAttribute(property+portletWindow.getId().getStringId())== null){
- request.setAttribute(property + portletWindow.getId().getStringId(), value);
- }
- else{
- String[] tmp = (String[]) request.getAttribute(property+portletWindow.getId().getStringId()+"__str");
- String[] values = new String[tmp.length];
- for (int i = 0; i < tmp.length;i++) {
- values[i] = tmp[i];
- }
- values[tmp.length]= value.toString();
- }
-
- }
-
- public void addResponseProperty(HttpServletRequest request,
- PortletWindow portletWindow,
- Cookie cookie){
- if(request.getAttribute(portletWindow.getId().getStringId()+"__coo")== null){
- request.setAttribute(portletWindow.getId().getStringId()+"__coo", cookie);
- }
- else{
- Cookie[] tmp = (Cookie[]) request.getAttribute(portletWindow.getId().getStringId()+"__coo");
- Cookie[] values = new Cookie[tmp.length];
- for (int i = 0; i < tmp.length;i++) {
- values[i] = tmp[i];
- }
- values[tmp.length]= cookie;
- }
- }
-
- public Cookie[] getRequestPropertyCookie(HttpServletRequest request, PortletWindow portletWindow){
- return (Cookie[]) request.getAttribute(portletWindow.getId().getStringId()+"__coo");
+ public RequestPropertyProvider getRequestPropertyProvider()
+ {
+ return propertyProvider;
}
public EventProvider getEventProvider(
Added: portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/RequestPropertyProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/RequestPropertyProviderImpl.java?rev=706847&view=auto
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/RequestPropertyProviderImpl.java (added)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/RequestPropertyProviderImpl.java Tue Oct 21 19:05:16 2008
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.pluto.driver.services.container;
+
+import java.util.Collections;
+import java.util.Map;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.spi.RequestPropertyProvider;
+import org.w3c.dom.Element;
+
+/**
+ * Optional property provider
+ * (callbacks) TODO: 2.2 implement PropertyManager related functionality
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class RequestPropertyProviderImpl implements RequestPropertyProvider
+{
+ public RequestPropertyProviderImpl()
+ {}
+
+ public Map getProperties(HttpServletRequest request,
+ PortletWindow portletWindow)
+ {
+ // TODO: currently this method returns an empty map.
+ return Collections.EMPTY_MAP;
+ }
+
+ public void setProperty(HttpServletRequest request,
+ PortletWindow portletWindow, String property, String value)
+ {
+ request.setAttribute(property + portletWindow.getId().getStringId()
+ + "__str", value);
+ }
+
+ public void addProperty(HttpServletRequest request,
+ PortletWindow portletWindow, String property, String value)
+ {
+ if (request
+ .getAttribute(property + portletWindow.getId().getStringId()) == null)
+ {
+ request.setAttribute(
+ property + portletWindow.getId().getStringId(), value);
+ }
+ else
+ {
+ String[] tmp = (String[]) request.getAttribute(property
+ + portletWindow.getId().getStringId() + "__str");
+ String[] values = new String[tmp.length];
+ for (int i = 0; i < tmp.length; i++)
+ {
+ values[i] = tmp[i];
+ }
+ values[tmp.length] = value;
+ }
+ }
+
+ public void addProperty(HttpServletRequest request,
+ PortletWindow portletWindow, String property, Element value)
+ {
+ if (request
+ .getAttribute(property + portletWindow.getId().getStringId()) == null)
+ {
+ request.setAttribute(
+ property + portletWindow.getId().getStringId(), value);
+ }
+ else
+ {
+ String[] tmp = (String[]) request.getAttribute(property
+ + portletWindow.getId().getStringId() + "__str");
+ String[] values = new String[tmp.length];
+ for (int i = 0; i < tmp.length; i++)
+ {
+ values[i] = tmp[i];
+ }
+ values[tmp.length] = value.toString();
+ }
+
+ }
+
+ public void addCookieProperty(HttpServletRequest request,
+ PortletWindow portletWindow, Cookie cookie)
+ {
+ if (request.getAttribute(portletWindow.getId().getStringId() + "__coo") == null)
+ {
+ request.setAttribute(portletWindow.getId().getStringId() + "__coo",
+ cookie);
+ }
+ else
+ {
+ Cookie[] tmp = (Cookie[]) request.getAttribute(portletWindow
+ .getId().getStringId()
+ + "__coo");
+ Cookie[] values = new Cookie[tmp.length];
+ for (int i = 0; i < tmp.length; i++)
+ {
+ values[i] = tmp[i];
+ }
+ values[tmp.length] = cookie;
+ }
+ }
+
+ public Cookie[] getCookieProperty(HttpServletRequest request,
+ PortletWindow portletWindow)
+ {
+ return (Cookie[]) request.getAttribute(portletWindow.getId()
+ .getStringId()
+ + "__coo");
+ }
+
+}
Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml?rev=706847&r1=706846&r2=706847&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml (original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml Tue Oct 21 19:05:16 2008
@@ -137,6 +137,12 @@
<bean id="PortalCallbackService"
class="org.apache.pluto.driver.services.container.PortalCallbackServiceImpl"
singleton="true">
+ <constructor-arg><ref bean="RequestPropertyProvider"/></constructor-arg>
+ </bean>
+
+ <bean id="RequestPropertyProvider"
+ class="org.apache.pluto.driver.services.container.RequestPropertyProviderImpl"
+ singleton="true">
</bean>
<bean id="CCPPProfileService"