Author: julien(a)jboss.com
Date: 2008-04-17 08:40:29 -0400 (Thu, 17 Apr 2008)
New Revision: 10615
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/PresentationPortletInvoker.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/StructuralPortletControllerContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/invocation/
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
modules/presentation/trunk/build/pom.xml
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
Log:
updates to PF:
- now use snapshot of web module
- moved some stuff in ajax module that will be removed later but should not be in the main
presentation module anyway
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-04-17
05:58:26 UTC (rev 10614)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -18,6 +18,8 @@
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.presentation.PresentationServerImpl;
+import org.jboss.portal.presentation.invocation.AjaxRequest;
+import org.jboss.portal.presentation.invocation.AjaxResponse;
import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
import org.jboss.portal.presentation.ajax.client.protocol.ClientResponse;
@@ -281,10 +283,10 @@
HttpServletRequest req = this.getThreadLocalRequest();
HttpServletResponse resp = this.getThreadLocalResponse();
- WebRequest webReq = new WebRequest(req);
- WebResponse webResp = new WebResponse(resp);
+// WebRequest webReq = new WebRequest(req);
+// WebResponse webResp = new WebResponse(resp);
- AjaxPresentationClient client = new AjaxPresentationClient(webReq, webResp,
this.server);
+ AjaxPresentationClient client = new AjaxPresentationClient(new AjaxRequest(req),
new AjaxResponse(resp), this.server);
client.process();
}
}
Copied:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation
(from rev 10614,
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/invocation)
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java
(rev 0)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxRequest.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * 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.presentation.invocation;
+
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+import org.jboss.portal.common.net.media.MediaType;
+
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AjaxRequest extends HttpServletRequestWrapper implements WebRequest
+{
+
+ public AjaxRequest(HttpServletRequest request)
+ {
+ super(request);
+ }
+
+ public Verb getVerb()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map<String, String[]> getQueryParameterMap()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Body getBody()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public MediaType getMediaType()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getWebRequestPath()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getWebContextPath()
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java
(rev 0)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/invocation/AjaxResponse.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * 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.presentation.invocation;
+
+import org.jboss.portal.web.WebResponse;
+import org.jboss.portal.common.servlet.URLFormat;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+import java.io.Writer;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AjaxResponse extends HttpServletResponseWrapper implements WebResponse
+{
+ public AjaxResponse(HttpServletResponse response)
+ {
+ super(response);
+ }
+
+ public String renderURL(String path, Map<String, String[]> parameters, URLFormat
wantedURLFormat) throws IllegalArgumentException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void renderURL(Writer writer, String path, Map<String, String[]>
parameters, URLFormat wantedURLFormat) throws IllegalArgumentException, IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Modified:
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
===================================================================
---
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-04-17
05:58:26 UTC (rev 10614)
+++
modules/presentation/trunk/ajax/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -26,6 +26,8 @@
import org.jboss.portal.presentation.protocol.GetActivation;
import org.jboss.portal.presentation.protocol.PostActivation;
import org.jboss.portal.presentation.invocation.PresentationInvocation;
+import org.jboss.portal.presentation.invocation.AjaxRequest;
+import org.jboss.portal.presentation.invocation.AjaxResponse;
import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@@ -262,9 +264,9 @@
HttpServletRequest req = this.getThreadLocalRequest();
HttpServletResponse resp = this.getThreadLocalResponse();
- WebRequest webReq = new WebRequest(req);
- WebResponse webResp = new WebResponse(resp);
- PresentationInvocation invocation = new PresentationInvocation(webReq, webResp);
+// WebRequest webReq = new WebRequest(req);
+// WebResponse webResp = new WebResponse(resp);
+ PresentationInvocation invocation = new PresentationInvocation(new
AjaxRequest(req), new AjaxResponse(resp));
//TODO: set the proper invocation handler here
Modified: modules/presentation/trunk/build/pom.xml
===================================================================
--- modules/presentation/trunk/build/pom.xml 2008-04-17 05:58:26 UTC (rev 10614)
+++ modules/presentation/trunk/build/pom.xml 2008-04-17 12:40:29 UTC (rev 10615)
@@ -31,9 +31,9 @@
<version.gwt>1.4.60</version.gwt>
<version.mygwt>0.3.0</version.mygwt>
- <version.jboss.portal.common>1.2.0.Beta3</version.jboss.portal.common>
+
<version.jboss.portal.common>1.2.0-SNAPSHOT</version.jboss.portal.common>
<version.jboss.portal.portlet>2.0.0.CR2</version.jboss.portal.portlet>
- <version.jboss.portal.web>1.2.0.Beta3</version.jboss.portal.web>
+ <version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
<version.jboss.unit>1.2.0.Beta2</version.jboss.unit>
<version.jboss.microcontainer>2.0.0.Beta9</version.jboss.microcontainer>
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-17
05:58:26 UTC (rev 10614)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -71,6 +71,13 @@
if (node instanceof WindowNode)
{
WindowNode window = (WindowNode)node;
+
+
+
+
+
+
+
return new WindowContent(0, "Window " + window.getName(),
window.getContent());
}
else
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-17
05:58:26 UTC (rev 10614)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -105,7 +105,7 @@
}
//
- String link = encoder.encode(action);
+ String link = encoder.encode(action, resp);
//
if (link == null)
@@ -216,9 +216,9 @@
{
ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
- String url = encoder.encode(viewPage);
+ String url = encoder.encode(viewPage, resp);
- writer.print("<div>Link to page <a href=\"" +
req.getContextPath() + url + "\">" + object.getName() +
"</a></div>");
+ writer.print("<div>Link to page <a href=\"" + url +
"\">" + object.getName() + "</a></div>");
}
}
else if (object instanceof UIWindow)
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-17
05:58:26 UTC (rev 10614)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -24,6 +24,7 @@
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.WebResponse;
+import org.jboss.portal.web.endpoint.EndPointServlet;
import org.jboss.portal.presentation.server2.PresentationServer;
import org.jboss.portal.presentation.server2.PresentationServerException;
import org.jboss.portal.presentation.PresentationServerImpl;
@@ -43,13 +44,16 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
*/
-public class ClassicPresentationServlet extends HttpServlet
+public class ClassicPresentationServlet extends EndPointServlet
{
private PresentationServer server;
public void init() throws ServletException
{
+ super.init();
+
+ //
StructuralStateContextImpl structuralStateContext = new
StructuralStateContextImpl();
//
@@ -72,14 +76,10 @@
this.server = new PresentationServerImpl(structuralStateContext);
}
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
+ protected void service(WebRequest req, WebResponse resp) throws ServletException,
IOException
{
+ ClassicPresentationClient client = new ClassicPresentationClient(req, resp,
server);
- WebRequest webReq = new WebRequest(req);
- WebResponse webResp = new WebResponse(resp);
-
- ClassicPresentationClient client = new ClassicPresentationClient(webReq, webResp,
server);
-
try
{
client.process();
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-17
05:58:26 UTC (rev 10614)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -40,43 +40,40 @@
ProtocolAction action = null;
//
- String pathInfo = request.getPathInfo();
+ String webPath = request.getWebRequestPath();
//
- if (pathInfo != null)
+ if (webPath.startsWith("/view/"))
{
- if (pathInfo.startsWith("/view/"))
+ String targetId = webPath.substring("/view/".length());
+ action = new ViewUIObjectAction(targetId);
+ }
+ else if (webPath.startsWith("/invoke/"))
+ {
+ int from = "/invoke/".length();
+
+ //
+ String path = null;
+ int to = webPath.indexOf('/', from + 1);
+ if (to == -1)
{
- String targetId = pathInfo.substring("/view/".length());
- action = new ViewUIObjectAction(targetId);
+ to = webPath.length();
}
- else if (pathInfo.startsWith("/invoke/"))
+ else
{
- int from = "/invoke/".length();
+ path = webPath.substring(to + 1);
+ }
- //
- String path = null;
- int to = pathInfo.indexOf('/', from + 1);
- if (to == -1)
- {
- to = pathInfo.length();
- }
- else
- {
- path = pathInfo.substring(to + 1);
- }
+ //
+ String targetId = webPath.substring(from, to);
- //
- String targetId = pathInfo.substring(from, to);
-
- //
- switch (request.getVerb())
- {
- case GET:
- return new GetActivation(targetId, path,
request.getQueryParameterMap());
- case POST:
- return new PostActivation(targetId, path,
request.getQueryParameterMap(), request.getBody());
- }
+ //
+ switch (request.getVerb())
+ {
+ case GET:
+ return new GetActivation(targetId, path, request.getQueryParameterMap());
+ case POST:
+ return new PostActivation(targetId, path, request.getQueryParameterMap(),
request.getBody());
}
}
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-17
05:58:26 UTC (rev 10614)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -27,9 +27,8 @@
import org.jboss.portal.presentation.protocol.LinkActivation;
import org.jboss.portal.presentation.protocol.UIObjectAction;
import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.web.WebResponse;
-import java.util.Map;
-
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
@@ -37,7 +36,7 @@
public class ActionEncoder
{
- public String encode(ProtocolAction action)
+ public String encode(ProtocolAction action, WebResponse resp)
{
if (action instanceof UIObjectAction)
{
@@ -49,47 +48,14 @@
//
if (action instanceof ViewUIObjectAction)
{
- return "/view/" + targetId;
+ return resp.renderURL("/view/" + targetId, null, null);
}
else if (action instanceof LinkActivation)
{
LinkActivation linkActivationAction = (LinkActivation)action;
//
- StringBuilder builder = new StringBuilder("/invoke/" + targetId);
-
- //
- if (linkActivationAction.getPath() != null)
- {
- builder.append(linkActivationAction.getPath());
- }
-
- //
- boolean empty = true;
- if (linkActivationAction.getQueryParameters() != null)
- {
- for (Map.Entry<String, String[]> queryParameterEntry :
linkActivationAction.getQueryParameters().entrySet())
- {
- String queryParameterName = queryParameterEntry.getKey();
-
- //
- for (String queryParameterValue : queryParameterEntry.getValue())
- {
- if (!empty)
- {
- builder.append('&');
- }
-
- //
-
builder.append(FastURLEncoder.getUTF8Instance().encode(queryParameterName));
- builder.append('=');
-
builder.append(FastURLEncoder.getUTF8Instance().encode(queryParameterValue));
- }
- }
- }
-
- //
- return builder.toString();
+ return resp.renderURL("/invoke/" + targetId,
linkActivationAction.getQueryParameters(), null);
}
}
Added:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/PresentationPortletInvoker.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/PresentationPortletInvoker.java
(rev 0)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/PresentationPortletInvoker.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.presentation.portlet;
+
+import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationPortletInvoker
+{
+
+ /** . */
+ private StructuralStateContextImpl structuralContext;
+
+ public PresentationPortletInvoker(StructuralStateContextImpl structuralContext)
+ {
+ this.structuralContext = structuralContext;
+ }
+
+ public void render(String windowId)
+ {
+
+ }
+
+}
Added:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/StructuralPortletControllerContext.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/StructuralPortletControllerContext.java
(rev 0)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/StructuralPortletControllerContext.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * 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.presentation.portlet;
+
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
+import org.jboss.portal.presentation.impl.state.structural.PageNode;
+
+import javax.servlet.http.Cookie;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralPortletControllerContext implements PortletControllerContext
+{
+
+ /** . */
+ private final PageNode page;
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ public StructuralPortletControllerContext(PageNode page, PortletInvoker invoker)
+ {
+ this.page = page;
+ this.invoker = invoker;
+ }
+
+ public PortletInfo getPortletInfo(String windowId)
+ {
+ return null;
+ }
+
+ public PortletInvocationContext createPortletInvocationContext(String windowId,
PageNavigationalState pageNavigationalState)
+ {
+ return null;
+ }
+
+ public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws
PortletInvokerException
+ {
+ return null;
+ }
+
+ public PortletInvocationResponse invoke(List<Cookie> requestCookies,
EventInvocation eventInvocation) throws PortletInvokerException
+ {
+ return null;
+ }
+
+ public PortletInvocationResponse invoke(ResourceInvocation resourceInvocation) throws
PortletInvokerException
+ {
+ return null;
+ }
+
+ public EventControllerContext getEventControllerContext()
+ {
+ return null;
+ }
+
+ public StateControllerContext getStateControllerContext()
+ {
+ return null;
+ }
+}
Added:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java
(rev 0)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationClientContext.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.ClientContext;
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
+import org.jboss.portal.common.util.SimpleMultiValuedPropertyMap;
+import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.GetActivation;
+
+import javax.servlet.http.Cookie;
+import java.util.List;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationClientContext implements ClientContext
+{
+
+ /** . */
+ private final LinkActivation linkActivation;
+
+ public PresentationClientContext(LinkActivation linkActivation)
+ {
+ this.linkActivation = linkActivation;
+ }
+
+ public String getMethod()
+ {
+ return linkActivation instanceof GetActivation ? "GET" :
"POST";
+ }
+
+ public MultiValuedPropertyMap<String> getProperties()
+ {
+ return new SimpleMultiValuedPropertyMap<String>();
+ }
+
+ public List<Cookie> getCookies()
+ {
+ return Collections.emptyList();
+ }
+}
Added:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java
(rev 0)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationInstanceContext.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.InstanceContext;
+import org.jboss.portal.portlet.state.AccessMode;
+import org.jboss.portal.portlet.StateEvent;
+import org.jboss.portal.presentation.impl.state.structural.WindowNode;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationInstanceContext implements InstanceContext
+{
+
+ /** . */
+ private final WindowNode window;
+
+ public PresentationInstanceContext(WindowNode window)
+ {
+ this.window = window;
+ }
+
+ public String getId()
+ {
+ return window.getId();
+ }
+
+ public AccessMode getAccessMode()
+ {
+ return AccessMode.READ_ONLY;
+ }
+
+ public void onStateEvent(StateEvent event)
+ {
+ throw new IllegalStateException();
+ }
+}
Added:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java
(rev 0)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationPortalContext.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.Tools;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationPortalContext implements PortalContext
+{
+ public String getInfo()
+ {
+ return "PresentationPortal";
+ }
+
+ public Set<WindowState> getWindowStates()
+ {
+ return Tools.toSet(WindowState.NORMAL);
+ }
+
+ public Set<Mode> getModes()
+ {
+ return Tools.toSet(Mode.VIEW);
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return Collections.emptyMap();
+ }
+}
Added:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java
(rev 0)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationServerContext.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * 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.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.ServerContext;
+import org.jboss.portal.web.ServletContainer;
+import org.jboss.portal.web.RequestDispatchCallback;
+import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.presentation.client2.PresentationClient;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationServerContext implements ServerContext
+{
+
+ /** . */
+ private final PresentationClient presentationClient;
+
+ public PresentationServerContext(PresentationClient presentationClient)
+ {
+ this.presentationClient = presentationClient;
+ }
+
+ public String getScheme()
+ {
+ return "http";
+ }
+
+ public String getServerName()
+ {
+ return "localhost";
+ }
+
+ public int getServerPort()
+ {
+ return 8080;
+ }
+
+ public Object dispatch(ServletContainer servletContainer, ServletContext
targetServletContext, RequestDispatchCallback callback, Object handback) throws Exception
+ {
+ ServletContextDispatcher dispatcher = presentationClient.getDispatcher();
+
+ //
+ return dispatcher.include(targetServletContext, callback, handback);
+ }
+}
Added:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java
(rev 0)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/portlet/spi/PresentationWindowContext.java 2008-04-17
12:40:29 UTC (rev 10615)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.presentation.portlet.spi;
+
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.presentation.impl.state.structural.WindowNode;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationWindowContext implements WindowContext
+{
+
+ /** . */
+ private final WindowNode window;
+
+ public PresentationWindowContext(WindowNode window)
+ {
+ this.window = window;
+ }
+
+ public String getId()
+ {
+ return window.getId();
+ }
+}