Author: julien(a)jboss.com
Date: 2008-02-29 12:41:05 -0500 (Fri, 29 Feb 2008)
New Revision: 10160
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java
Log:
rename of TestPortletInvocationContext to ControllerPortletInvocationContext
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java 2008-02-29
17:35:48 UTC (rev 10159)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/AbstractPortletControllerContext.java 2008-02-29
17:41:05 UTC (rev 10160)
@@ -43,7 +43,6 @@
import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.spi.PortalContext;
@@ -126,12 +125,13 @@
public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws
PortletInvokerException
{
+ ControllerPortletInvocationContext context =
(ControllerPortletInvocationContext)actionInvocation.getContext();
- TestPortletInvocationContext context =
(TestPortletInvocationContext)actionInvocation.getContext();
+ //
String windowId = context.getWindowId();
-
Portlet portlet = getPortlet(windowId);
+ //
actionInvocation.setClientContext(new AbstractClientContext(req));
actionInvocation.setServerContext(new AbstractServerContext(req, resp));
actionInvocation.setInstanceContext(new
AbstractInstanceContext(portlet.getContext().getId()));
@@ -142,16 +142,19 @@
actionInvocation.setRequestContext(new AbstractRequestContext(req));
actionInvocation.setTarget(portlet.getContext());
+ //
return invoke((PortletInvocation)actionInvocation);
}
public PortletInvocationResponse invoke(List<Cookie> requestCookies,
EventInvocation eventInvocation) throws PortletInvokerException
{
- TestPortletInvocationContext context =
(TestPortletInvocationContext)eventInvocation.getContext();
+ ControllerPortletInvocationContext context =
(ControllerPortletInvocationContext)eventInvocation.getContext();
+
+ //
String windowId = context.getWindowId();
-
Portlet portlet = getPortlet(windowId);
+ //
eventInvocation.setClientContext(new AbstractClientContext(req, requestCookies));
eventInvocation.setServerContext(new AbstractServerContext(req, resp));
eventInvocation.setInstanceContext(new
AbstractInstanceContext(portlet.getContext().getId()));
@@ -161,16 +164,19 @@
eventInvocation.setSecurityContext(new AbstractSecurityContext(req));
eventInvocation.setTarget(portlet.getContext());
+ //
return invoke(eventInvocation);
}
public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws
PortletInvokerException
{
- TestPortletInvocationContext context =
(TestPortletInvocationContext)resourceInvocation.getContext();
+ ControllerPortletInvocationContext context =
(ControllerPortletInvocationContext)resourceInvocation.getContext();
+
+ //
String windowId = context.getWindowId();
-
Portlet portlet = getPortlet(windowId);
+ //
resourceInvocation.setClientContext(new AbstractClientContext(req));
resourceInvocation.setServerContext(new AbstractServerContext(req, resp));
resourceInvocation.setInstanceContext(new
AbstractInstanceContext(portlet.getContext().getId()));
@@ -185,8 +191,10 @@
return invoke((PortletInvocation)resourceInvocation);
}
- public PortletInvocationContext createPortletInvocationContext(String windowId,
PageNavigationalState pageNavigationalState)
+ public PortletInvocationContext createPortletInvocationContext(
+ String windowId,
+ PageNavigationalState pageNavigationalState)
{
- return new TestPortletInvocationContext(getPageNavigationalStateSerialization(),
req, resp, windowId, pageNavigationalState, MARKUP_INFO);
+ return new
ControllerPortletInvocationContext(getPageNavigationalStateSerialization(), req, resp,
windowId, pageNavigationalState, MARKUP_INFO);
}
}
\ No newline at end of file
Copied:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java
(from rev 10159,
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java)
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java
(rev 0)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java 2008-02-29
17:41:05 UTC (rev 10160)
@@ -0,0 +1,104 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.portlet.controller.impl;
+
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * An implementation of the <code>PortletInvocationContext</code> interface
that is related to a specific
+ * window.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ControllerPortletInvocationContext extends AbstractPortletInvocationContext
+{
+
+ /** . */
+ private final PortletURLRenderer urlRenderer;
+
+ /** . */
+ private final String windowId;
+
+ /** . */
+ private final HttpServletRequest clientRequest;
+
+ /** . */
+ private final HttpServletResponse clientResponse;
+
+ public ControllerPortletInvocationContext(
+ Serialization<PageNavigationalState> serialization,
+ HttpServletRequest clientRequest,
+ HttpServletResponse clientResponse,
+ String windowId,
+ PageNavigationalState pageNavigationalState,
+ MarkupInfo markupInfo)
+ {
+ super(markupInfo);
+
+ //
+ this.clientRequest = clientRequest;
+ this.clientResponse = clientResponse;
+ this.windowId = windowId;
+ this.urlRenderer = new PortletURLRenderer(pageNavigationalState, clientRequest,
clientResponse, serialization);
+
+ //
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new
PrincipalAttributeResolver(clientRequest));
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new
RequestAttributeResolver(clientRequest));
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return clientResponse;
+ }
+
+ public String renderURL(ContainerURL containerURL, URLFormat format)
+ {
+ return urlRenderer.renderURL(windowId, containerURL, format);
+ }
+}