Author: julien(a)jboss.com
Date: 2008-04-07 08:55:25 -0400 (Mon, 07 Apr 2008)
New Revision: 10514
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/ActionEncoder.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/UIController.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/GetActivation.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/PostActivation.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
Log:
- minor update to link activation
- rewrite action decoded/encoder
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-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -37,23 +37,17 @@
public ProtocolAction decode(WebRequest request)
{
-
ProtocolAction action = null;
- Map<String, String[]> queryParams = request.getQueryParameterMap();
+ //
+ String pathInfo = request.getPathInfo();
- String[] actionValues = queryParams.get(Constants.ACTION_PARAM);
-
- if (actionValues != null)
+ //
+ if (pathInfo != null)
{
- String actionValue = actionValues[0];
-
- String[] targetIds = queryParams.get(Constants.TARGET_ID_PARAM);
-
- if (targetIds != null)
+ if (pathInfo.startsWith("/view/"))
{
- String targetId = targetIds[0];
-
+ String targetId = pathInfo.substring("/view/".length());
action = new ViewUIObjectAction(targetId);
}
}
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-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -38,8 +38,7 @@
{
ViewUIObjectAction viewObjectAction = (ViewUIObjectAction)action;
- //
- return "/index.html?action=" + Constants.VIEW_UI_OBJECT_ACTION +
"&id=" + viewObjectAction.getTargetId();
+ return "/view/" + viewObjectAction.getTargetId();
}
return null;
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/UIController.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/UIController.java 2008-04-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/UIController.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -213,11 +213,11 @@
{
if ("GET".equals(webReq.getMethod()))
{
- return new GetActivation(target.getId(), webReq.getQueryParameterMap());
+ return new GetActivation(target.getId(), null,
webReq.getQueryParameterMap());
}
else if ("POST".equals(webReq.getMethod()))
{
- return new PostActivation(target.getId(), webReq.getQueryParameterMap(),
webReq.getBody());
+ return new PostActivation(target.getId(), null,
webReq.getQueryParameterMap(), webReq.getBody());
}
}
}
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java 2008-04-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -129,12 +129,12 @@
}
if(method.equalsIgnoreCase("get"))
{
- GetActivation get = new GetActivation(targetId, queryParameters);
+ GetActivation get = new GetActivation(targetId, null, queryParameters);
request.getSession().setAttribute("serverAction", get);
}
else
{
- PostActivation post = new PostActivation(targetId, queryParameters, null);
+ PostActivation post = new PostActivation(targetId, null, queryParameters,
null);
request.getSession().setAttribute("serverAction", post);
}
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-04-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -156,7 +156,7 @@
String targetId = this.parseTargetId(url);
- GetActivation get = new GetActivation(targetId, queryParams);
+ GetActivation get = new GetActivation(targetId, null, queryParams);
request.setAttribute("serverAction", get);
@@ -210,7 +210,7 @@
queryParams.put(URLDecoder.decode(name, "UTF-8"), new
String[]{URLDecoder.decode(value, "UTF-8")});
}
- PostActivation post = new PostActivation(targetId, queryParams, null);
+ PostActivation post = new PostActivation(targetId, null, queryParams, null);
request.setAttribute("serverAction", post);
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/GetActivation.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/GetActivation.java 2008-04-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/GetActivation.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -27,14 +27,14 @@
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
*/
public class GetActivation extends LinkActivation
{
- public GetActivation(String targetId, Map queryParameters)
+ public GetActivation(String targetId, String path, Map<String, String[]>
queryParameters)
{
- super(targetId, queryParameters);
+ super(targetId, path, queryParameters);
}
public String toString()
@@ -44,11 +44,10 @@
if(this.queryParameters != null)
{
buffer.append("QueryString---------------\n");
- for(Iterator itr=this.queryParameters.keySet().iterator(); itr.hasNext();)
+ for (String key : this.queryParameters.keySet())
{
- String key = (String)itr.next();
- String[] value = (String[])this.queryParameters.get(key);
- buffer.append(key+"="+value[0]+"\n");
+ String[] value = this.queryParameters.get(key);
+
buffer.append(key).append("=").append(value[0]).append("\n");
}
}
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java 2008-04-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -26,31 +26,42 @@
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
*/
public abstract class LinkActivation extends UIObjectAction
{
- /** julien: Not used for now . */
- // protected String url = null;
+ /** . */
+ protected String path = null;
/** . */
- protected Map queryParameters = null;
+ protected Map<String, String[]> queryParameters = null;
- protected LinkActivation(String targetId, Map queryParameters)
+ protected LinkActivation(String targetId, String path, Map<String, String[]>
queryParameters)
{
super(targetId);
//
+ this.path = path;
this.queryParameters = queryParameters;
}
/**
- *
- * @return
+ * Returns the path or null if no path value is present
+ * @return the path
*/
- public Map getQueryParameters()
+ public String getPath()
{
+ return path;
+ }
+
+ /**
+ * Returns the query parameters or null if no query string is present.
+ *
+ * @return the query parameters
+ */
+ public Map<String, String[]> getQueryParameters()
+ {
return queryParameters;
}
}
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/PostActivation.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/PostActivation.java 2008-04-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/PostActivation.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -29,7 +29,7 @@
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
*/
public class PostActivation extends LinkActivation
{
@@ -37,17 +37,18 @@
/** . */
private final Body body;
- public PostActivation(String targetId, Map queryParameters, Body body)
+ public PostActivation(String targetId, String path, Map<String, String[]>
queryParameters, Body body)
{
- super(targetId, queryParameters);
+ super(targetId, path, queryParameters);
//
this.body = body;
}
/**
- *
- * @return
+ * The body.
+ *
+ * @return the body
*/
public Body getBody()
{
@@ -61,22 +62,20 @@
if(this.queryParameters != null)
{
buffer.append("QueryString---------------\n");
- for(Iterator itr=this.queryParameters.keySet().iterator(); itr.hasNext();)
+ for (String key : this.queryParameters.keySet())
{
- String key = (String)itr.next();
- String[] value = (String[])this.queryParameters.get(key);
- buffer.append(key+"="+value[0]+"\n");
+ String[] value = this.queryParameters.get(key);
+
buffer.append(key).append("=").append(value[0]).append("\n");
}
}
if(this.body != null && ((Body.Form)this.body).getParameters() != null)
{
buffer.append("PostBody---------------\n");
- for(Iterator itr=((Body.Form)this.body).getParameters().keySet().iterator();
itr.hasNext();)
+ for (String key : ((Body.Form)this.body).getParameters().keySet())
{
- String key = (String)itr.next();
String[] value = ((Body.Form)this.body).getParameters().get(key);
- buffer.append(key+"="+value[0]+"\n");
+
buffer.append(key).append("=").append(value[0]).append("\n");
}
}
Modified:
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
===================================================================
---
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-04-07
12:21:14 UTC (rev 10513)
+++
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-04-07
12:55:25 UTC (rev 10514)
@@ -7,7 +7,6 @@
import java.net.URLDecoder;
import javax.management.MBeanServer;
-import javax.management.ObjectName;
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
@@ -15,10 +14,8 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
-import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.portal.common.invocation.InterceptorStackFactory;
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.WebResponse;
@@ -133,7 +130,7 @@
String targetId = this.parseTargetId(url);
- GetActivation get = new GetActivation(targetId, queryParams);
+ GetActivation get = new GetActivation(targetId, null, queryParams);
request.setAttribute("serverAction", get);
@@ -187,7 +184,7 @@
queryParams.put(URLDecoder.decode(name, "UTF-8"), new
String[]{URLDecoder.decode(value, "UTF-8")});
}
- PostActivation post = new PostActivation(targetId, queryParams, null);
+ PostActivation post = new PostActivation(targetId, null, queryParams, null);
request.setAttribute("serverAction", post);