Author: julien(a)jboss.com
Date: 2007-11-20 17:02:54 -0500 (Tue, 20 Nov 2007)
New Revision: 9053
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortletInvocationContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/client/controller/UIController.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/protocol/PostActivation.java
Log:
- basic support for URL encoding
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
===================================================================
---
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-20
21:37:13 UTC (rev 9052)
+++
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-11-20
22:02:54 UTC (rev 9053)
@@ -48,6 +48,7 @@
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.protocol.ErrorResponse;
import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
import org.jboss.portal.presentation.protocol.ServerAction;
import org.jboss.portal.presentation.protocol.ServerResponse;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
@@ -56,7 +57,10 @@
import org.jboss.portal.presentation.server.ProcessorRequest;
import org.jboss.portal.presentation.server.ProcessorResponse;
import org.jboss.portal.server.ServerException;
+import org.jboss.portal.web.Body;
+import java.util.Map;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
@@ -168,8 +172,21 @@
PortalObjectId poid = PortalObjectId.parse(id,
PortalObjectPath.CANONICAL_FORMAT);
Window window = (Window)portalObjectContainer.getObject(poid);
PortletRequestDecoder decoder = new PortletRequestDecoder();
- decoder.decode(getActivation.getQueryParameters(), null);
+ // Get form parameters if any
+ Map formParameters = null;
+ if (serverAction instanceof PostActivation)
+ {
+ PostActivation post = (PostActivation)serverAction;
+ Body body = post.getBody();
+ if (body instanceof Body.Form)
+ {
+ formParameters = ((Body.Form)body).getParameters();
+ }
+ }
+
+ decoder.decode(getActivation.getQueryParameters(), formParameters);
+
// We assume that for now
UIWindow uiWindow =
(UIWindow)presentationContext.getUIContext().getObject(id);
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortletInvocationContext.java
===================================================================
---
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortletInvocationContext.java 2007-11-20
21:37:13 UTC (rev 9052)
+++
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/content/portlet/PresentationPortletInvocationContext.java 2007-11-20
22:02:54 UTC (rev 9053)
@@ -96,7 +96,8 @@
public String encodeResourceURL(String url) throws IllegalArgumentException
{
- return "todo";
+ // Todo improve that
+ return url;
}
public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean
wantAuthenticated, boolean relative)
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/client/controller/UIController.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/client/controller/UIController.java 2007-11-20
21:37:13 UTC (rev 9052)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/client/controller/UIController.java 2007-11-20
22:02:54 UTC (rev 9053)
@@ -22,35 +22,35 @@
******************************************************************************/
package org.jboss.portal.presentation.client.controller;
-import java.io.PrintWriter;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.jboss.portal.presentation.client.PresentationContext;
-import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
import org.jboss.portal.presentation.impl.PresentationContextImpl;
-import org.jboss.portal.presentation.server.ProcessorRequest;
-import org.jboss.portal.presentation.server.ProcessorResponse;
-import org.jboss.portal.presentation.server.PresentationServer;
-import org.jboss.portal.presentation.protocol.ServerAction;
-import org.jboss.portal.presentation.protocol.ServerResponse;
-import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
-import org.jboss.portal.presentation.protocol.GetActivation;
-import org.jboss.portal.presentation.protocol.PostActivation;
import org.jboss.portal.presentation.model.UIContext;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.content.WindowContent;
-
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.protocol.ServerResponse;
+import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.server.ProcessorRequest;
+import org.jboss.portal.presentation.server.ProcessorResponse;
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.web.WebRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Map;
+
/**
* The UIServer is responsible for generating the output that is sent back to the client
based on the Portal state of a particular Portal Request
*
@@ -240,18 +240,19 @@
from = pos + 1;
}
+ // I know but it will go away later when we remove dependency on server module
+ WebRequest webReq =
((ServerInvocationContextImpl)invocation.getContext()).getWebRequest();
+
//
if (target != null)
{
- Map queryParameters = invocationContext.getQueryParameterMap();
- Map bodyParameters = invocationContext.getBodyParameterMap();
- if (bodyParameters != null)
+ if ("GET".equals(webReq.getMethod()))
{
- return new PostActivation(target.getId(), queryParameters,
bodyParameters);
+ return new GetActivation(target.getId(), webReq.getQueryParameterMap());
}
- else
+ else if ("POST".equals(webReq.getMethod()))
{
- return new GetActivation(target.getId(), queryParameters);
+ return new PostActivation(target.getId(), webReq.getQueryParameterMap(),
webReq.getBody());
}
}
}
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/protocol/PostActivation.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/protocol/PostActivation.java 2007-11-20
21:37:13 UTC (rev 9052)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/protocol/PostActivation.java 2007-11-20
22:02:54 UTC (rev 9053)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.protocol;
-import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.web.Body;
import java.util.Map;
@@ -34,22 +34,22 @@
{
/** . */
- private final Map bodyParameters;
+ private final Body body;
- public PostActivation(String targetId, Map queryParameters, Map bodyParameters)
+ public PostActivation(String targetId, Map queryParameters, Body body)
{
super(targetId, queryParameters);
//
- this.bodyParameters = bodyParameters;
+ this.body = body;
}
/**
*
* @return
*/
- public Map getBodyParameters()
+ public Body getBody()
{
- return bodyParameters;
+ return body;
}
}