Author: sohil.shah(a)jboss.com
Date: 2007-11-13 10:11:32 -0500 (Tue, 13 Nov 2007)
New Revision: 8901
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/GetActivation.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/LinkActivation.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/PostActivation.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ServerAction.java
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorRequest.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalEntryPoint.java
Log:
integrating the concept of actions
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/GetActivation.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/GetActivation.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/GetActivation.java 2007-11-13
15:11:32 UTC (rev 8901)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.action.server;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class GetActivation extends LinkActivation
+{
+
+}
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/LinkActivation.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/LinkActivation.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/LinkActivation.java 2007-11-13
15:11:32 UTC (rev 8901)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.action.server;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class LinkActivation extends ServerAction
+{
+ /**
+ *
+ */
+ protected String contentType = null;
+
+ /**
+ *
+ */
+ protected String url = null;
+
+ /**
+ *
+ */
+ protected Map queryParameters = null;
+
+ /**
+ *
+ * @return
+ */
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ /**
+ *
+ * @param contentType
+ */
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map getQueryParameters()
+ {
+ return queryParameters;
+ }
+
+ /**
+ *
+ * @param queryParameters
+ */
+ public void setQueryParameters(Map queryParameters)
+ {
+ this.queryParameters = queryParameters;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getUrl()
+ {
+ return url;
+ }
+
+ /**
+ *
+ * @param url
+ */
+ public void setUrl(String url)
+ {
+ this.url = url;
+ }
+}
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/PostActivation.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/PostActivation.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/PostActivation.java 2007-11-13
15:11:32 UTC (rev 8901)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.action.server;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PostActivation extends LinkActivation
+{
+ private Map bodyParameters = null;
+
+ /**
+ *
+ * @return
+ */
+ public Map getBodyParameters()
+ {
+ return bodyParameters;
+ }
+
+ /**
+ *
+ * @param bodyParameters
+ */
+ public void setBodyParameters(Map bodyParameters)
+ {
+ this.bodyParameters = bodyParameters;
+ }
+}
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ServerAction.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ServerAction.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ServerAction.java 2007-11-13
15:11:32 UTC (rev 8901)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.action.server;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class ServerAction
+{
+}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorRequest.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorRequest.java 2007-11-13
14:29:05 UTC (rev 8900)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/ProcessorRequest.java 2007-11-13
15:11:32 UTC (rev 8901)
@@ -27,6 +27,7 @@
import org.jboss.portal.uiserver.protocol.Portal;
import org.jboss.portal.uiserver.protocol.PortalObject;
import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.presentation.action.server.ServerAction;
/**
@@ -38,32 +39,34 @@
*
*/
public class ProcessorRequest implements Serializable
-{
+{
/**
+ * The Portal that the target object belongs to
+ */
+ private Portal portal = null;
+
+ /**
* Target object where action needs to be performed
*/
private PortalObject target = null;
/**
- * The Portal that the target object belongs to
+ * The Portal action to be performed
*/
- private Portal portal = null;
+ private ServerAction action = null;
/**
- * The Portal action to be performed. For now, action and render
+ *
*/
- private String actionType = null;
-
-
private ServerInvocation serverInvocation = null;
/**
*
*
*/
- public ProcessorRequest(String actionType, ServerInvocation serverInvocation, Portal
portal, PortalObject target)
+ public ProcessorRequest(ServerAction action, ServerInvocation serverInvocation, Portal
portal, PortalObject target)
{
- this.actionType = actionType;
+ this.action = action;
this.serverInvocation = serverInvocation;
this.portal = portal;
this.target = target;
@@ -73,18 +76,18 @@
*
* @return
*/
- public String getActionType()
+ public ServerAction getAction()
{
- return actionType;
+ return action;
}
/**
*
- * @param actionType
+ * @param action
*/
- public void setActionType(String actionType)
+ public void setAction(ServerAction action)
{
- this.actionType = actionType;
+ this.action = action;
}
/**
@@ -147,7 +150,7 @@
public String toString()
{
StringBuffer buffer = new StringBuffer();
- buffer.append("[actionType="+this.actionType+",
portal="+this.portal+", target="+this.target+"]");
+ buffer.append("[action="+this.action+",
portal="+this.portal+", target="+this.target+"]");
return buffer.toString();
}
}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-11-13
14:29:05 UTC (rev 8900)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/UIServer.java 2007-11-13
15:11:32 UTC (rev 8901)
@@ -24,18 +24,22 @@
import java.util.StringTokenizer;
+import javax.servlet.http.HttpServletRequest;
+
import org.jboss.portal.uiserver.protocol.PortalObject;
import org.jboss.portal.uiserver.protocol.Portal;
-import org.jboss.portal.presentation.server.Processor;
import org.jboss.portal.presentation.server.ProcessorRequest;
import org.jboss.portal.presentation.server.ProcessorResponse;
-import org.jboss.portal.presentation.server.PortalObjectReader;
import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.action.server.ServerAction;
+import org.jboss.portal.presentation.action.server.GetActivation;
+import org.jboss.portal.presentation.action.server.PostActivation;
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
/**
@@ -80,7 +84,6 @@
//processed by the core Portal component
Portal portal = null;
PortalObject target = null;
- String actionType = "render";
StringTokenizer st = new StringTokenizer(portalRequestPath, "/");
StringBuffer buffer = new StringBuffer("/");
while(st.hasMoreTokens())
@@ -129,14 +132,9 @@
}
}
}
-
- String actionParam =
invocation.getServerContext().getClientRequest().getParameter("action");
- if(actionParam != null && actionParam.trim().length()>0 &&
actionParam.equals("1"))
- {
- actionType = "action";
- }
-
- ProcessorRequest processorRequest = new ProcessorRequest(actionType, invocation,
portal, target);
+
+ ServerAction serverAction = this.getServerAction(invocation);
+ ProcessorRequest processorRequest = new ProcessorRequest(serverAction,
invocation, portal, target);
ProcessorResponse processorResponse =
this.presentationServer.getProcessor().process(processorRequest);
//Go ahead and render to the client based on ProcessorResponse received from the
core Portal
@@ -184,5 +182,34 @@
public void setPresentationServer(PresentationServer presentationServer)
{
this.presentationServer = presentationServer;
- }
+ }
+
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private ServerAction getServerAction(ServerInvocation invocation)
+ {
+ ServerAction serverAction = null;
+
+ ServerInvocationContext invocationContext = invocation.getServerContext();
+ HttpServletRequest request = invocationContext.getClientRequest();
+ if(request.getMethod().equals("GET"))
+ {
+ GetActivation get = new GetActivation();
+ get.setUrl(request.getRequestURL().toString());
+ get.setContentType(invocationContext.getMediaType());
+ get.setQueryParameters(invocationContext.getQueryParameterMap());
+ serverAction = get;
+ }
+ else if(request.getMethod().equals("POST"))
+ {
+ PostActivation post = new PostActivation();
+ post.setUrl(request.getRequestURL().toString());
+ post.setContentType(invocationContext.getMediaType());
+ post.setQueryParameters(invocationContext.getQueryParameterMap());
+ post.setBodyParameters(invocationContext.getBodyParameterMap());
+ serverAction = post;
+ }
+ return serverAction;
+ }
}
Modified:
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalEntryPoint.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalEntryPoint.java 2007-11-13
14:29:05 UTC (rev 8900)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/uiserver/service/ajax/PortalEntryPoint.java 2007-11-13
15:11:32 UTC (rev 8901)
@@ -132,7 +132,7 @@
return currentPage;
}
-
+
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
/**
*
* @param processorResponse