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 dd...@apache.org on 2006/12/06 02:21:49 UTC
svn commit: r482861 - in /portals/pluto/trunk:
pluto-container/src/main/java/org/apache/pluto/
pluto-container/src/main/java/org/apache/pluto/core/
pluto-container/src/main/java/org/apache/pluto/spi/optional/
pluto-portal-driver-impl/src/main/java/org/...
Author: ddewolf
Date: Tue Dec 5 17:21:46 2006
New Revision: 482861
URL: http://svn.apache.org/viewvc?view=rev&rev=482861
Log:
PLUTO-269 Hooking up the PortletInvokerService in the container. Thank you David Hay and David Krieg
Added:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java
- copied, changed from r481835, portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java
Removed:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java
Modified:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java
portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java?view=diff&rev=482861&r1=482860&r2=482861
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/OptionalContainerServices.java Tue Dec 5 17:21:46 2006
@@ -58,9 +58,8 @@
/**
* Returns an invoker for the specified PortletWindow.
*
- * @param portletWindow the InternalPortletWindow used for invocation.
* @return an invoker which can be used to service the indicated portlet.
*/
- PortletInvokerService getPortletInvokerService(InternalPortletWindow portletWindow);
+ PortletInvokerService getPortletInvokerService();
}
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java?view=diff&rev=482861&r1=482860&r2=482861
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/PortletContainerFactory.java Tue Dec 5 17:21:46 2006
@@ -17,8 +17,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.core.DefaultOptionalContainerServices;
import org.apache.pluto.core.PortletContainerImpl;
+import org.apache.pluto.core.DefaultOptionalContainerServices;
import org.apache.pluto.util.ArgumentUtility;
/**
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java?view=diff&rev=482861&r1=482860&r2=482861
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultOptionalContainerServices.java Tue Dec 5 17:21:46 2006
@@ -16,7 +16,6 @@
package org.apache.pluto.core;
import org.apache.pluto.OptionalContainerServices;
-import org.apache.pluto.internal.InternalPortletWindow;
import org.apache.pluto.spi.optional.PortletPreferencesService;
import org.apache.pluto.spi.optional.PortletEnvironmentService;
import org.apache.pluto.spi.optional.PortletInvokerService;
@@ -32,8 +31,10 @@
*/
public class DefaultOptionalContainerServices implements OptionalContainerServices {
- private PortletPreferencesService preferenceService;
+ private PortletPreferencesService portletPreferencesService;
private PortletRegistryService portletRegistryService;
+ private PortletInvokerService portletInvokerService;
+ private PortletEnvironmentService portletEnvironmentService;
/**
@@ -41,8 +42,10 @@
* implementation.
*/
public DefaultOptionalContainerServices() {
- preferenceService = new DefaultPortletPreferencesService();
+ portletPreferencesService = new DefaultPortletPreferencesService();
portletRegistryService = PortletContextManager.getManager();
+ portletInvokerService = new DefaultPortletInvokerService();
+ portletEnvironmentService = null;
}
/**
@@ -54,19 +57,27 @@
public DefaultOptionalContainerServices(OptionalContainerServices root) {
this();
if (root.getPortletPreferencesService() != null) {
- preferenceService = root.getPortletPreferencesService();
+ portletPreferencesService = root.getPortletPreferencesService();
}
if (root.getPortletRegistryService() != null) {
portletRegistryService = root.getPortletRegistryService();
}
+
+ if(root.getPortletEnvironmentService() != null) {
+ portletEnvironmentService = root.getPortletEnvironmentService();
+ }
+
+ if(root.getPortletInvokerService() != null) {
+ portletInvokerService = root.getPortletInvokerService();
+ }
}
// OptionalContainerServices Impl ------------------------------------------
public PortletPreferencesService getPortletPreferencesService() {
- return preferenceService;
+ return portletPreferencesService;
}
@@ -74,19 +85,12 @@
return portletRegistryService;
}
- /**
- * TODO:
- */
public PortletEnvironmentService getPortletEnvironmentService() {
- return null;
+ return portletEnvironmentService;
}
- /**
- * TODO:
- */
- public PortletInvokerService getPortletInvokerService(
- InternalPortletWindow window) {
- return null;
+ public PortletInvokerService getPortletInvokerService() {
+ return portletInvokerService;
}
}
Copied: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java (from r481835, portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java)
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java?view=diff&rev=482861&p1=portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java&r1=481835&p2=portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java&r2=482861
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletInvoker.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/DefaultPortletInvokerService.java Tue Dec 5 17:21:46 2006
@@ -15,26 +15,28 @@
*/
package org.apache.pluto.core;
-import java.io.IOException;
-
-import javax.portlet.PortletException;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pluto.Constants;
import org.apache.pluto.internal.InternalPortletWindow;
-import org.apache.pluto.internal.impl.ActionRequestImpl;
-import org.apache.pluto.internal.impl.ActionResponseImpl;
import org.apache.pluto.internal.impl.PortletRequestImpl;
import org.apache.pluto.internal.impl.PortletResponseImpl;
-import org.apache.pluto.internal.impl.RenderRequestImpl;
-import org.apache.pluto.internal.impl.RenderResponseImpl;
+import org.apache.pluto.spi.optional.PortletInvokerService;
import org.apache.pluto.util.StringManager;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
/**
* Used internally to invoke/dispatch requests from the container to
* the portlet application.
@@ -42,21 +44,18 @@
* @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
* @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a>
*/
-class PortletInvoker {
+public class DefaultPortletInvokerService implements PortletInvokerService {
/** Logger. */
- private static final Log LOG = LogFactory.getLog(PortletInvoker.class);
+ private static final Log LOG = LogFactory.getLog(DefaultPortletInvokerService.class);
/** Exception Messages. */
private static final StringManager EXCEPTIONS = StringManager.getManager(
- PortletInvoker.class.getPackage().getName());
+ DefaultPortletInvokerService.class.getPackage().getName());
// Private Member Variables ------------------------------------------------
-
- /** Portlet Window for which we are invoking the portlet. */
- private InternalPortletWindow portletWindow = null;
-
+
// Constructor -------------------------------------------------------------
@@ -64,10 +63,8 @@
* Default Constructor. Create a new invoker which
* is initialized for the given <code>InternalPortletWindow</code>.
*
- * @param portletWindow the portlet window.
*/
- public PortletInvoker(InternalPortletWindow portletWindow) {
- this.portletWindow = portletWindow;
+ public DefaultPortletInvokerService() {
}
@@ -78,18 +75,16 @@
*
* @param request action request used for the invocation.
* @param response action response used for the invocation.
- * @throws PortletException if a error occurs within the portlet.
- * @throws IOException if an IO error occurs writing the response.
*
* @see PortletServlet
* @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
*/
- public void action(ActionRequestImpl request, ActionResponseImpl response)
- throws PortletException, IOException {
+ public void action(ActionRequest request, ActionResponse response, InternalPortletWindow window)
+ throws IOException, PortletException {
if (LOG.isDebugEnabled()) {
LOG.debug("Performing Action Invocation");
}
- invoke(request, response, Constants.METHOD_ACTION);
+ invoke(request, response, window, Constants.METHOD_ACTION);
}
/**
@@ -97,18 +92,16 @@
*
* @param request action request used for the invocation.
* @param response action response used for the invocation.
- * @throws PortletException if a error occurs within the portlet.
- * @throws IOException if an IO error occurs writing the response.
*
* @see PortletServlet
* @see javax.portlet.Portlet#render(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
*/
- public void render(RenderRequestImpl request, RenderResponseImpl response)
- throws PortletException, IOException {
+ public void render(RenderRequest request, RenderResponse response, InternalPortletWindow window)
+ throws IOException, PortletException {
if (LOG.isDebugEnabled()) {
LOG.debug("Performing Render Invocation");
}
- invoke(request, response, Constants.METHOD_RENDER);
+ invoke(request, response, window, Constants.METHOD_RENDER);
}
/**
@@ -116,16 +109,15 @@
*
* @param request action request used for the invocation.
* @param response action response used for the invocation.
- * @throws PortletException if a error occurs within the portlet.
*
* @see PortletServlet
*/
- public void load(PortletRequestImpl request, PortletResponseImpl response)
- throws PortletException, IOException {
+ public void load(PortletRequest request, PortletResponse response, InternalPortletWindow window)
+ throws IOException, PortletException {
if (LOG.isDebugEnabled()) {
LOG.debug("Performing Load Invocation");
}
- invoke(request, response, Constants.METHOD_NOOP);
+ invoke(request, response, window, Constants.METHOD_NOOP);
}
@@ -136,12 +128,14 @@
*
* @param request portlet request
* @param response portlet response
+ * @param portletWindow internal portlet window
* @param methodID method identifier
* @throws PortletException if a portlet exception occurs.
* @throws IOException if an error occurs writing to the response.
*/
- private void invoke(PortletRequestImpl request,
- PortletResponseImpl response,
+ private void invoke(PortletRequest request,
+ PortletResponse response,
+ InternalPortletWindow portletWindow,
Integer methodID)
throws PortletException, IOException {
@@ -158,9 +152,9 @@
// Tomcat does not like to properly include wrapped requests
// and responses. Thus we "unwrap" and then include.
HttpServletRequest servletRequest =
- request.getHttpServletRequest();
+ ((PortletRequestImpl)request).getHttpServletRequest();
HttpServletResponse servletResponse =
- response.getHttpServletResponse();
+ ((PortletResponseImpl)response).getHttpServletResponse();
servletRequest.setAttribute(Constants.METHOD_ID, methodID);
servletRequest.setAttribute(Constants.PORTLET_REQUEST, request);
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java?view=diff&rev=482861&r1=482860&r2=482861
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java Tue Dec 5 17:21:46 2006
@@ -35,6 +35,7 @@
import org.apache.pluto.internal.impl.RenderRequestImpl;
import org.apache.pluto.internal.impl.RenderResponseImpl;
import org.apache.pluto.spi.PortletURLProvider;
+import org.apache.pluto.spi.optional.PortletInvokerService;
import org.apache.pluto.OptionalContainerServices;
import org.apache.pluto.PortletContainer;
import org.apache.pluto.PortletContainerException;
@@ -157,8 +158,8 @@
RenderResponseImpl renderResponse = new RenderResponseImpl(
this, internalPortletWindow, request, response);
- PortletInvoker invoker = new PortletInvoker(internalPortletWindow);
- invoker.render(renderRequest, renderResponse);
+ PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
+ invoker.render(renderRequest, renderResponse, internalPortletWindow);
debugWithName("Portlet rendered for: "
+ portletWindow.getPortletName());
}
@@ -191,8 +192,8 @@
ActionResponseImpl actionResponse = new ActionResponseImpl(
this, internalPortletWindow, request, response);
- PortletInvoker invoker = new PortletInvoker(internalPortletWindow);
- invoker.action(actionRequest, actionResponse);
+ PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
+ invoker.action(actionRequest, actionResponse, internalPortletWindow);
debugWithName("Portlet action processed for: "
+ portletWindow.getPortletName());
@@ -268,8 +269,8 @@
RenderResponseImpl renderResponse = new RenderResponseImpl(
this, internalPortletWindow, request, response);
- PortletInvoker invoker = new PortletInvoker(internalPortletWindow);
- invoker.load(renderRequest, renderResponse);
+ PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
+ invoker.load(renderRequest, renderResponse, internalPortletWindow);
debugWithName("Portlet loaded for: " + portletWindow.getPortletName());
}
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java?view=diff&rev=482861&r1=482860&r2=482861
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/spi/optional/PortletInvokerService.java Tue Dec 5 17:21:46 2006
@@ -23,6 +23,8 @@
import javax.portlet.RenderResponse;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import java.io.IOException;
/**
* Service used to invoke portlets.
@@ -30,10 +32,13 @@
*/
public interface PortletInvokerService {
- public void action(ActionRequest req, ActionResponse res, InternalPortletWindow window);
+ public void action(ActionRequest req, ActionResponse res, InternalPortletWindow window)
+ throws IOException, PortletException;
- public void render(RenderRequest req, RenderResponse res, InternalPortletWindow window);
+ public void render(RenderRequest req, RenderResponse res, InternalPortletWindow window)
+ throws IOException, PortletException;
- public void load(PortletRequest req, PortletResponse res, InternalPortletWindow window);
+ public void load(PortletRequest req, PortletResponse res, InternalPortletWindow window)
+ throws IOException, PortletException;
}
Modified: portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java?view=diff&rev=482861&r1=482860&r2=482861
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/ContainerServicesImpl.java Tue Dec 5 17:21:46 2006
@@ -91,7 +91,7 @@
return null;
}
- public PortletInvokerService getPortletInvokerService(InternalPortletWindow window) {
+ public PortletInvokerService getPortletInvokerService() {
return null;
}
}