Author: thomas.heute(a)jboss.com
Date: 2008-04-23 16:06:36 -0400 (Wed, 23 Apr 2008)
New Revision: 10705
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/build.xml
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFServerContext.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java
Log:
Content framework adaptation with a temporary hack
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2008-04-23
20:06:36 UTC (rev 10705)
@@ -39,10 +39,8 @@
import org.jboss.portal.core.model.portal.control.page.PageControlContext;
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
-import javax.xml.namespace.QName;
import java.util.Map;
/**
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java 2008-04-23
20:06:36 UTC (rev 10705)
@@ -39,6 +39,8 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.xml.namespace.QName;
+
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -73,10 +75,11 @@
{
if ((req.getPortletMode().equals(EDIT_CONTENT)))
{
- String uri = req.getParameter("content.uri");
+ String uri = req.getParameter("content_uri");
if (uri != null)
{
- resp.setRenderParameter("content.uri", uri);
+ resp.setRenderParameter("content_uri", uri);
+ resp.setEvent(new QName("urn:jboss:portal:content",
"select"), uri);
}
}
}
@@ -100,7 +103,7 @@
protected void getContent(RenderRequest req, RenderResponse resp, boolean newContent)
throws PortletException, PortletSecurityException, IOException
{
- String selectedURI = req.getParameter("content.uri");
+ String selectedURI = req.getParameter("content_uri");
//
resp.setContentType("text/html");
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp 2008-04-23
20:06:36 UTC (rev 10705)
@@ -133,7 +133,7 @@
%>
<portlet:actionURL var="url">
<portlet:param name="content.action.select"
value="true"/>
- <portlet:param name="content.uri" value="<%=
instance.getId() %>"/>
+ <portlet:param name="content_uri" value="<%=
instance.getId() %>"/>
</portlet:actionURL>
<div style="display:none">
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2008-04-23
20:06:36 UTC (rev 10705)
@@ -23,10 +23,10 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<portlet-app
-
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0">
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
<portlet>
<description>Portlet providing user login/logout and profile
management</description>
<portlet-name>UserPortlet</portlet-name>
@@ -124,6 +124,7 @@
<title>Portlet Content Portlet</title>
<keywords>management,admin</keywords>
</portlet-info>
+ <supported-publishing-event
xmlns:x="urn:jboss:portal:content">x:select</supported-publishing-event>
</portlet>
<user-attribute>
<name>user.name.nickName</name>
@@ -137,4 +138,10 @@
<user-attribute>
<name>user.name.family</name>
</user-attribute>
+
+ <event-definition>
+ <qname xmlns:x="urn:jboss:portal:content">x:select</qname>
+ <value-type>java.lang.String</value-type>
+ </event-definition>
+
</portlet-app>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/build.xml 2008-04-23 19:40:44 UTC (rev
10704)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/build.xml 2008-04-23 20:06:36 UTC (rev
10705)
@@ -102,6 +102,7 @@
<path refid="el.el.classpath"/>
<path refid="richfaces.richfaces.classpath"/>
<path refid="facelets.facelets.classpath"/>
+ <path refid="portlet.portlet.classpath"/>
<pathelement
location="${source.etc}/sun-jsf/portletbridge-api-1.0.0-SNAPSHOT.jar"/>
<pathelement
location="${source.etc}/sun-jsf/portletbridge-impl-1.0.0-SNAPSHOT.jar"/>
</path>
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2008-04-23
20:06:36 UTC (rev 10705)
@@ -23,10 +23,10 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<portlet-app
-
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0">
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
<portlet>
<description>Administration Portlet</description>
<portlet-name>AdminPortlet</portlet-name>
@@ -71,5 +71,14 @@
<title>Dashboard Configurator Portlet</title>
<keywords>management,admin</keywords>
</portlet-info>
+
+ <supported-processing-event
xmlns:x="urn:jboss:portal:content">x:select</supported-processing-event>
+
</portlet>
+
+ <event-definition>
+ <qname xmlns:x="urn:jboss:portal:content">x:select</qname>
+ <value-type>java.lang.String</value-type>
+ </event-definition>
+
</portlet-app>
Modified:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2008-04-23
20:06:36 UTC (rev 10705)
@@ -30,7 +30,9 @@
import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -116,7 +118,7 @@
this.serverContext = new JSFServerContext(this);
}
- String renderURL(ContainerURL containerURL, StateString navigationalState, Boolean
wantSecure, Boolean wantAuthenticated, boolean relative)
+ String renderURL(ContainerURL containerURL, Boolean wantSecure, Boolean
wantAuthenticated, boolean relative)
{
ViewHandler vh = faces.getApplication().getViewHandler();
String viewId = faces.getViewRoot().getViewId();
@@ -130,22 +132,27 @@
PortletURL portletURL = (PortletURL)containerURL;
- //
- PortletRequestEncoder encoder = new PortletRequestEncoder();
- encoder.encodeRender(navigationalState, portletURL.getMode(),
portletURL.getWindowState());
- for (Iterator i = encoder.getQueryParameters().entrySet().iterator();
i.hasNext();)
+ if (portletURL instanceof ActionURL)
{
- Map.Entry entry = (Map.Entry)i.next();
- String name = FastURLEncoder.getUTF8Instance().encode((String)entry.getKey());
- String[] values = (String[])entry.getValue();
- for (int j = 0; j < values.length; j++)
+ ActionURL actionPortletURL = (ActionURL)portletURL;
+
+ //
+ PortletRequestEncoder encoder = new PortletRequestEncoder();
+ encoder.encodeRender(actionPortletURL.getInteractionState(),
portletURL.getMode(), portletURL.getWindowState());
+ for (Iterator i = encoder.getQueryParameters().entrySet().iterator();
i.hasNext();)
{
- String value = values[j];
- url.append("&").append(name).append('=');
- FastURLEncoder.getUTF8Instance().encode(value, url);
+ Map.Entry entry = (Map.Entry)i.next();
+ String name =
FastURLEncoder.getUTF8Instance().encode((String)entry.getKey());
+ String[] values = (String[])entry.getValue();
+ for (int j = 0; j < values.length; j++)
+ {
+ String value = values[j];
+ url.append("&").append(name).append('=');
+ FastURLEncoder.getUTF8Instance().encode(value, url);
+ }
}
}
-
+
//
return url.toString();
}
@@ -154,14 +161,14 @@
Portlet portlet,
Mode mode,
WindowState windowState,
- StateString navigationalState,
StateString interactionState) throws PortletInvokerException
{
- PortletInvocationContext portletInvocationContext = new
JSFPortletInvocationContext(clientRequest, clientResponse, new
MarkupInfo(MediaType.TEXT_HTML, "UTF-8"), navigationalState, this);
+ PortletInvocationContext portletInvocationContext = new
JSFPortletInvocationContext(clientRequest, clientResponse, new
MarkupInfo(MediaType.TEXT_HTML, "UTF-8"), this);
//
- PortletInvocation action = new ActionInvocation(portletInvocationContext);
-
+ ActionInvocation action = new ActionInvocation(portletInvocationContext);
+ action.setInteractionState(interactionState);
+
if (mode != null)
{
action.setMode(mode);
@@ -191,10 +198,11 @@
ParameterMap navState) throws PortletInvokerException
{
- PortletInvocationContext portletInvocationContext = new
JSFPortletInvocationContext(clientRequest, clientResponse, new
MarkupInfo(MediaType.TEXT_HTML, "UTF-8"), null, this);
+ PortletInvocationContext portletInvocationContext = new
JSFPortletInvocationContext(clientRequest, clientResponse, new
MarkupInfo(MediaType.TEXT_HTML, "UTF-8"), this);
//
PortletInvocation render = new RenderInvocation(portletInvocationContext);
+ render.setNavigationalState(ParametersStateString.create(navState));
if (mode != null)
{
@@ -248,7 +256,7 @@
private StateString navigationalState;
- public JSFPortletInvocationContext(HttpServletRequest clientRequest,
HttpServletResponse clientResponse, MarkupInfo markupInfo, StateString navigationalState,
JSFInvocation invocation)
+ public JSFPortletInvocationContext(HttpServletRequest clientRequest,
HttpServletResponse clientResponse, MarkupInfo markupInfo, JSFInvocation invocation)
{
super(markupInfo);
@@ -258,8 +266,6 @@
this.clientRequest = clientRequest;
this.clientResponse = clientResponse;
this.invocation = invocation;
- this.navigationalState = navigationalState;
-
//
addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
@@ -281,7 +287,7 @@
public String renderURL(ContainerURL containerURL, URLFormat urlFormat)
{
- return invocation.renderURL(containerURL, navigationalState,
urlFormat.getWantSecure(), urlFormat.getWantAuthenticated(),
urlFormat.getWantRelative());
+ return invocation.renderURL(containerURL, urlFormat.getWantSecure(),
urlFormat.getWantAuthenticated(), urlFormat.getWantRelative());
}
}
Modified:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFServerContext.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFServerContext.java 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/JSFServerContext.java 2008-04-23
20:06:36 UTC (rev 10705)
@@ -22,23 +22,12 @@
******************************************************************************/
package org.jboss.portal.faces.component.portlet;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.invocation.EmptyAttributeResolver;
-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.util.ParameterMap;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
-import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 10090 $
@@ -78,6 +67,6 @@
public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean
wantAuthenticated, boolean relative)
{
- return invocation.renderURL(portletURL, null, wantSecure, wantAuthenticated,
relative);
+ return invocation.renderURL(portletURL, wantSecure, wantAuthenticated, relative);
}
}
Modified:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java 2008-04-23
20:06:36 UTC (rev 10705)
@@ -33,6 +33,10 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.xml.namespace.QName;
+
+import java.io.Serializable;
+import java.util.List;
import java.util.Map;
/**
@@ -117,11 +121,25 @@
//
try
{
- PortletInvocationResponse pir = invocation.action(portlet, mode, windowState,
null, ParametersStateString.create(interactionState));
+ PortletInvocationResponse pir = invocation.action(portlet, mode, windowState,
ParametersStateString.create(interactionState));
if (pir instanceof UpdateNavigationalStateResponse)
{
UpdateNavigationalStateResponse render = (UpdateNavigationalStateResponse)pir;
+ // This is a Hack
+ List<UpdateNavigationalStateResponse.Event> events = render.getEvents();
+ for (UpdateNavigationalStateResponse.Event event: events)
+ {
+ if (event.getName().equals(new QName("urn:jboss:portal:content",
"select")))
+ {
+ Serializable payload = event.getPayload();
+ interactionState.setValue("content.action.select",
"true");
+ interactionState.setValue("content.uri",
payload.toString());
+ }
+ }
+
+
+
//
uiportlet.setInternalNavState(((ParametersStateString)render.getNavigationalState()).getParameters());
Modified:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java 2008-04-23
20:06:36 UTC (rev 10705)
@@ -44,6 +44,9 @@
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
+import javax.portlet.ActionRequest;
+import javax.portlet.RenderRequest;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
@@ -427,6 +430,8 @@
{
String clientId = getClientId(faces);
String clientIdValue =
(String)faces.getExternalContext().getRequestParameterMap().get(clientId);
+
+ Object obj = faces.getExternalContext().getRequest();
// We have been targetted
if ("jbp".equals(clientIdValue))
@@ -454,35 +459,33 @@
Mode mode = decoder.getMode();
WindowState windowState = decoder.getWindowState();
- //
- switch (decoder.getType())
+ if (obj instanceof RenderRequest)
{
- case PortletRequestDecoder.RENDER_TYPE:
- PortletRenderEvent prevent = new PortletRenderEvent(
+ PortletRenderEvent prevent = new PortletRenderEvent(
this,
((ParametersStateString)decoder.getNavigationalState()).getParameters(),
mode,
windowState);
- prevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
- queueEvent(prevent);
- break;
- case PortletRequestDecoder.ACTION_TYPE:
- if (mode == null)
- {
- mode = getInternalMode();
- }
- if (windowState == null)
- {
- windowState = getInternalWindowState();
- }
- PortletActionEvent paevent = new PortletActionEvent(
+ prevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ queueEvent(prevent);
+ }
+ else if (obj instanceof ActionRequest)
+ {
+ if (mode == null)
+ {
+ mode = getInternalMode();
+ }
+ if (windowState == null)
+ {
+ windowState = getInternalWindowState();
+ }
+ PortletActionEvent paevent = new PortletActionEvent(
this,
-
((ParametersStateString)decoder.getInteractionState()).getParameters(),
+ ParameterMap.clone(((ActionRequest)obj).getParameterMap()),
mode,
windowState);
- paevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
- queueEvent(paevent);
- break;
+ paevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ queueEvent(paevent);
}
}
}
Modified:
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java 2008-04-23
19:40:44 UTC (rev 10704)
+++
branches/JBoss_Portal_Branch_2_7/portlet-server/src/main/org/jboss/portal/portlet/deployment/PortletApplicationModelFactory.java 2008-04-23
20:06:36 UTC (rev 10705)
@@ -672,14 +672,8 @@
if (object instanceof EventDefinitionReferenceMetaData)
{
EventDefinitionReferenceMetaData md = (EventDefinitionReferenceMetaData)object;
- if ("qname".equals(localName))
- {
- md.setQname(nav.resolveQName(value));
- }
- else if ("name".equals(localName))
- {
- md.setName(value);
- }
+
+ md.setQname(nav.resolveQName(value));
}
// custom-portlet-mode