Author: julien(a)jboss.com
Date: 2007-04-07 18:52:49 -0400 (Sat, 07 Apr 2007)
New Revision: 6948
Added:
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/AjaxMetaData.java
Modified:
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/jboss-portlet.xml
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet-instances.xml
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/JBossPortletMetaData.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-sar/conf/standardjboss-portlet.xml
trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
trunk/theme/src/main/org/jboss/portal/test/theme/TestContext.java
trunk/theme/src/main/org/jboss/portal/test/theme/tmp/TestHelper.java
trunk/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRenderOptions.java
trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java
trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java
trunk/theme/src/main/org/jboss/portal/theme/tag/HeaderContentTagHandler.java
Log:
added capability in jboss-portlet.xml to configure whether or not a portlet wants to be
updated asynchronously
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -122,7 +122,7 @@
windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER,
"emptyRenderer");
windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER,
"emptyRenderer");
windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER,
"emptyRenderer");
- WindowResult res = new WindowResult("", tabbedNav.toString(),
Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowResult res = new WindowResult("", tabbedNav.toString(),
Collections.EMPTY_MAP, windowProps, null, WindowState.NORMAL, Mode.VIEW);
WindowContext blah = new WindowContext("BLAH", "BLAH",
"navigation", 0, res);
rendition.getPageResult().addWindowContext(blah);
@@ -140,7 +140,7 @@
windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER,
"emptyRenderer");
windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER,
"emptyRenderer");
windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER,
"emptyRenderer");
- WindowResult res = new WindowResult("", dashboardNav.toString(),
Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowResult res = new WindowResult("", dashboardNav.toString(),
Collections.EMPTY_MAP, windowProps, null, WindowState.NORMAL, Mode.VIEW);
WindowContext bluh = new WindowContext("BLUH", "BLUH",
"dashboardnav", 0, res);
rendition.getPageResult().addWindowContext(bluh);
Added: trunk/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/AjaxInterceptor.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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.core.aspects.portlet;
+
+import org.jboss.portal.portlet.invocation.PortletInterceptor;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.container.PortletContainerInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
+import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
+
+/**
+ * Look at the portlet ajax meta data.
+ *
+ * Improve later when we will have the structure to build real portlet runtime meta
information.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AjaxInterceptor extends PortletInterceptor
+{
+
+ protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
+ {
+ PortletInvocationResponse response =
(PortletInvocationResponse)invocation.invokeNext();
+
+ //
+ if (response instanceof FragmentResponse)
+ {
+ PortletContainer container =
((ContainerPortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer();
+ JBossPortletMetaData portletMD =
(JBossPortletMetaData)container.getJBossMetaData();
+ if (portletMD != null)
+ {
+ AjaxMetaData ajax = portletMD.getAjax();
+ if (ajax != null)
+ {
+ invocation.setAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE,
"asynchronous", ajax.getAsynchronous());
+ }
+ }
+ }
+
+ //
+ return response;
+ }
+}
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -34,7 +34,6 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.info.PortletInfo;
import java.io.StringWriter;
import java.util.Iterator;
@@ -57,8 +56,13 @@
{
FragmentResponse fragment = (FragmentResponse)response;
+ // The buffer that may become non null if we have content to write in it
+ StringWriter buffer = null;
+
+ // Get existing header which may be null
+ String headerChars = fragment.getHeader();
+
// Add declaratively injected header content here (get it via the component)
- String headerChars = fragment.getHeader(); // Chris' modif: note that the
header might to be re-written...
PortletContainer container =
((ContainerPortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer();
JBossPortletMetaData portletMD =
(JBossPortletMetaData)container.getJBossMetaData();
if (portletMD != null)
@@ -66,17 +70,37 @@
HeaderContentMetaData headerContent = portletMD.getHeaderContent();
if (headerContent != null)
{
+ // Init the buffer
+ buffer = initBuffer(headerChars);
+
+ // Get the context path
String contextPath =
(String)invocation.getDispatchedRequest().getAttribute("javax.servlet.include.context_path");
- StringWriter writer = new StringWriter(100);
- if (headerChars != null)
- {
- writer.write(headerChars);
- }
- write(headerContent, writer, contextPath);
- headerChars = writer.toString();
+
+ // Render header
+ render(headerContent, buffer, contextPath);
}
}
+ // Add header content coming from the response written by the portlet at
runtime
+ String headerContent =
(String)invocation.getAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE,
"HEADER_CONTENT");
+ if (headerContent != null)
+ {
+ // Init buffer if needed
+ if (buffer == null)
+ {
+ buffer = initBuffer(headerChars);
+ }
+
+ // Append the content as it is
+ buffer.write(headerContent);
+ }
+
+ // If the buffer is not empty, use it
+ if (buffer != null)
+ {
+ headerChars = buffer.toString();
+ }
+
//
fragment.setHeader(headerChars);
}
@@ -85,8 +109,29 @@
return response;
}
- protected void write(HeaderContentMetaData headerContent, StringWriter writer, String
contextPath)
+ private StringWriter initBuffer(String existingBuffer)
{
+ if (existingBuffer != null)
+ {
+ StringWriter buffer = new StringWriter(existingBuffer.length() + 100);
+ buffer.write(existingBuffer);
+ return buffer;
+ }
+ else
+ {
+ return new StringWriter(100);
+ }
+ }
+
+ /**
+ * Render the header content provided by the portlet meta data.
+ *
+ * @param headerContent
+ * @param writer
+ * @param contextPath
+ */
+ protected void render(HeaderContentMetaData headerContent, StringWriter writer, String
contextPath)
+ {
for (Iterator i = headerContent.getElements().iterator(); i.hasNext();)
{
ElementMetaData elementMD = (ElementMetaData)i.next();
Modified:
trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -27,6 +27,7 @@
import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
import org.jboss.portal.core.metadata.portlet.ElementMetaData;
+import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
@@ -67,6 +68,10 @@
{
child = new HeaderContentMetaData();
}
+ else if ("ajax".equals(localName))
+ {
+ child = new AjaxMetaData();
+ }
}
else if (object instanceof HeaderContentMetaData)
{
@@ -119,6 +124,12 @@
JBossPortletMetaData portlet = (JBossPortletMetaData)parent;
portlet.setHeaderContent(headerContent);
}
+ else if (child instanceof AjaxMetaData)
+ {
+ AjaxMetaData ajax = (AjaxMetaData)child;
+ JBossPortletMetaData portlet = (JBossPortletMetaData)parent;
+ portlet.setAjax(ajax);
+ }
else if (child instanceof ElementMetaData)
{
ElementMetaData element = (ElementMetaData)child;
@@ -158,6 +169,14 @@
elt.init();
}
}
+ else if (object instanceof AjaxMetaData)
+ {
+ if ("asynchronous".equals(localName))
+ {
+ AjaxMetaData ajax = (AjaxMetaData)object;
+ ajax.setAsynchronous(Boolean.valueOf(value));
+ }
+ }
else
{
super.setValue(object, nav, nsURI, localName, value);
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -58,6 +58,7 @@
import org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse;
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.renderer.ActionRendererContext;
+import org.jboss.portal.theme.impl.render.dynamic.DynaRenderOptions;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.Exceptions;
@@ -169,7 +170,7 @@
String contentChars;
String headerChars = null;
Map actionMap = new HashMap();
- Map windowProps = window.getDeclaredProperties();
+ Map windowProps = new HashMap(window.getDeclaredProperties());
//
try
@@ -234,6 +235,8 @@
}
headerChars = fragment.getHeader();
+ // Transform here the ajax stuff
+
//
List supportedWindowStates = new ArrayList();
for (Iterator i =
instance.getPortlet().getInfo().getCapabilities().getAllWindowStates().iterator();
i.hasNext();)
@@ -273,13 +276,20 @@
//
contentChars = fragment.getContent();
+ // Update window props after render if needed
+ Boolean asynchronous =
(Boolean)invocation.getAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE,
"asynchronous");
+ if (asynchronous != null)
+ {
+ DynaRenderOptions options = DynaRenderOptions.getOptions(null,
asynchronous);
+ options.setOptions(windowProps);
+ }
+
//
return new WindowResult(
windowTitle,
contentChars,
actionMap,
windowProps,
- new Properties(),
headerChars,
windowNS.getWindowState(),
windowNS.getMode());
@@ -299,7 +309,7 @@
{
contentChars = Exceptions.toHTML(t, true);
}
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
headerChars, windowNS.getWindowState(), windowNS.getMode());
}
}
else if (response instanceof UnavailableResponse)
@@ -311,7 +321,7 @@
actionMap = new HashMap();
actionMap.put(ActionRendererContext.MODES_KEY, Collections.EMPTY_LIST);
actionMap.put(ActionRendererContext.WINDOWSTATES_KEY,
Collections.EMPTY_LIST);
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
headerChars, windowNS.getWindowState(), windowNS.getMode());
}
}
else if (response instanceof InsufficientPrivilegesResponse)
@@ -336,7 +346,7 @@
actionMap.put(ActionRendererContext.WINDOWSTATES_KEY,
Collections.EMPTY_LIST);
windowTitle = "Access denied";
contentChars = "Access denied";
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
headerChars, windowNS.getWindowState(), windowNS.getMode());
}
}
catch (ResourceNotFoundException e)
@@ -351,7 +361,7 @@
actionMap.put(ActionRendererContext.WINDOWSTATES_KEY,
Collections.EMPTY_LIST);
windowTitle = "Cannot render";
contentChars = "Object not found " + e.getRef();
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
headerChars, windowNS.getWindowState(), windowNS.getMode());
}
}
catch (ControllerException e)
@@ -367,7 +377,7 @@
{
windowTitle = "An internal error occured while rendering window
'" + window + "'";
contentChars = Exceptions.toHTML(e, true);
- return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
new Properties(), headerChars, windowNS.getWindowState(), windowNS.getMode());
+ return new WindowResult(windowTitle, contentChars, actionMap, windowProps,
headerChars, windowNS.getWindowState(), windowNS.getMode());
}
}
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -198,13 +198,10 @@
WindowResult result = (WindowResult)o;
//
- Map props = new HashMap(result.getWindowProperties());
+ Map props = result.getProperties();
props.put("theme.windowRendererId", "emptyRenderer");
props.put("theme.decorationRendererId", "emptyRenderer");
props.put("theme.portletRendererId", "emptyRenderer");
-
- //
- result.setWindowProperties(props);
}
//
Added: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/AjaxMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/AjaxMetaData.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/AjaxMetaData.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.core.metadata.portlet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AjaxMetaData
+{
+
+ /** . */
+ private Boolean asynchronous;
+
+ public Boolean getAsynchronous()
+ {
+ return asynchronous;
+ }
+
+ public void setAsynchronous(Boolean asynchronous)
+ {
+ this.asynchronous = asynchronous;
+ }
+}
Modified:
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/JBossPortletMetaData.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/JBossPortletMetaData.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/JBossPortletMetaData.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -32,6 +32,9 @@
/** . */
private HeaderContentMetaData headerContent;
+ /** . */
+ private AjaxMetaData ajax;
+
public HeaderContentMetaData getHeaderContent()
{
return headerContent;
@@ -41,4 +44,38 @@
{
this.headerContent = headerContent;
}
+
+ public AjaxMetaData getAjax()
+ {
+ return ajax;
+ }
+
+ public void setAjax(AjaxMetaData ajax)
+ {
+ this.ajax = ajax;
+ }
+
+ public void merge(org.jboss.portal.portlet.metadata.JBossPortletMetaData portlet)
+ {
+ super.merge(portlet);
+
+ // We handle the core extension here
+ if (portlet instanceof JBossPortletMetaData)
+ {
+ JBossPortletMetaData portletExt = (JBossPortletMetaData)portlet;
+ if (ajax == null)
+ {
+ // If not defined we use the default ajax configuration
+ ajax = portletExt.getAjax();
+ }
+ else
+ {
+ // If no asynchronous value provided use the one provided by the default
+ if (ajax.getAsynchronous() == null)
+ {
+ ajax.setAsynchronous(portletExt.getAjax().getAsynchronous());
+ }
+ }
+ }
+ }
}
Modified:
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceRenderCommand.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -108,7 +108,7 @@
windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER,
"emptyRenderer");
//
- WindowResult res = new WindowResult("", content,
Collections.EMPTY_MAP, windowProps, null, null, WindowState.MAXIMIZED, Mode.VIEW);
+ WindowResult res = new WindowResult("", content,
Collections.EMPTY_MAP, windowProps, null, WindowState.MAXIMIZED, Mode.VIEW);
WindowContext blah = new WindowContext("BILTO", "BILTO",
"maximized", 0, res);
result.addWindowContext(blah);
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-07
21:10:13 UTC (rev 6947)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-04-07
22:52:49 UTC (rev 6948)
@@ -344,6 +344,13 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.core.aspects.portlet.AjaxInterceptor"
+ name="portal:service=Interceptor,type=Portlet,name=Ajax"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
name="portal:service=InterceptorStackFactory,type=Producer"
xmbean-dd=""
@@ -358,6 +365,7 @@
<depends-list-element>portal:service=Interceptor,type=Portlet,name=WindowStates</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Bridge</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Modes</depends-list-element>
+
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Ajax</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=ProducerCache</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Header</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Transaction</depends-list-element>
Modified: trunk/core/src/resources/portal-core-sar/conf/standardjboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/standardjboss-portlet.xml 2007-04-07
21:10:13 UTC (rev 6947)
+++ trunk/core/src/resources/portal-core-sar/conf/standardjboss-portlet.xml 2007-04-07
22:52:49 UTC (rev 6948)
@@ -25,6 +25,9 @@
<portlet>
<portlet-name>DefaultPortlet</portlet-name>
<remotable>false</remotable>
+ <ajax>
+ <asynchronous>true</asynchronous>
+ </ajax>
<transaction>
<trans-attribute>NotSupported</trans-attribute>
</transaction>
Modified: trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-04-07 21:10:13
UTC (rev 6947)
+++ trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-04-07 22:52:49
UTC (rev 6948)
@@ -65,7 +65,7 @@
</portlet>
-->
-<!ELEMENT portlet
(portlet-name,remotable?,session-config?,transaction?,header-content?)>
+<!ELEMENT portlet
(portlet-name,remotable?,ajax?,session-config?,transaction?,header-content?)>
<!--
The portlet name.
@@ -78,6 +78,18 @@
<!ELEMENT remotable (#PCDATA)>
<!--
+The ajax tag allows to configure the ajax capabilities of the portlet. If the portlet is
tagged as asynchronous
+then the portal may use partial page refreshing and render only that portlet. If the
portlet asynchronous value
+is false, then the portal will perform a full page refresh when the portlet is
refreshed.
+-->
+<!ELEMENT ajax (asynchronous)>
+
+<!--
+The authorized values for the asynchronous element are true or false.
+-->
+<!ELEMENT asynchronous (#PCDATA)>
+
+<!--
This element configure the portlet session of the portlet.
The distributed element instructs the container to distribute the session attributes
using the
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
---
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/jboss-portlet.xml 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/jboss-portlet.xml 2007-04-07
22:52:49 UTC (rev 6948)
@@ -79,8 +79,17 @@
</portlet>
<portlet>
<portlet-name>URLPortlet</portlet-name>
+ <ajax>
+ <asynchronous>false</asynchronous>
+ </ajax>
</portlet>
<portlet>
+ <portlet-name>AsyncURLPortlet</portlet-name>
+ <ajax>
+ <asynchronous>true</asynchronous>
+ </ajax>
+ </portlet>
+ <portlet>
<portlet-name>BasicPortlet</portlet-name>
</portlet>
Modified:
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet-instances.xml
===================================================================
---
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet-instances.xml 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet-instances.xml 2007-04-07
22:52:49 UTC (rev 6948)
@@ -76,6 +76,12 @@
</deployment>
<deployment>
<instance>
+ <instance-id>AsyncURLPortletInstance</instance-id>
+ <portlet-ref>AsyncURLPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
<instance-id>TestPortletInstance</instance-id>
<portlet-ref>TestPortlet</portlet-ref>
</instance>
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml 2007-04-07
21:10:13 UTC (rev 6947)
+++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml 2007-04-07
22:52:49 UTC (rev 6948)
@@ -322,6 +322,20 @@
</portlet-info>
</portlet>
<portlet>
+ <description>Async URL Portlet</description>
+ <portlet-name>AsyncURLPortlet</portlet-name>
+ <display-name>Async URL Portlet</display-name>
+
<portlet-class>org.jboss.portal.core.portlet.test.URLPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>URL Portlet</title>
+ <keywords>sample,test</keywords>
+ </portlet-info>
+ </portlet>
+ <portlet>
<portlet-name>BasicPortlet</portlet-name>
<portlet-class>org.jboss.portal.core.portlet.test.BasicPortlet</portlet-class>
<display-name>Basic Portlet</display-name>
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestContext.java 2007-04-07 21:10:13
UTC (rev 6947)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestContext.java 2007-04-07 22:52:49
UTC (rev 6948)
@@ -86,7 +86,6 @@
new HashMap(),
null,
null,
- null,
null);
}
}
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/tmp/TestHelper.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/tmp/TestHelper.java 2007-04-07
21:10:13 UTC (rev 6947)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/tmp/TestHelper.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -124,9 +124,8 @@
{
// setup the window result
Map actionsMap = Collections.EMPTY_MAP;
- Properties responseProps = null;
String headerChars = null;
- return new WindowResult(title, content, actionsMap, windowProps, responseProps,
headerChars, null, null);
+ return new WindowResult(title, content, actionsMap, windowProps, headerChars, null,
null);
}
public static RenderSetMetaData createRenderSetMD() throws Exception
@@ -137,8 +136,7 @@
public static List createRenderSetMDList() throws Exception
{
- List renderSets =
(List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(createRenderSetDescriptor(),
new RenderSetMetaDataFactory(), null);
- return renderSets;
+ return
(List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(createRenderSetDescriptor(),
new RenderSetMetaDataFactory(), null);
}
private static Reader createRenderSetDescriptor()
Modified:
trunk/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/theme/src/main/org/jboss/portal/test/theme/tmp/render/TestRenderedMarkup.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -203,6 +203,6 @@
*/
private WindowResult createWindowMarkup(String sTitle, String sContent)
{
- return new WindowResult(sTitle, sContent, Collections.EMPTY_MAP, new HashMap(),
null, null, null, null);
+ return new WindowResult(sTitle, sContent, Collections.EMPTY_MAP, new HashMap(),
null, null, null);
}
}
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRenderOptions.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRenderOptions.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRenderOptions.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -93,7 +93,7 @@
{
propertyMap.remove(DND_ENABLED);
}
- if (dnd != null)
+ if (asyncWindow != null)
{
propertyMap.put(ASYNC_WINDOW_ENABLED, asyncWindow.toString());
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java 2007-04-07
21:10:13 UTC (rev 6947)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/WindowContext.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -119,7 +119,7 @@
public String getProperty(String name)
{
- return (String)result.getWindowProperties().get(name);
+ return (String)result.getProperties().get(name);
}
public void setRegionName(String regionName)
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java 2007-04-07 21:10:13
UTC (rev 6947)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/WindowResult.java 2007-04-07 22:52:49
UTC (rev 6948)
@@ -25,7 +25,6 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.theme.render.renderer.ActionRendererContext;
-import org.jboss.portal.portlet.Properties;
import java.util.Collection;
import java.util.Map;
@@ -50,13 +49,10 @@
private Map actions;
/** . */
- private final Properties properties;
-
- /** . */
private final String headerContent;
/** . */
- private Map windowProperties;
+ private Map properties;
/** . */
private final WindowState windowState;
@@ -73,8 +69,6 @@
* @param content the rendered markup fragment of the portlet
* @param actions a map of actions possible for this portlet
* @param windowProperties the properties for this window
- * @param responseProperties the properties that were set as response properties
during the portlet's render or
- * action
* @param headerChars content that needs to be injected into the header
* @see WindowResult.Action
*/
@@ -83,17 +77,15 @@
String content,
Map actions,
Map windowProperties,
- Properties responseProperties,
String headerChars,
WindowState windowState,
Mode mode)
{
- this.properties = responseProperties;
this.title = title;
this.content = content;
this.actions = actions;
this.headerContent = headerChars;
- this.windowProperties = windowProperties;
+ this.properties = windowProperties;
this.windowState = windowState;
this.mode = mode;
}
@@ -123,33 +115,16 @@
return windowState;
}
- /**
- * @param familyName
- * @return a collection of triggerable actions for this portlet
- * @see WindowResult.Action
- */
public Collection getTriggerableActions(String familyName)
{
return (Collection)actions.get(familyName);
}
- /** @return the response properties that were set by the portlet during the render or
action */
- public Properties getResponseProperties()
+ public Map getProperties()
{
return properties;
}
- /** @return the properties that were set for this particular window */
- public Map getWindowProperties()
- {
- return windowProperties;
- }
-
- public void setWindowProperties(Map windowProperties)
- {
- this.windowProperties = windowProperties;
- }
-
/**
* Represents an action that can be triggered.
* <p/>
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/HeaderContentTagHandler.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/tag/HeaderContentTagHandler.java 2007-04-07
21:10:13 UTC (rev 6947)
+++
trunk/theme/src/main/org/jboss/portal/theme/tag/HeaderContentTagHandler.java 2007-04-07
22:52:49 UTC (rev 6948)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.theme.tag;
-import org.jboss.portal.portlet.Properties;
import org.jboss.portal.theme.LayoutConstants;
import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.page.WindowResult;
@@ -50,10 +49,11 @@
{
public void doTag() throws JspException, IOException
{
- // get page and region
+ // Get page and region
PageContext app = (PageContext)getJspContext();
HttpServletRequest request = (HttpServletRequest)app.getRequest();
+ //
PageResult page = (PageResult)request.getAttribute(LayoutConstants.ATTR_PAGE);
JspWriter out = this.getJspContext().getOut();
if (page == null)
@@ -64,22 +64,12 @@
return;
}
+ //
Map results = page.getWindowContextMap();
for (Iterator i = results.values().iterator(); i.hasNext();)
{
WindowContext wc = (WindowContext)i.next();
WindowResult result = wc.getResult();
-
- Properties responseProperties = result.getResponseProperties();
- if (responseProperties != null)
- {
- String headerContentProperty =
responseProperties.getProperty("HEADER_CONTENT");
- if (headerContentProperty != null)
- {
- out.println(headerContentProperty);
- }
- }
-
if (result.getHeaderContent() != null)
{
out.println(result.getHeaderContent());