JBoss Portal SVN: r9849 - in branches/JBoss_Portal_Branch_2_6: wsrp/src/main/org/jboss/portal/test/wsrp/consumer and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-02-07 20:51:33 -0500 (Thu, 07 Feb 2008)
New Revision: 9849
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
Log:
- JBPORTAL-1877: ConsumerRegistryService was not properly updated when the producer info id was updated.
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2008-02-08 01:35:21 UTC (rev 9848)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2008-02-08 01:51:33 UTC (rev 9849)
@@ -113,13 +113,20 @@
else
{
consumer = registry.getConsumer(id);
- EndpointConfigurationInfo endpoint = getProducerInfo().getEndpointConfigurationInfo();
- serviceDescription = endpoint.getServiceDescriptionURL();
- markup = endpoint.getMarkupURL();
- portletManagement = endpoint.getPortletManagementURL();
- registration = endpoint.getRegistrationURL();
- wsdl = endpoint.getWsdlDefinitionURL();
- useWSDL = endpoint.usesWSDL();
+ if (consumer != null)
+ {
+ EndpointConfigurationInfo endpoint = getProducerInfo().getEndpointConfigurationInfo();
+ serviceDescription = endpoint.getServiceDescriptionURL();
+ markup = endpoint.getMarkupURL();
+ portletManagement = endpoint.getPortletManagementURL();
+ registration = endpoint.getRegistrationURL();
+ wsdl = endpoint.getWsdlDefinitionURL();
+ useWSDL = endpoint.usesWSDL();
+ }
+ else
+ {
+ beanContext.createErrorMessage("Couldn't find consumer '" + id + "'!");
+ }
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java 2008-02-08 01:35:21 UTC (rev 9848)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ConsumerRegistryTestCase.java 2008-02-08 01:51:33 UTC (rev 9849)
@@ -113,8 +113,22 @@
TransactionAssert.commitTransaction();
}
- public void testPersist()
+ public void testUpdateProducerInfo()
{
-// registry.persistConsumer();
+ // create a foo consumer
+ TransactionAssert.beginTransaction();
+ String id = "foo";
+ WSRPConsumer consumer = registry.createConsumer(id, null);
+ ProducerInfo info = consumer.getProducerInfo();
+ TransactionAssert.commitTransaction();
+
+ TransactionAssert.beginTransaction();
+ // change the id on the consumer's producer info and save it
+ info.setId("bar");
+ registry.updateProducerInfo(info);
+
+ assertNull(registry.getConsumer(id));
+ assertEquals(consumer, registry.getConsumer("bar"));
+ TransactionAssert.commitTransaction();
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2008-02-08 01:35:21 UTC (rev 9848)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2008-02-08 01:51:33 UTC (rev 9849)
@@ -233,7 +233,28 @@
Session session = sessionFactory.getCurrentSession();
try
{
- session.update(producerInfo);
+
+ // Retrieve the previous id of the given ProducerInfo to update local consumers map if needed
+ String oldId = null;
+ ProducerInfo old = (ProducerInfo)session.get(ProducerInfo.class, producerInfo.getKey());
+ if (old != null)
+ {
+ oldId = old.getId();
+ if (producerInfo.getId().equals(oldId))
+ {
+ oldId = null; // reset oldId as the ProducerInfo's id hasn't been modified
+ }
+ }
+
+ // merge old producer info with new data
+ session.merge(producerInfo);
+
+ // if we updated and oldId is not null, we need to update the local consumers map
+ if (oldId != null)
+ {
+ WSRPConsumer consumer = consumers.remove(oldId);
+ consumers.put(producerInfo.getId(), consumer);
+ }
}
catch (HibernateException e)
{
16 years, 4 months
JBoss Portal SVN: r9848 - modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-02-07 20:35:21 -0500 (Thu, 07 Feb 2008)
New Revision: 9848
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/portlet.tag
Log:
dynamic portlet
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/portlet.tag
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/portlet.tag 2008-02-08 01:34:25 UTC (rev 9847)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/portlet.tag 2008-02-08 01:35:21 UTC (rev 9848)
@@ -5,8 +5,8 @@
<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
<portal:portlet
- name="GoogleMap"
- applicationName="google-map-portlet">
+ name="${name}"
+ applicationName="${applicationName}">
<div class="portlet">
<div class="portlet-frame">
<div class="header full-width">
16 years, 4 months
JBoss Portal SVN: r9847 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp: taglib and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-07 20:34:25 -0500 (Thu, 07 Feb 2008)
New Revision: 9847
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/AbstractURLTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
Log:
support for maximized with new design
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-08 00:01:29 UTC (rev 9846)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-08 01:34:25 UTC (rev 9847)
@@ -29,6 +29,9 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -49,6 +52,9 @@
/** . */
private int count = 0;
+ /** . */
+ private final MutableOut out;
+
public PortalResponse(
HttpServletResponse response,
PagePortletControllerContext portletControllerContext,
@@ -59,6 +65,7 @@
//
this.portletControllerContext = portletControllerContext;
this.pageState = pageState;
+ this.out = new MutableOut(this);
}
/**
@@ -138,8 +145,28 @@
// buffer.close();
// }
+ public void setMuted(boolean muted)
+ {
+ out.setMuted(muted);
+ }
+
+ public boolean isMuted()
+ {
+ return out.isMuted();
+ }
+
public String nextId()
{
return "" + count++;
}
+
+// public ServletOutputStream getOutputStream() throws IOException
+// {
+// return out.getOutputStream();
+// }
+//
+// public PrintWriter getWriter() throws IOException
+// {
+// return out.getWriter();
+// }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/AbstractURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/AbstractURLTag.java 2008-02-08 00:01:29 UTC (rev 9846)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/AbstractURLTag.java 2008-02-08 01:34:25 UTC (rev 9847)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.BodyTagSupport;
import java.util.Map;
import java.util.HashMap;
@@ -31,7 +30,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class AbstractURLTag extends BodyTagSupport
+public class AbstractURLTag extends PortalBodyTagSupport
{
/** . */
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-08 00:01:29 UTC (rev 9846)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-08 01:34:25 UTC (rev 9847)
@@ -22,25 +22,54 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.taglib;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
+
import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.BodyTagSupport;
+import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PageTag extends BodyTagSupport
+public class PageTag extends PortalBodyTagSupport
{
+ String maximizedId;
+
+ String content;
+
public int doStartTag() throws JspException
{
+ PortalResponse response = getPortalResponse();
+
//
- return EVAL_BODY_INCLUDE;
+ maximizedId = response.getMaximizedWindowId();
+
+ //
+ if (maximizedId != null)
+ {
+ return EVAL_BODY_BUFFERED;
+ }
+ else
+ {
+ return EVAL_BODY_INCLUDE;
+ }
}
public int doEndTag() throws JspException
{
- //
+ if (maximizedId != null)
+ {
+ try
+ {
+ pageContext.getOut().write(content);
+ }
+ catch (IOException e)
+ {
+ throw new JspException(e);
+ }
+ }
+
return EVAL_PAGE;
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-08 00:01:29 UTC (rev 9846)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-08 01:34:25 UTC (rev 9847)
@@ -46,19 +46,28 @@
import org.jboss.portal.common.util.ParameterMap;
import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.BodyTagSupport;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.Collections;
+import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PortletTag extends BodyTagSupport
+public class PortletTag extends PortalBodyTagSupport
{
/** . */
+ private static final int SKIPPED = 0;
+
+ /** . */
+ private static final int BUFFERED = 1;
+
+ /** . */
+ private static final int RENDERED = 2;
+
+ /** . */
private static final Set<Mode> DEFAULT_MODES = Collections.unmodifiableSet(Tools.toSet(Mode.VIEW, Mode.EDIT, Mode.HELP));
/** . */
@@ -79,6 +88,12 @@
/** . */
private String initialModeValue;
+ /** . */
+ private int status;
+
+ /** . */
+ PortletResult result;
+
public String getName()
{
return name;
@@ -129,26 +144,84 @@
this.initialModeValue = initialMode;
}
- PortletResult result;
-
public int doStartTag() throws JspException
{
- PortalResponse response = (PortalResponse)pageContext.getResponse();
-
+ PortalResponse response = getPortalResponse();
+ PagePortletControllerContext context = response.getPortletControllerContext();
+ PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
+
//
- result = render(response);
+ Portlet portlet = context.findPortlet(applicationName, name);
+ // Compute window id
+ String windowId = portlet.getContext().getId() + "." + response.nextId();
+
//
- return EVAL_BODY_INCLUDE;
+
+ //
+ if (pageTag.maximizedId != null)
+ {
+ if (windowId.equals(pageTag.maximizedId))
+ {
+ result = render(response, portlet, windowId);
+ status = BUFFERED;
+ }
+ else
+ {
+ status = SKIPPED;
+ }
+ }
+ else
+ {
+ result = render(response, portlet, windowId);
+ status = RENDERED;
+ }
+
+ //
+ switch (status)
+ {
+ case SKIPPED:
+ return SKIP_BODY;
+ case RENDERED:
+ return EVAL_BODY_INCLUDE;
+ case BUFFERED:
+ return EVAL_BODY_BUFFERED;
+ default:
+ throw new AssertionError();
+ }
}
public int doEndTag() throws JspException
{
+ result = null;
+
+ //
+ switch (status)
+ {
+ case SKIPPED:
+ break;
+ case RENDERED:
+ break;
+ case BUFFERED:
+ PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
+ pageTag.content = bodyContent.getString();
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
return EVAL_PAGE;
}
- public PortletResult render(PortalResponse response)
+ public PortletResult render(
+ PortalResponse response,
+ Portlet portlet,
+ String windowId)
{
+ PagePortletControllerContext context = response.getPortletControllerContext();
+
+ //
Set<Mode> supportedModes = new LinkedHashSet<Mode>();
if (supportedModeValues != null)
{
@@ -186,13 +259,6 @@
}
//
- PagePortletControllerContext context = response.getPortletControllerContext();
-
- //
- Portlet portlet = context.findPortlet(applicationName, name);
-
- //
- String windowId = portlet.getContext().getId() + "." + response.nextId();
PageNavigationalState pageNS = response.getPageState();
//
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-08 00:01:29 UTC (rev 9846)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-08 01:34:25 UTC (rev 9847)
@@ -27,7 +27,6 @@
import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.RenderURL;
import org.jboss.portal.portlet.StateString;
@@ -78,7 +77,7 @@
public int doEndTag() throws JspException
{
- PortalResponse response = (PortalResponse)pageContext.getResponse();
+ PortalResponse response = getPortalResponse();
PagePortletControllerContext context = response.getPortletControllerContext();
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
16 years, 4 months
JBoss Portal SVN: r9846 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response: portlet and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-07 19:01:29 -0500 (Thu, 07 Feb 2008)
New Revision: 9846
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java
Log:
remove class that should have been removed
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java 2008-02-08 00:00:01 UTC (rev 9845)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java 2008-02-08 00:01:29 UTC (rev 9846)
@@ -1,145 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response;
-
-import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
-import org.jboss.portal.WindowState;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class BufferingResponse extends HttpServletResponseWrapper
-{
-
- /** . */
-// private final ResponseBuffer buffer = new ResponseBuffer();
-
- /** . */
- private final PagePortletControllerContext portletControllerContext;
-
- /** . */
- private final PageNavigationalState pageState;
-
- /** . */
- private int count = 0;
-
- public BufferingResponse(
- HttpServletResponse response,
- PagePortletControllerContext portletControllerContext,
- PageNavigationalState pageState)
- {
- super(response);
-
- //
- this.portletControllerContext = portletControllerContext;
- this.pageState = pageState;
- }
-
- /**
- * The page state for the rendering.
- *
- * @return the page state
- */
- public PageNavigationalState getPageState()
- {
- return pageState;
- }
-
- public String getMaximizedWindowId()
- {
- if (pageState != null)
- {
- for (String windowId : pageState.getWindowIds())
- {
- WindowNavigationalState windowNS = pageState.getWindowNavigationalState(windowId);
- if (WindowState.MAXIMIZED.equals(windowNS.getWindowState()))
- {
- return windowId;
- }
- }
- }
-
- //
- return null;
- }
-
- public boolean isRenderable(String windowId)
- {
- if (windowId == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (pageState == null)
- {
- return false;
- }
-
- //
- String maximizedWindowId = getMaximizedWindowId();
- if (maximizedWindowId != null)
- {
- return maximizedWindowId.equals(windowId);
- }
-
- //
- return true;
- }
-
- public PagePortletControllerContext getPortletControllerContext()
- {
- return portletControllerContext;
- }
-
-// public ResponseBuffer getBuffer()
-// {
-// return buffer;
-// }
-//
-// public ServletOutputStream getOutputStream() throws IOException
-// {
-// return buffer.getOutputStream();
-// }
-//
-// public PrintWriter getWriter() throws IOException
-// {
-// return buffer.getWriter();
-// }
-//
-// public void close()
-// {
-// buffer.close();
-// }
-
- public String nextId()
- {
- return "" + count++;
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java 2008-02-08 00:00:01 UTC (rev 9845)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java 2008-02-08 00:01:29 UTC (rev 9846)
@@ -1,111 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response.portlet;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StartPortletChunk
-{
-
- /** . */
- private final String portletName;
-
- /** . */
- private final String applicationName;
-
- /** . */
- private final String windowId;
-
- /** . */
- private final PortletInvocationResponse response;
-
- /** . */
- private final Mode initialMode;
-
- /** . */
- private final Set<Mode> supportedModes;
-
- /** . */
- private final Set<WindowState> supportedWindowStates;
-
- public StartPortletChunk(
- String portletName,
- String applicationName,
- String windowId,
- PortletInvocationResponse response,
- Mode initialMode,
- Set<Mode> supportedModes,
- Set<WindowState> supportedWindowStates)
- {
- this.portletName = portletName;
- this.applicationName = applicationName;
- this.windowId = windowId;
- this.response = response;
- this.initialMode = initialMode;
- this.supportedModes = supportedModes;
- this.supportedWindowStates = supportedWindowStates;
- }
-
- public String getPortletName()
- {
- return portletName;
- }
-
- public String getApplicationName()
- {
- return applicationName;
- }
-
- public String getWindowId()
- {
- return windowId;
- }
-
- public PortletInvocationResponse getResponse()
- {
- return response;
- }
-
- public Mode getInitialMode()
- {
- return initialMode;
- }
-
- public Set<Mode> getSupportedModes()
- {
- return supportedModes;
- }
-
- public Set<WindowState> getSupportedWindowStates()
- {
- return supportedWindowStates;
- }
-}
16 years, 4 months
JBoss Portal SVN: r9845 - modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-07 19:00:01 -0500 (Thu, 07 Feb 2008)
New Revision: 9845
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/default.jsp
Log:
make work commented a tag that was making break (npe)
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/default.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/default.jsp 2008-02-07 23:42:33 UTC (rev 9844)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/default.jsp 2008-02-08 00:00:01 UTC (rev 9845)
@@ -39,7 +39,9 @@
<div id="content">
<portal:page>
<jbp:portlet name="GoogleMap" applicationName="google-map-portlet" >
+<%--
<a href="<portal:portleturl><portal:param name='zipcode' value='20855'/></portal:portleturl>">Derwood</a>
+--%>
</jbp:portlet>
<jbp:portlet name="GoogleWeather" applicationName="google-weather-portlet" />
<jbp:portlet name="RemoteControl" applicationName="remotecontrol-portlet" />
16 years, 4 months
JBoss Portal SVN: r9844 - in modules/portlet/trunk/test/src/test/resources/simple-portal-war: WEB-INF and 5 other directories.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-02-07 18:42:33 -0500 (Thu, 07 Feb 2008)
New Revision: 9844
Added:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/portlet.tag
modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/
modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/master.css
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/active-button-bg.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-maximize.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-minimize.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-normal.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/inactive-button-bg.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/logo-header.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/nav-bg.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/pc20.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portal-bg.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portlet-title-rt-bg.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portlet-titlebg.gif
modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/
modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/default.jsp
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
Log:
Initial layout
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/portlet.tag
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/portlet.tag (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/tags/portal/portlet.tag 2008-02-07 23:42:33 UTC (rev 9844)
@@ -0,0 +1,29 @@
+<%@ tag body-content="scriptless" %>
+<%@ attribute name="name" required="true" %>
+<%@ attribute name="applicationName" required="true" %>
+<%@ attribute name="content" fragment="true" required="false" %>
+<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
+
+<portal:portlet
+ name="GoogleMap"
+ applicationName="google-map-portlet">
+<div class="portlet">
+ <div class="portlet-frame">
+ <div class="header full-width">
+ <div class="header-layer full-width">
+ <div class="title half-width float-left"><portal:portlettitle/></div>
+ <div class="controls half-width float-right">
+ <a href="<portal:portleturl windowState='maximized'/>"><img src="/simple/images/icon-maximize.gif" alt=""/></a>
+ <a href="<portal:portleturl windowState='normal'/>"><img src="images/icon-normal.gif" alt=""/></a>
+ <a href="<portal:portleturl windowState='minimized'/>"><img src="images/icon-minimize.gif" alt=""/></a>
+ <a title="Edit" href="<portal:portleturl mode='edit'/>">Edit</a>
+ </div>
+ </div>
+ </div>
+ <portal:portletmarkup/>
+
+ <jsp:doBody/>
+
+</div>
+</div>
+</portal:portlet>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/master.css
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/master.css (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/master.css 2008-02-07 23:42:33 UTC (rev 9844)
@@ -0,0 +1,235 @@
+body {
+ font: normal 12px Lucida Sans, Trebuchet, tahoma, sans-serif;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-center-margin {
+ margin: 0 auto 0 auto;
+}
+
+.float-left {
+ float: left;
+}
+
+.float-right {
+ float: right;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-right {
+ text-align: right;
+}
+
+.half-width {
+ width: 49%;
+}
+
+.quarter-width {
+ width: 24.9%;
+}
+
+.three-quarter-width {
+ width: 74.9%;
+}
+
+.full-width {
+ width: 100%;
+}
+
+.third-width {
+ width: 32.9%;
+}
+
+.two-third-width {
+ width: 65.5%;
+}
+
+.tenpx-top-bottom {
+ margin: 10px 0 10px 0;
+}
+
+.relative {
+ position: relative
+}
+
+.absolute {
+ position: absolute
+}
+
+p.white-padded {
+ color: #fff;
+ padding: 5px;
+}
+
+.clear {
+ clear: both;
+}
+
+img {
+ margin: 0;
+ padding: 0;
+ border: 0;
+}
+
+body,
+div,
+form,
+ul,
+li {
+ margin: 0;
+ padding: 0;
+}
+
+ul {
+
+}
+
+/*--------------------------------Decoration*/
+
+h2 {
+ font-size: 1.9em;
+ color: #fff;
+ margin: 0;
+ padding: 0;
+}
+
+h3 {
+ font-size: 1.0em;
+ color: #fff;
+ margin: 0;
+ padding: 0;
+}
+
+a {
+ color: #e1d77e;
+}
+
+p {
+ margin: 0;
+ padding: 0;
+}
+
+
+/*-------------------------------Container Decoration*/
+
+div#container>div.header {
+ height: 40px;
+ background-color: #000;
+}
+
+div#container div.header div.logo {
+ background-image: url( /simple/images/logo-header.gif );
+ background-repeat: no-repeat;
+ background-position: top left;
+ height:40px;
+}
+
+div#container div.header div.pc20 {
+ text-align: right;
+}
+
+div#container div.header div.pc20 img {
+ margin: 5px 10px 0 0;
+}
+
+div#container div.nav {
+ background-image: url( /simple/images/nav-bg.gif );
+ background-repeat: repeat-x;
+ background-position: top left;
+ border-top: 1px solid #878787;
+ border-bottom: 1px solid #383838;
+ height:23px;
+}
+
+div#container div.nav ul {
+ height:23px;
+ margin: 0 0 0 10px;
+}
+
+div#container div.nav ul li {
+ display: inline;
+ float: left;
+ text-align: center;
+ height: 21px;
+ border: 1px solid #929292;
+}
+
+div#container div.nav ul li a,
+div#container div.nav ul li a:hover {
+ display: block;
+ padding: 4px 12px 4px 12px;
+ background-repeat: repeat-x;
+ background-position: top left;
+ text-decoration:none;
+ font: bold 11px Lucida Sans, Trebuchet, tahoma, sans-serif;
+}
+
+div#container div.nav ul li a{
+ color: #353535;
+ background-image: url( /simple/images/inactive-button-bg.gif );
+}
+
+div#container div.nav ul li a:hover,
+div#container div.nav ul li a.selected{
+ color: #000;
+ background-image: url( /simple/images/active-button-bg.gif );
+}
+
+div#container div#content {
+ background-image: url( /simple/images/portal-bg.gif );
+ background-repeat: repeat-x;
+ background-position: top left;
+ min-height: 600px;
+ padding: 10px;
+}
+
+/*-------------------------------Portlet Decoration*/
+
+div#container div#content div.portlet{
+ /*width: 800px;*/
+ border: 1px solid #969696;
+ background-color: #e2e2e2;
+ padding: 2px;
+ float:left;
+}
+
+div#container div#content div.portlet-frame{
+ background-color: #fff;
+ border: 1px solid #fff;
+ /*height: 500px;*/
+}
+
+div#container div#content div.portlet div.header {
+ background-image: url( /simple/images/portlet-titlebg.gif );
+ background-repeat: repeat-x;
+ background-position: top left;
+ height:20px;
+}
+
+div#container div#content div.portlet div.header div.header-layer {
+ background-image: url( /simple/images/portlet-title-rt-bg.gif );
+ background-repeat: no-repeat;
+ background-position: top right;
+ height:20px;
+}
+
+div#container div#content div.portlet div.header div.header-layer div.title{
+ font: bold 12px Lucida Sans, Trebuchet, tahoma, sans-serif;
+ color: #fff;
+ padding: 2px;
+}
+
+div#container div#content div.portlet div.header div.header-layer div.controls{
+ text-align: right;
+ padding: 3px 3px 0 0;
+}
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/active-button-bg.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/active-button-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-maximize.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-maximize.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-minimize.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-minimize.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-normal.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/icon-normal.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/inactive-button-bg.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/inactive-button-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/logo-header.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/logo-header.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/nav-bg.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/nav-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/pc20.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/pc20.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portal-bg.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portal-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portlet-title-rt-bg.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portlet-title-rt-bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portlet-titlebg.gif
===================================================================
(Binary files differ)
Property changes on: modules/portlet/trunk/test/src/test/resources/simple-portal-war/images/portlet-titlebg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-07 23:42:16 UTC (rev 9843)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-07 23:42:33 UTC (rev 9844)
@@ -3,59 +3,6 @@
<%@ page isELIgnored="false" %>
<html>
<body>
-<portal:page>
- <portal:portlet name="GoogleWeather" applicationName="google-weather-portlet">
- <div class="portlet">
- <div class="titlebar">
- <div class="title"><portal:portlettitle/></div>
- <ul class="actions">
- <li><a title="Maximize" href="<portal:portleturl windowState='maximized'/>">M</a></li>
- <li><a title="Normal" href="<portal:portleturl windowState='normal'/>">n</a></li>
- <li><a title="Minimize" href="<portal:portleturl windowState='minimized'/>">m</a></li>
- <li><a title="Edit" href="<portal:portleturl mode='edit'/>">Edit</a></li>
- </ul>
- </div>
- <div class="portletcontent">
- <portal:portletmarkup/>
- </div>
- </div>
- </portal:portlet>
-
-
- <portal:portlet name="GoogleMap" applicationName="google-map-portlet">
- <div class="portlet">
- <div class="titlebar">
- <div class="title"><portal:portlettitle/></div>
- <ul class="actions">
- <li><a title="Maximize" href="<portal:portleturl windowState='maximized'/>">M</a></li>
- <li><a title="Normal" href="<portal:portleturl windowState='normal'/>">n</a></li>
- <li><a title="Minimize" href="<portal:portleturl windowState='minimized'/>">m</a></li>
- <li><a title="Edit" href="<portal:portleturl mode='edit'/>">Edit</a></li>
- </ul>
- </div>
- <div class="portletcontent">
- <portal:portletmarkup/>
- </div>
- </div>
- </portal:portlet>
-
- <br/>
- <portal:portlet name="RemoteControl" applicationName="remotecontrol-portlet">
- <div class="portlet">
- <div class="titlebar">
- <div class="title"><portal:portlettitle/></div>
- <ul class="actions">
- <li><a title="Maximize" href="<portal:portleturl windowState='maximized'/>">M</a></li>
- <li><a title="Normal" href="<portal:portleturl windowState='normal'/>">n</a></li>
- <li><a title="Minimize" href="<portal:portleturl windowState='minimized'/>">m</a></li>
- <li><a title="Edit" href="<portal:portleturl mode='edit'/>">Edit</a></li>
- </ul>
- </div>
- <div class="portletcontent">
- <portal:portletmarkup/>
- </div>
- </div>
- </portal:portlet>
-</portal:page>
+<jsp:forward page="layouts/default.jsp" />
</body>
</html>
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/default.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/default.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts/default.jsp 2008-02-07 23:42:33 UTC (rev 9844)
@@ -0,0 +1,52 @@
+<%@ page contentType="text/html" %>
+<%@ page language="java" %>
+<%@ taglib prefix="jbp" tagdir="/WEB-INF/tags/portal" %>
+<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
+<%@ page isELIgnored="false" %>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<title>Portlet Container 2.0</title>
+<link rel="stylesheet" href="/simple/css/master.css" type="text/css"/>
+</head>
+<body>
+
+<div id="container" class="full-width">
+ <div class="header full-width">
+ <div class="float-left three-quarter-width logo"></div>
+ <div class="float-right quarter-width pc20">
+ <img src="../images/pc20.gif" alt=""/>
+ </div>
+ <br class="clear"/>
+ </div>
+ <div class="nav full-width">
+ <ul>
+ <li>
+ <a href="" class="selected">option1</a>
+ </li>
+ <li>
+ <a href="">option2</a>
+ </li>
+ <li>
+ <a href="">option3</a>
+ </li>
+ </ul>
+ <br class="clear"/>
+ </div>
+ <div id="content">
+ <portal:page>
+ <jbp:portlet name="GoogleMap" applicationName="google-map-portlet" >
+ <a href="<portal:portleturl><portal:param name='zipcode' value='20855'/></portal:portleturl>">Derwood</a>
+ </jbp:portlet>
+ <jbp:portlet name="GoogleWeather" applicationName="google-weather-portlet" />
+ <jbp:portlet name="RemoteControl" applicationName="remotecontrol-portlet" />
+ </portal:page>
+ </div>
+ <br class="clear"/>
+</div>
+
+</body>
+</html>
\ No newline at end of file
16 years, 4 months
JBoss Portal SVN: r9843 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp: taglib and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-07 18:42:16 -0500 (Thu, 07 Feb 2008)
New Revision: 9843
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletResult.java
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
Log:
rename old classes to new classes (concepts)
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-07 23:34:46 UTC (rev 9842)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-07 23:42:16 UTC (rev 9843)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp;
-import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -207,10 +207,10 @@
}
//
- BufferingResponse bufferingResponse = new BufferingResponse(resp, context, pageState);
+ PortalResponse portalResponse = new PortalResponse(resp, context, pageState);
//
- chain.doFilter(req, bufferingResponse);
+ chain.doFilter(req, portalResponse);
}
public void destroy()
@@ -218,7 +218,7 @@
this.config = null;
}
- protected void render(HttpServletRequest req, BufferingResponse resp) throws ServletException, IOException, ClassNotFoundException
+ protected void render(HttpServletRequest req, PortalResponse resp) throws ServletException, IOException, ClassNotFoundException
{
//
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java (from rev 9842, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-07 23:42:16 UTC (rev 9843)
@@ -0,0 +1,145 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp;
+
+import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.WindowState;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalResponse extends HttpServletResponseWrapper
+{
+
+ /** . */
+// private final ResponseBuffer buffer = new ResponseBuffer();
+
+ /** . */
+ private final PagePortletControllerContext portletControllerContext;
+
+ /** . */
+ private final PageNavigationalState pageState;
+
+ /** . */
+ private int count = 0;
+
+ public PortalResponse(
+ HttpServletResponse response,
+ PagePortletControllerContext portletControllerContext,
+ PageNavigationalState pageState)
+ {
+ super(response);
+
+ //
+ this.portletControllerContext = portletControllerContext;
+ this.pageState = pageState;
+ }
+
+ /**
+ * The page state for the rendering.
+ *
+ * @return the page state
+ */
+ public PageNavigationalState getPageState()
+ {
+ return pageState;
+ }
+
+ public String getMaximizedWindowId()
+ {
+ if (pageState != null)
+ {
+ for (String windowId : pageState.getWindowIds())
+ {
+ WindowNavigationalState windowNS = pageState.getWindowNavigationalState(windowId);
+ if (WindowState.MAXIMIZED.equals(windowNS.getWindowState()))
+ {
+ return windowId;
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+
+ public boolean isRenderable(String windowId)
+ {
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (pageState == null)
+ {
+ return false;
+ }
+
+ //
+ String maximizedWindowId = getMaximizedWindowId();
+ if (maximizedWindowId != null)
+ {
+ return maximizedWindowId.equals(windowId);
+ }
+
+ //
+ return true;
+ }
+
+ public PagePortletControllerContext getPortletControllerContext()
+ {
+ return portletControllerContext;
+ }
+
+// public ResponseBuffer getBuffer()
+// {
+// return buffer;
+// }
+//
+// public ServletOutputStream getOutputStream() throws IOException
+// {
+// return buffer.getOutputStream();
+// }
+//
+// public PrintWriter getWriter() throws IOException
+// {
+// return buffer.getWriter();
+// }
+//
+// public void close()
+// {
+// buffer.close();
+// }
+
+ public String nextId()
+ {
+ return "" + count++;
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java 2008-02-07 23:34:46 UTC (rev 9842)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java 2008-02-07 23:42:16 UTC (rev 9843)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.taglib;
-import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import javax.servlet.jsp.PageContext;
@@ -33,9 +33,9 @@
*/
public class PortalSimpleTagSupport extends SimpleTagSupport
{
- protected final BufferingResponse getPortalResponse()
+ protected final PortalResponse getPortalResponse()
{
PageContext pageContext = (PageContext)getJspContext();
- return (BufferingResponse)pageContext.getResponse();
+ return (PortalResponse)pageContext.getResponse();
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-07 23:34:46 UTC (rev 9842)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-07 23:42:16 UTC (rev 9843)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.taglib;
-import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
@@ -42,11 +42,11 @@
public void doTag() throws JspException, IOException
{
- BufferingResponse resp = getPortalResponse();
+ PortalResponse resp = getPortalResponse();
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
- PortletInvocationResponse portletResp = portletTag.chunk.getResponse();
+ PortletInvocationResponse portletResp = portletTag.result.getResponse();
JspWriter out = getJspContext().getOut();
@@ -58,7 +58,7 @@
WindowNavigationalState windowNS = null;
if (resp.getPageState() != null)
{
- windowNS = resp.getPageState().getWindowNavigationalState(portletTag.chunk.getWindowId());
+ windowNS = resp.getPageState().getWindowNavigationalState(portletTag.result.getWindowId());
}
if (windowNS == null || !windowNS.getWindowState().equals(WindowState.MINIMIZED))
{
@@ -80,13 +80,13 @@
}
else
{
- out.write(portletResp.getClass().getSimpleName() + "[" + portletTag.chunk.getPortletName() + "," + portletTag.chunk.getApplicationName() + "]");
+ out.write(portletResp.getClass().getSimpleName() + "[" + portletTag.result.getPortletName() + "," + portletTag.result.getApplicationName() + "]");
out.flush();
}
}
else
{
- out.write("Empty[" + portletTag.chunk.getPortletName() + "," + portletTag.chunk.getApplicationName() + "]");
+ out.write("Empty[" + portletTag.result.getPortletName() + "," + portletTag.result.getApplicationName() + "]");
out.flush();
}
}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletResult.java (from rev 9842, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletResult.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletResult.java 2008-02-07 23:42:16 UTC (rev 9843)
@@ -0,0 +1,114 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.taglib;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+import java.util.Set;
+
+/**
+ * Combines the invocation of a portlet and the info on the portlet JSP tag. It does
+ * not need to be exposed out of this package.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class PortletResult
+{
+
+ /** . */
+ private final String portletName;
+
+ /** . */
+ private final String applicationName;
+
+ /** . */
+ private final String windowId;
+
+ /** . */
+ private final PortletInvocationResponse response;
+
+ /** . */
+ private final Mode initialMode;
+
+ /** . */
+ private final Set<Mode> supportedModes;
+
+ /** . */
+ private final Set<WindowState> supportedWindowStates;
+
+ public PortletResult(
+ String portletName,
+ String applicationName,
+ String windowId,
+ PortletInvocationResponse response,
+ Mode initialMode,
+ Set<Mode> supportedModes,
+ Set<WindowState> supportedWindowStates)
+ {
+ this.portletName = portletName;
+ this.applicationName = applicationName;
+ this.windowId = windowId;
+ this.response = response;
+ this.initialMode = initialMode;
+ this.supportedModes = supportedModes;
+ this.supportedWindowStates = supportedWindowStates;
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
+ public PortletInvocationResponse getResponse()
+ {
+ return response;
+ }
+
+ public Mode getInitialMode()
+ {
+ return initialMode;
+ }
+
+ public Set<Mode> getSupportedModes()
+ {
+ return supportedModes;
+ }
+
+ public Set<WindowState> getSupportedWindowStates()
+ {
+ return supportedWindowStates;
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-07 23:34:46 UTC (rev 9842)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-07 23:42:16 UTC (rev 9843)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.taglib;
-import org.jboss.portal.portlet.test.jsp.response.portlet.StartPortletChunk;
-import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.taglib.PortletResult;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
import org.jboss.portal.portlet.test.controller.TestInstanceContext;
import org.jboss.portal.portlet.test.controller.TestPortalContext;
@@ -129,14 +129,14 @@
this.initialModeValue = initialMode;
}
- StartPortletChunk chunk;
+ PortletResult result;
public int doStartTag() throws JspException
{
- BufferingResponse response = (BufferingResponse)pageContext.getResponse();
+ PortalResponse response = (PortalResponse)pageContext.getResponse();
//
- chunk = render(response);
+ result = render(response);
//
return EVAL_BODY_INCLUDE;
@@ -147,7 +147,7 @@
return EVAL_PAGE;
}
- public StartPortletChunk render(BufferingResponse response)
+ public PortletResult render(PortalResponse response)
{
Set<Mode> supportedModes = new LinkedHashSet<Mode>();
if (supportedModeValues != null)
@@ -264,7 +264,7 @@
}
//
- return new StartPortletChunk(
+ return new PortletResult(
name,
applicationName,
windowId,
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java 2008-02-07 23:34:46 UTC (rev 9842)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java 2008-02-07 23:42:16 UTC (rev 9843)
@@ -42,7 +42,7 @@
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
- PortletInvocationResponse portletResp = portletTag.chunk.getResponse();
+ PortletInvocationResponse portletResp = portletTag.result.getResponse();
JspWriter out = getJspContext().getOut();
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-07 23:34:46 UTC (rev 9842)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-07 23:42:16 UTC (rev 9843)
@@ -24,7 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -78,7 +78,7 @@
public int doEndTag() throws JspException
{
- BufferingResponse response = (BufferingResponse)pageContext.getResponse();
+ PortalResponse response = (PortalResponse)pageContext.getResponse();
PagePortletControllerContext context = response.getPortletControllerContext();
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
@@ -88,9 +88,6 @@
mode = Mode.create(modeValue.trim());
}
- PortletInvocationResponse portletResp = portletTag.chunk.getResponse();
-
-
//
WindowState windowState = null;
if (windowStateValue != null)
@@ -135,7 +132,7 @@
try
{
JspWriter out = pageContext.getOut();
- String renderedURL = renderer.renderURL(portletTag.chunk.getWindowId(), url, null, null, true);
+ String renderedURL = renderer.renderURL(portletTag.result.getWindowId(), url, null, null, true);
out.write(renderedURL);
}
catch (IOException e)
16 years, 4 months
JBoss Portal SVN: r9842 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp: response and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-07 18:34:46 -0500 (Thu, 07 Feb 2008)
New Revision: 9842
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/Page.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/Window.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/EndPageChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/StartPageChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/EndPortletChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/PortletMarkupChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/PortletURLChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletTitleChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/BodyChunkTagSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/SimpleChunkTagSupport.java
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/AbstractURLTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
Log:
remove the chunk junk
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -22,21 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp;
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-import org.jboss.portal.portlet.test.jsp.response.BytesChunk;
-import org.jboss.portal.portlet.test.jsp.response.CharsChunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.StartPortletChunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.PortletMarkupChunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.StartPortletTitleChunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.PortletURLChunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.EndPortletChunk;
import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
-import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.controller.PortletController;
@@ -46,10 +35,7 @@
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.ResourceResponse;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -63,9 +49,6 @@
import javax.servlet.ServletContext;
import java.io.IOException;
import java.io.Writer;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -228,20 +211,6 @@
//
chain.doFilter(req, bufferingResponse);
-
- //
- ResponseBuffer buffer = bufferingResponse.getBuffer();
- buffer.close();
-
- //
- try
- {
- render(req, bufferingResponse);
- }
- catch (ClassNotFoundException e)
- {
- throw new ServletException(e);
- }
}
public void destroy()
@@ -253,7 +222,7 @@
{
//
- PagePortletControllerContext context = resp.getPortletControllerContext();
+// PagePortletControllerContext context = resp.getPortletControllerContext();
//
@@ -322,141 +291,5 @@
}
}
*/
-
- //
-// Map<String, PortletInvocationResponse> responses = page.render(context, pageState);
-
- //
- OutputStream out = resp.getResponse().getOutputStream();
- OutputStreamWriter writer = new OutputStreamWriter(out);
-
- //
- StartPortletChunk startPortletChunk = null;
- for (Chunk chunk : resp.getBuffer().getChunks())
- {
- if (chunk instanceof BytesChunk)
- {
- BytesChunk bytesChunk = (BytesChunk)chunk;
- out.write(bytesChunk.getBytes());
- out.flush();
- }
- else if (chunk instanceof CharsChunk)
- {
- CharsChunk bytesChunk = (CharsChunk)chunk;
- writer.write(bytesChunk.getChars());
- writer.flush();
- }
- else if (chunk instanceof StartPortletChunk)
- {
- startPortletChunk = (StartPortletChunk)chunk;
- }
- else if (chunk instanceof StartPortletTitleChunk)
- {
- PortletInvocationResponse portletResponse = startPortletChunk.getResponse();
- if (portletResponse != null)
- {
- if (portletResponse instanceof FragmentResponse)
- {
- FragmentResponse fragment = (FragmentResponse)portletResponse;
- writer.write(fragment.getTitle());
- writer.flush();
- }
- }
- }
- else if (chunk instanceof PortletURLChunk)
- {
- final PortletURLChunk portletURL = (PortletURLChunk)chunk;
- PortletInvocationResponse portletResponse = startPortletChunk.getResponse();
- if (portletResponse != null)
- {
- if (portletResponse instanceof FragmentResponse)
- {
- PortletURLRenderer renderer = new PortletURLRenderer(
- (StateControllerContextImpl)context.getStateControllerContext(),
- resp.getPageState(),
- context.getClientRequest(),
- context.getClientResponse());
-
- RenderURL url = new RenderURL()
- {
- public StateString getNavigationalState()
- {
- return null;
- }
-
- public Map<String, String[]> getPublicNavigationalStateChanges()
- {
- return portletURL.getParams();
- }
-
- public Mode getMode()
- {
- return portletURL.getMode();
- }
-
- public WindowState getWindowState()
- {
- return portletURL.getWindowState();
- }
- };
-
- //
- String renderedURL = renderer.renderURL(startPortletChunk.getWindowId(), url, null, null, true);
- writer.write(renderedURL);
- writer.flush();
- }
- }
- }
- else if (chunk instanceof PortletMarkupChunk)
- {
- PortletInvocationResponse portletResponse = startPortletChunk.getResponse();
- if (portletResponse != null)
- {
- if (portletResponse instanceof FragmentResponse)
- {
- FragmentResponse fragment = (FragmentResponse)portletResponse;
- WindowNavigationalState windowNS = null;
- if (resp.getPageState() != null)
- {
- windowNS = resp.getPageState().getWindowNavigationalState(startPortletChunk.getWindowId());
- }
- if (windowNS == null || !windowNS.getWindowState().equals(WindowState.MINIMIZED))
- {
- if (fragment.getType() != FragmentResponse.TYPE_EMPTY)
- {
- String frag;
- if (fragment.getType() == FragmentResponse.TYPE_BYTES)
- {
- frag = fragment.getBytes().toString();
- }
- else
- {
- frag = fragment.getChars().toString();
- }
-
- //
- writer.write(frag);
- writer.flush();
- }
- }
- }
- else
- {
- writer.write(portletResponse.getClass().getSimpleName() + "[" + startPortletChunk.getPortletName() + "," + startPortletChunk.getApplicationName() + "]");
- writer.flush();
- }
- }
- else
- {
- writer.write("Empty[" + startPortletChunk.getPortletName() + "," + startPortletChunk.getApplicationName() + "]");
- writer.flush();
- }
- }
- else if (chunk instanceof EndPortletChunk)
- {
- startPortletChunk = null;
- }
- }
- out.close();
}
}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/Page.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/Page.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/Page.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,101 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp;
-
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.StartPortletChunk;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class Page
-{
-
- /** . */
- private List<Chunk> chunks;
-
- /** . */
- private Map<StartPortletChunk, Window> windows;
-
- public Page(List<Chunk> chunks, Map<StartPortletChunk, Window> windows)
- {
- this.chunks = chunks;
- this.windows = windows;
- }
-
- public Collection<Chunk> getChunks()
- {
- return chunks;
- }
-
- public Window getWindow(Chunk chunk)
- {
- return windows.get(chunk);
- }
-
- public Window getWindow(String windowId)
- {
- for (Window window : windows.values())
- {
- if (window.getId().equals(windowId))
- {
- return window;
- }
- }
- return null;
- }
-
- public Collection<Window> getWindows()
- {
- return windows.values();
- }
-
- public Map<String, PortletInvocationResponse> render(PortletControllerContext context, PageNavigationalState pageState)
- {
- Map<String, PortletInvocationResponse> responses = new HashMap<String, PortletInvocationResponse>();
-
- //
- for (Window window : windows.values())
- {
- PortletInvocationResponse response = window.render(context, pageState);
-
- //
- if (response != null)
- {
- responses.put(window.getId(), response);
- }
- }
-
- //
- return responses;
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/Window.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/Window.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/Window.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,137 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp;
-
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.test.controller.TestInstanceContext;
-import org.jboss.portal.portlet.test.controller.TestPortalContext;
-import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
-import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
-import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
-import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
-import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.ParameterMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class Window
-{
-
- /** . */
- private final String id;
-
- /** . */
- private final Portlet portlet;
-
- public Window(String id, Portlet portlet)
- {
- this.id = id;
- this.portlet = portlet;
- }
-
- public String getId()
- {
- return id;
- }
-
- public Portlet getPortlet()
- {
- return portlet;
- }
-
- public PortletInvocationResponse render(
- PortletControllerContext context,
- PageNavigationalState pageState)
- {
- WindowNavigationalState windowNS = pageState.getWindowNavigationalState(id);
-
- //
- Mode mode = Mode.VIEW;
- WindowState windowState = WindowState.NORMAL;
- StateString portletNS = null;
-
- //
- if (windowNS != null)
- {
- if (windowNS.getMode() != null)
- {
- mode = windowNS.getMode();
- }
- if (windowNS.getWindowState() != null)
- {
- windowState = windowNS.getWindowState();
- }
- if (windowNS.getPortletNavigationalState() != null)
- {
- portletNS = windowNS.getPortletNavigationalState();
- }
- }
-
- //
- ParameterMap publicNS = pageState.getPublicNavigationalState(id);
-
- //
- PortletInvocationContext renderContext = context.createPortletInvocationContext(id, pageState);
- RenderInvocation render = new RenderInvocation(renderContext);
- render.setClientContext(new AbstractClientContext(context.getClientRequest()));
- render.setServerContext(new AbstractServerContext(context.getClientRequest(), context.getClientResponse()));
- render.setInstanceContext(new TestInstanceContext(context.getClientRequest(), portlet.getContext(), false));
- render.setUserContext(new AbstractUserContext(context.getClientRequest()));
- render.setWindowContext(new AbstractWindowContext(id));
- render.setPortalContext(new TestPortalContext());
- render.setSecurityContext(new AbstractSecurityContext(context.getClientRequest()));
- render.setTarget(portlet.getContext());
- render.setMode(mode);
- render.setWindowState(windowState);
- render.setNavigationalState(portletNS);
- render.setPublicNavigationalState(publicNS);
-
- //
- try
- {
- return ((PagePortletControllerContext)context).invoke(render);
-
- }
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
-
- // todo
-
- //
- return null;
- }
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -22,16 +22,13 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.response;
-import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.WindowState;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
-import javax.servlet.ServletOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -41,7 +38,7 @@
{
/** . */
- private final ResponseBuffer buffer = new ResponseBuffer();
+// private final ResponseBuffer buffer = new ResponseBuffer();
/** . */
private final PagePortletControllerContext portletControllerContext;
@@ -64,36 +61,83 @@
this.pageState = pageState;
}
+ /**
+ * The page state for the rendering.
+ *
+ * @return the page state
+ */
public PageNavigationalState getPageState()
{
return pageState;
}
- public PagePortletControllerContext getPortletControllerContext()
+ public String getMaximizedWindowId()
{
- return portletControllerContext;
- }
+ if (pageState != null)
+ {
+ for (String windowId : pageState.getWindowIds())
+ {
+ WindowNavigationalState windowNS = pageState.getWindowNavigationalState(windowId);
+ if (WindowState.MAXIMIZED.equals(windowNS.getWindowState()))
+ {
+ return windowId;
+ }
+ }
+ }
- public ResponseBuffer getBuffer()
- {
- return buffer;
+ //
+ return null;
}
- public ServletOutputStream getOutputStream() throws IOException
+ public boolean isRenderable(String windowId)
{
- return buffer.getOutputStream();
- }
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
- public PrintWriter getWriter() throws IOException
- {
- return buffer.getWriter();
+ //
+ if (pageState == null)
+ {
+ return false;
+ }
+
+ //
+ String maximizedWindowId = getMaximizedWindowId();
+ if (maximizedWindowId != null)
+ {
+ return maximizedWindowId.equals(windowId);
+ }
+
+ //
+ return true;
}
- public void close()
+ public PagePortletControllerContext getPortletControllerContext()
{
- buffer.close();
+ return portletControllerContext;
}
+// public ResponseBuffer getBuffer()
+// {
+// return buffer;
+// }
+//
+// public ServletOutputStream getOutputStream() throws IOException
+// {
+// return buffer.getOutputStream();
+// }
+//
+// public PrintWriter getWriter() throws IOException
+// {
+// return buffer.getWriter();
+// }
+//
+// public void close()
+// {
+// buffer.close();
+// }
+
public String nextId()
{
return "" + count++;
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,44 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class BytesChunk extends Chunk
-{
-
- /** . */
- private final byte[] bytes;
-
- public BytesChunk(byte[] bytes)
- {
- this.bytes = bytes;
- }
-
- public byte[] getBytes()
- {
- return bytes;
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,44 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class CharsChunk extends Chunk
-{
-
- /** . */
- private final char[] chars;
-
- public CharsChunk(char[] chars)
- {
- this.chars = chars;
- }
-
- public char[] getChars()
- {
- return chars;
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,34 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class Chunk
-{
-
-
-
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/EndPageChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/EndPageChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/EndPageChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,33 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response;
-
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class EndPageChunk extends Chunk
-{
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,216 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response;
-
-import javax.servlet.ServletOutputStream;
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-import java.io.StringWriter;
-import java.io.PrintWriter;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ResponseBuffer
-{
-
- /** . */
- private final List<Chunk> chunks = new LinkedList<Chunk>();
-
- /** . */
- private ChunkOutputStream chunkOutputStream;
-
- /** . */
- private ChunkWriter chunkWriter;
-
- /** . */
- private PrintWriter writer;
-
- /** . */
- private boolean muted;
-
- public boolean isMuted()
- {
- return muted;
- }
-
- public void setMuted(boolean muted)
- {
- this.muted = muted;
- }
-
- public List<Chunk> getChunks()
- {
- return chunks;
- }
-
- public void flush()
- {
- if (chunkWriter != null)
- {
- chunkWriter.writeChunk();
- }
- else if (chunkOutputStream != null)
- {
- chunkOutputStream.writeChunk();
- }
- }
-
- public void close()
- {
- try
- {
- if (chunkWriter != null)
- {
- chunkWriter.close();
- }
- else if (chunkOutputStream != null)
- {
- chunkOutputStream.close();
- }
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
-
- public ServletOutputStream getOutputStream()
- {
- if (chunkOutputStream == null)
- {
- if (writer != null)
- {
- throw new IllegalStateException();
- }
-
- //
- chunkOutputStream = new ChunkOutputStream();
- }
-
- //
- return chunkOutputStream;
- }
-
- public PrintWriter getWriter()
- {
- if (chunkWriter == null)
- {
- if (chunkOutputStream != null)
- {
- throw new IllegalStateException();
- }
-
- //
- chunkWriter = new ChunkWriter();
- writer = new PrintWriter(chunkWriter);
- }
-
- //
- return writer;
- }
-
- public void addChunk(Chunk chunk)
- {
- if (chunkWriter != null)
- {
- chunkWriter.writeChunk();
- }
- else if (chunkOutputStream != null)
- {
- chunkOutputStream.writeChunk();
- }
-
- //
- chunks.add(chunk);
- }
-
- private class ChunkWriter extends StringWriter
- {
-
- public void writeChunk()
- {
- StringBuffer sb = getBuffer();
- if (sb.length() > 0)
- {
- if (!muted)
- {
- char[] chars = new char[sb.length()];
- sb.getChars(0, sb.length(), chars, 0);
- CharsChunk chunk = new CharsChunk(chars);
- chunks.add(chunk);
- }
-
- //
- sb.setLength(0);
- }
- }
-
- public void close() throws IOException
- {
- super.close();
-
- //
- writeChunk();
- }
- }
-
- private class ChunkOutputStream extends ServletOutputStream
- {
-
- /** . */
- private final ByteArrayOutputStream bytebuffer = new ByteArrayOutputStream();
-
- public void write(int b) throws IOException
- {
- bytebuffer.write(b);
- }
-
- public void writeChunk()
- {
- if (bytebuffer.size() > 0 && !muted)
- {
- if (!muted)
- {
- byte[] bytes = bytebuffer.toByteArray();
- BytesChunk chunk = new BytesChunk(bytes);
- chunks.add(chunk);
- }
-
- //
- bytebuffer.reset();
- }
- }
-
- public void close() throws IOException
- {
- super.close();
-
- //
- writeChunk();
- }
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/StartPageChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/StartPageChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/StartPageChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,33 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response;
-
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StartPageChunk extends Chunk
-{
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/EndPortletChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/EndPortletChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/EndPortletChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,33 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response.portlet;
-
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class EndPortletChunk extends Chunk
-{
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/PortletMarkupChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/PortletMarkupChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/PortletMarkupChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,33 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response.portlet;
-
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletMarkupChunk extends Chunk
-{
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/PortletURLChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/PortletURLChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/PortletURLChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,68 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response.portlet;
-
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletURLChunk extends Chunk
-{
-
- /** . */
- private final Mode mode;
-
- /** . */
- private final WindowState windowState;
-
- /** . */
- private final Map<String, String[]> params;
-
- public PortletURLChunk(Mode mode, WindowState windowState, Map<String, String[]> params)
- {
- this.mode = mode;
- this.windowState = windowState;
- this.params = params;
- }
-
- public Mode getMode()
- {
- return mode;
- }
-
- public WindowState getWindowState()
- {
- return windowState;
- }
-
- public Map<String, String[]> getParams()
- {
- return params;
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -24,7 +24,6 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import java.util.Set;
@@ -33,7 +32,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class StartPortletChunk extends Chunk
+public class StartPortletChunk
{
/** . */
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletTitleChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletTitleChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletTitleChunk.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,33 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.response.portlet;
-
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class StartPortletTitleChunk extends Chunk
-{
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/AbstractURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/AbstractURLTag.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/AbstractURLTag.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
import java.util.Map;
import java.util.HashMap;
@@ -30,22 +31,17 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class AbstractURLTag extends BodyChunkTagSupport
+public class AbstractURLTag extends BodyTagSupport
{
/** . */
- private Map<String, String[]> params = new HashMap<String, String[]>();
+ protected Map<String, String[]> params = new HashMap<String, String[]>();
public void setParam(String name, String value)
{
params.put(name, new String[]{value});
}
- public Map<String, String[]> getParams()
- {
- return new HashMap<String, String[]>(params);
- }
-
public void doInitBody() throws JspException
{
params.clear();
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/BodyChunkTagSupport.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/BodyChunkTagSupport.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/BodyChunkTagSupport.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,75 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.taglib;
-
-import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
-
-import javax.servlet.jsp.tagext.BodyTagSupport;
-import javax.servlet.jsp.JspException;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class BodyChunkTagSupport extends BodyTagSupport
-{
-
- protected final ResponseBuffer getBuffer()
- {
- BufferingResponse response = (BufferingResponse)pageContext.getResponse();
- return response.getBuffer();
- }
-
- protected void mute(boolean on) throws JspException
- {
- try
- {
- pageContext.getOut().flush();
- BufferingResponse response = (BufferingResponse)pageContext.getResponse();
- ResponseBuffer buffer = response.getBuffer();
- buffer.flush();
- buffer.setMuted(on);
- }
- catch (IOException e)
- {
- throw new JspException(e);
- }
- }
-
- protected final void addChunk(Chunk chunk) throws JspException
- {
- try
- {
- pageContext.getOut().flush();
- BufferingResponse response = (BufferingResponse)pageContext.getResponse();
- response.getBuffer().addChunk(chunk);
- }
- catch (IOException e)
- {
- throw new JspException(e);
- }
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -22,30 +22,24 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.taglib;
-import org.jboss.portal.portlet.test.jsp.response.StartPageChunk;
-import org.jboss.portal.portlet.test.jsp.response.EndPageChunk;
-
import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PageTag extends BodyChunkTagSupport
+public class PageTag extends BodyTagSupport
{
public int doStartTag() throws JspException
{
- addChunk(new StartPageChunk());
-
//
return EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspException
{
- addChunk(new EndPageChunk());
-
//
return EVAL_PAGE;
}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.taglib;
+
+import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.PageContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalSimpleTagSupport extends SimpleTagSupport
+{
+ protected final BufferingResponse getPortalResponse()
+ {
+ PageContext pageContext = (PageContext)getJspContext();
+ return (BufferingResponse)pageContext.getResponse();
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -22,17 +22,72 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.taglib;
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.PortletMarkupChunk;
+import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.WindowState;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import java.io.IOException;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PortletMarkupTag extends SimpleChunkTagSupport
+public class PortletMarkupTag extends PortalSimpleTagSupport
{
- protected Chunk doChunkTag()
+ public void doTag() throws JspException, IOException
{
- return new PortletMarkupChunk();
+
+ BufferingResponse resp = getPortalResponse();
+
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
+
+ PortletInvocationResponse portletResp = portletTag.chunk.getResponse();
+
+ JspWriter out = getJspContext().getOut();
+
+ if (portletResp != null)
+ {
+ if (portletResp instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)portletResp;
+ WindowNavigationalState windowNS = null;
+ if (resp.getPageState() != null)
+ {
+ windowNS = resp.getPageState().getWindowNavigationalState(portletTag.chunk.getWindowId());
+ }
+ if (windowNS == null || !windowNS.getWindowState().equals(WindowState.MINIMIZED))
+ {
+ if (fragment.getType() != FragmentResponse.TYPE_EMPTY)
+ {
+ String frag;
+ if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ {
+ frag = fragment.getBytes().toString();
+ }
+ else
+ {
+ frag = fragment.getChars().toString();
+ }
+
+ out.write(frag);
+ }
+ }
+ }
+ else
+ {
+ out.write(portletResp.getClass().getSimpleName() + "[" + portletTag.chunk.getPortletName() + "," + portletTag.chunk.getApplicationName() + "]");
+ out.flush();
+ }
+ }
+ else
+ {
+ out.write("Empty[" + portletTag.chunk.getPortletName() + "," + portletTag.chunk.getApplicationName() + "]");
+ out.flush();
+ }
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.response.portlet.StartPortletChunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.EndPortletChunk;
import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
import org.jboss.portal.portlet.test.controller.TestInstanceContext;
@@ -47,7 +46,7 @@
import org.jboss.portal.common.util.ParameterMap;
import javax.servlet.jsp.JspException;
-import java.io.IOException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.Collections;
@@ -56,7 +55,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PortletTag extends BodyChunkTagSupport
+public class PortletTag extends BodyTagSupport
{
/** . */
@@ -130,35 +129,21 @@
this.initialModeValue = initialMode;
}
+ StartPortletChunk chunk;
+
public int doStartTag() throws JspException
{
-
- //
BufferingResponse response = (BufferingResponse)pageContext.getResponse();
- StartPortletChunk chunk = render(response);
-
+
//
- try
- {
- pageContext.getOut().flush();
- }
- catch (IOException e)
- {
- throw new JspException(e);
- }
+ chunk = render(response);
//
- addChunk(chunk);
-
- //
return EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspException
{
- addChunk(new EndPortletChunk());
-
- //
return EVAL_PAGE;
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -22,17 +22,34 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.taglib;
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.StartPortletTitleChunk;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import java.io.IOException;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PortletTitleTag extends SimpleChunkTagSupport
+public class PortletTitleTag extends PortalSimpleTagSupport
{
- protected Chunk doChunkTag()
+
+ public void doTag() throws JspException, IOException
{
- return new StartPortletTitleChunk();
+
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
+
+ PortletInvocationResponse portletResp = portletTag.chunk.getResponse();
+
+ JspWriter out = getJspContext().getOut();
+
+ if (portletResp instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)portletResp;
+ out.write(fragment.getTitle());
+ }
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -24,9 +24,19 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.test.jsp.response.portlet.PortletURLChunk;
+import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
+import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.StateString;
import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import java.util.Map;
+import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -63,20 +73,24 @@
public int doStartTag() throws JspException
{
- mute(true);
-
- //
return EVAL_BODY_BUFFERED;
}
public int doEndTag() throws JspException
{
+ BufferingResponse response = (BufferingResponse)pageContext.getResponse();
+ PagePortletControllerContext context = response.getPortletControllerContext();
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
+
Mode mode = null;
if (modeValue != null)
{
mode = Mode.create(modeValue.trim());
}
+ PortletInvocationResponse portletResp = portletTag.chunk.getResponse();
+
+
//
WindowState windowState = null;
if (windowStateValue != null)
@@ -84,13 +98,53 @@
windowState = WindowState.create(windowStateValue.trim());
}
- //
- addChunk(new PortletURLChunk(mode, windowState, getParams()));
+ PortletURLRenderer renderer = new PortletURLRenderer(
+ (StateControllerContextImpl)context.getStateControllerContext(),
+ response.getPageState(),
+ context.getClientRequest(),
+ context.getClientResponse());
- //
- mute(false);
+ final WindowState ws = windowState;
+ final Mode md = mode;
+ RenderURL url = new RenderURL()
+ {
+
+
+ public StateString getNavigationalState()
+ {
+ return null;
+ }
+
+ public Map<String, String[]> getPublicNavigationalStateChanges()
+ {
+ return params;
+ }
+
+ public Mode getMode()
+ {
+ return md;
+ }
+
+ public WindowState getWindowState()
+ {
+ return ws;
+ }
+ };
+
+ try
+ {
+ JspWriter out = pageContext.getOut();
+ String renderedURL = renderer.renderURL(portletTag.chunk.getWindowId(), url, null, null, true);
+ out.write(renderedURL);
+ }
+ catch (IOException e)
+ {
+ throw new JspException(e);
+ }
+
//
return EVAL_PAGE;
}
+
}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/SimpleChunkTagSupport.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/SimpleChunkTagSupport.java 2008-02-07 22:34:26 UTC (rev 9841)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/SimpleChunkTagSupport.java 2008-02-07 23:34:46 UTC (rev 9842)
@@ -1,56 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.test.jsp.taglib;
-
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
-
-import javax.servlet.jsp.tagext.SimpleTagSupport;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.PageContext;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class SimpleChunkTagSupport extends SimpleTagSupport
-{
-
- public final void doTag() throws JspException, IOException
- {
- Chunk chunk = doChunkTag();
-
- //
- if (chunk != null)
- {
- PageContext pageCtx = (PageContext)getJspContext();
- pageCtx.getOut().flush();
- BufferingResponse response = (BufferingResponse)pageCtx.getResponse();
- response.getBuffer().addChunk(chunk);
- }
- }
-
- protected abstract Chunk doChunkTag();
-
-}
16 years, 4 months
JBoss Portal SVN: r9841 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test: jsp and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-07 17:34:26 -0500 (Thu, 07 Feb 2008)
New Revision: 9841
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
Log:
more streaming
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-07 21:33:34 UTC (rev 9840)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-07 22:34:26 UTC (rev 9841)
@@ -112,7 +112,7 @@
HttpServletRequest req,
HttpServletResponse resp,
ServletContext servletContext)
- throws IllegalRequestException, IOException, ClassNotFoundException
+ throws IllegalRequestException, IOException
{
StateControllerContextImpl tmp = new StateControllerContextImpl(this);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-07 21:33:34 UTC (rev 9840)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-07 22:34:26 UTC (rev 9841)
@@ -121,7 +121,15 @@
}
//
- Map<String, String> parameters = Collections.singletonMap(PAGE_STATE, pageState);
+ Map<String, String> parameters;
+ if (pageState != null)
+ {
+ parameters = Collections.singletonMap(PAGE_STATE, pageState);
+ }
+ else
+ {
+ parameters = Collections.emptyMap();
+ }
//
return renderURL(parameters, wantSecure, wantAuthenticated, relative);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-07 21:33:34 UTC (rev 9840)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-07 22:34:26 UTC (rev 9841)
@@ -32,8 +32,6 @@
import org.jboss.portal.portlet.test.jsp.response.portlet.EndPortletChunk;
import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
-import org.jboss.portal.portlet.test.jsp.response.StartPageChunk;
-import org.jboss.portal.portlet.test.jsp.response.EndPageChunk;
import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -68,10 +66,6 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.Map;
-import java.util.Iterator;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -100,44 +94,23 @@
public void doFilter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException
{
- BufferingResponse bufferingResponse = new BufferingResponse(resp);
+ PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
//
- chain.doFilter(req, bufferingResponse);
-
- //
- ResponseBuffer buffer = bufferingResponse.getBuffer();
- buffer.close();
-
- //
+ PagePortletControllerContext context;
try
{
- service(req, resp, buffer);
+ context = new PagePortletControllerContext(
+ req,
+ resp,
+ getServletContext(),
+ invoker);
}
- catch (ClassNotFoundException e)
+ catch (PortletInvokerException e)
{
throw new ServletException(e);
}
- }
- public void destroy()
- {
- this.config = null;
- }
-
- protected void service(HttpServletRequest req, HttpServletResponse resp, ResponseBuffer buffer) throws ServletException, IOException, ClassNotFoundException
- {
- PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
-
- //
- PagePortletControllerContext context = new PagePortletControllerContext(
- req,
- resp,
- getServletContext(),
- invoker,
- buffer);
-
- //
PageNavigationalState pageState = null;
if (context.getRequest() != null)
{
@@ -162,7 +135,7 @@
//
PortletURLRenderer renderer = new PortletURLRenderer(
(StateControllerContextImpl)context.getStateControllerContext(),
- pageState,
+ pageUpdate.getPageState(),
context.getClientRequest(),
context.getClientResponse());
@@ -189,7 +162,7 @@
if (pir instanceof FragmentResponse)
{
FragmentResponse fragment = (FragmentResponse)pir;
-
+
//
if (fragment.getType() == FragmentResponse.TYPE_EMPTY)
{
@@ -236,6 +209,9 @@
{
// todo
}
+
+ //
+ return;
}
else
{
@@ -248,13 +224,41 @@
}
//
- Page page = context.getPage();
- if (pageState == null)
+ BufferingResponse bufferingResponse = new BufferingResponse(resp, context, pageState);
+
+ //
+ chain.doFilter(req, bufferingResponse);
+
+ //
+ ResponseBuffer buffer = bufferingResponse.getBuffer();
+ buffer.close();
+
+ //
+ try
{
- pageState = context.getStateControllerContext().createPageState(false);
+ render(req, bufferingResponse);
}
+ catch (ClassNotFoundException e)
+ {
+ throw new ServletException(e);
+ }
+ }
+ public void destroy()
+ {
+ this.config = null;
+ }
+
+ protected void render(HttpServletRequest req, BufferingResponse resp) throws ServletException, IOException, ClassNotFoundException
+ {
+
+ //
+ PagePortletControllerContext context = resp.getPortletControllerContext();
+
+ //
+
// Look if we need to handle maxmized rendering
+/*
for (Window window : page.getWindows())
{
WindowNavigationalState windowState = pageState.getWindowNavigationalState(window.getId());
@@ -317,19 +321,18 @@
page = new Page(chunks, windows);
}
}
+*/
//
- Map<String, PortletInvocationResponse> responses = page.render(context, pageState);
+// Map<String, PortletInvocationResponse> responses = page.render(context, pageState);
//
- OutputStream out = resp.getOutputStream();
+ OutputStream out = resp.getResponse().getOutputStream();
OutputStreamWriter writer = new OutputStreamWriter(out);
//
- String windowId = null;
StartPortletChunk startPortletChunk = null;
- PortletInvocationResponse portletResponse = null;
- for (Chunk chunk : page.getChunks())
+ for (Chunk chunk : resp.getBuffer().getChunks())
{
if (chunk instanceof BytesChunk)
{
@@ -346,12 +349,10 @@
else if (chunk instanceof StartPortletChunk)
{
startPortletChunk = (StartPortletChunk)chunk;
- Window window = page.getWindow(startPortletChunk);
- windowId = window.getId();
- portletResponse = responses.get(windowId);
}
else if (chunk instanceof StartPortletTitleChunk)
{
+ PortletInvocationResponse portletResponse = startPortletChunk.getResponse();
if (portletResponse != null)
{
if (portletResponse instanceof FragmentResponse)
@@ -365,13 +366,14 @@
else if (chunk instanceof PortletURLChunk)
{
final PortletURLChunk portletURL = (PortletURLChunk)chunk;
+ PortletInvocationResponse portletResponse = startPortletChunk.getResponse();
if (portletResponse != null)
{
if (portletResponse instanceof FragmentResponse)
{
PortletURLRenderer renderer = new PortletURLRenderer(
(StateControllerContextImpl)context.getStateControllerContext(),
- pageState,
+ resp.getPageState(),
context.getClientRequest(),
context.getClientResponse());
@@ -399,7 +401,7 @@
};
//
- String renderedURL = renderer.renderURL(windowId, url, null, null, true);
+ String renderedURL = renderer.renderURL(startPortletChunk.getWindowId(), url, null, null, true);
writer.write(renderedURL);
writer.flush();
}
@@ -407,12 +409,17 @@
}
else if (chunk instanceof PortletMarkupChunk)
{
+ PortletInvocationResponse portletResponse = startPortletChunk.getResponse();
if (portletResponse != null)
{
if (portletResponse instanceof FragmentResponse)
{
FragmentResponse fragment = (FragmentResponse)portletResponse;
- WindowNavigationalState windowNS = pageState.getWindowNavigationalState(windowId);
+ WindowNavigationalState windowNS = null;
+ if (resp.getPageState() != null)
+ {
+ windowNS = resp.getPageState().getWindowNavigationalState(startPortletChunk.getWindowId());
+ }
if (windowNS == null || !windowNS.getWindowState().equals(WindowState.MINIMIZED))
{
if (fragment.getType() != FragmentResponse.TYPE_EMPTY)
@@ -447,9 +454,7 @@
}
else if (chunk instanceof EndPortletChunk)
{
- windowId = null;
startPortletChunk = null;
- portletResponse = null;
}
}
out.close();
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-07 21:33:34 UTC (rev 9840)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-07 22:34:26 UTC (rev 9841)
@@ -23,12 +23,10 @@
package org.jboss.portal.portlet.test.jsp;
import org.jboss.portal.portlet.test.controller.AbstractPortletControllerContext;
-import org.jboss.portal.portlet.test.jsp.response.Chunk;
-import org.jboss.portal.portlet.test.jsp.response.portlet.StartPortletChunk;
-import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.impl.event.EventControllerContextImpl;
@@ -43,7 +41,6 @@
import java.io.IOException;
import java.util.Map;
import java.util.HashMap;
-import java.util.LinkedHashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -51,9 +48,6 @@
*/
public class PagePortletControllerContext extends AbstractPortletControllerContext
{
-
- /** . */
- private final Page page;
/** . */
private final PortletInvoker invoker;
@@ -61,70 +55,49 @@
/** . */
private final EventControllerContext eventControllerContext;
+ /** . */
+ private final Map<Key, Portlet> portlets;
+
public PagePortletControllerContext(
HttpServletRequest req,
HttpServletResponse resp,
ServletContext servletContext,
- PortletInvoker invoker,
- ResponseBuffer buffer)
- throws IllegalRequestException, IOException, ClassNotFoundException, ServletException
+ PortletInvoker invoker)
+ throws IllegalRequestException, IOException, ServletException, PortletInvokerException
{
super(req, resp, servletContext);
- // Collect portlets to create the page
- int counter = 0;
- Map<StartPortletChunk, Window> windows = new LinkedHashMap<StartPortletChunk, Window>();
- for (Chunk chunk : buffer.getChunks())
+ //
+ Map<Key, Portlet> portlets = new HashMap<Key, Portlet>();
+ for (Portlet portlet : invoker.getPortlets())
{
- if (chunk instanceof StartPortletChunk)
- {
- StartPortletChunk startPortletChunk = (StartPortletChunk)chunk;
- String windowId = "" + counter++;
-
- //
- try
- {
- for (Portlet portlet : invoker.getPortlets())
- {
- PortletInfo portletInfo = portlet.getInfo();
- String portletName = portletInfo.getName();
- String applicationName = portletInfo.getApplicationName();
-
- //
- if (applicationName.equals(startPortletChunk.getApplicationName()) && portletName.equals(startPortletChunk.getPortletName()))
- {
- windows.put(startPortletChunk, new Window(windowId, portlet));
- }
- }
- }
- catch (PortletInvokerException e)
- {
- throw new ServletException(e);
- }
- }
+ PortletInfo portletInfo = portlet.getInfo();
+ String portletName = portletInfo.getName();
+ String applicationName = portletInfo.getApplicationName();
+ Key key = new Key(applicationName, portletName);
+ portlets.put(key, portlet);
}
//
-
-
- //
- this.page = new Page(buffer.getChunks(), windows);
+ this.portlets = portlets;
this.invoker = invoker;
this.eventControllerContext = new EventControllerContextImpl(invoker);
}
- public Page getPage()
+ public Portlet findPortlet(String applicationName, String portletName)
{
- return page;
+ return portlets.get(new Key(applicationName, portletName));
}
protected Portlet getPortlet(String windowId) throws PortletInvokerException
{
- Window window = page.getWindow(windowId);
- return window.getPortlet();
+ int index = windowId.lastIndexOf('.');
+ String portletId = windowId.substring(0, index);
+ PortletContext portletContext = PortletContext.createPortletContext(portletId);
+ return invoker.getPortlet(portletContext);
}
- protected PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
{
return invoker.invoke(invocation);
}
@@ -133,4 +106,40 @@
{
return eventControllerContext;
}
+
+ private static class Key
+ {
+
+ /** . */
+ private final String applicationName;
+
+ /** . */
+ private final String portletName;
+
+ private Key(String applicationName, String portletName)
+ {
+ this.applicationName = applicationName;
+ this.portletName = portletName;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof Key)
+ {
+ Key that = (Key)obj;
+ return applicationName.equals(that.applicationName) && portletName.equals(that.portletName);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return applicationName.hashCode() + portletName.hashCode();
+ }
+ }
+
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java 2008-02-07 21:33:34 UTC (rev 9840)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java 2008-02-07 22:34:26 UTC (rev 9841)
@@ -24,6 +24,8 @@
import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
import org.jboss.portal.portlet.test.jsp.response.Chunk;
+import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -41,11 +43,37 @@
/** . */
private final ResponseBuffer buffer = new ResponseBuffer();
- public BufferingResponse(HttpServletResponse response)
+ /** . */
+ private final PagePortletControllerContext portletControllerContext;
+
+ /** . */
+ private final PageNavigationalState pageState;
+
+ /** . */
+ private int count = 0;
+
+ public BufferingResponse(
+ HttpServletResponse response,
+ PagePortletControllerContext portletControllerContext,
+ PageNavigationalState pageState)
{
super(response);
+
+ //
+ this.portletControllerContext = portletControllerContext;
+ this.pageState = pageState;
}
+ public PageNavigationalState getPageState()
+ {
+ return pageState;
+ }
+
+ public PagePortletControllerContext getPortletControllerContext()
+ {
+ return portletControllerContext;
+ }
+
public ResponseBuffer getBuffer()
{
return buffer;
@@ -65,4 +93,9 @@
{
buffer.close();
}
+
+ public String nextId()
+ {
+ return "" + count++;
+ }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java 2008-02-07 21:33:34 UTC (rev 9840)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/portlet/StartPortletChunk.java 2008-02-07 22:34:26 UTC (rev 9841)
@@ -25,6 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.test.jsp.response.Chunk;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import java.util.Set;
@@ -42,6 +43,12 @@
private final String applicationName;
/** . */
+ private final String windowId;
+
+ /** . */
+ private final PortletInvocationResponse response;
+
+ /** . */
private final Mode initialMode;
/** . */
@@ -50,10 +57,19 @@
/** . */
private final Set<WindowState> supportedWindowStates;
- public StartPortletChunk(String portletName, String applicationName, Mode initialMode, Set<Mode> supportedModes, Set<WindowState> supportedWindowStates)
+ public StartPortletChunk(
+ String portletName,
+ String applicationName,
+ String windowId,
+ PortletInvocationResponse response,
+ Mode initialMode,
+ Set<Mode> supportedModes,
+ Set<WindowState> supportedWindowStates)
{
this.portletName = portletName;
this.applicationName = applicationName;
+ this.windowId = windowId;
+ this.response = response;
this.initialMode = initialMode;
this.supportedModes = supportedModes;
this.supportedWindowStates = supportedWindowStates;
@@ -69,6 +85,16 @@
return applicationName;
}
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
+ public PortletInvocationResponse getResponse()
+ {
+ return response;
+ }
+
public Mode getInitialMode()
{
return initialMode;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-07 21:33:34 UTC (rev 9840)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-07 22:34:26 UTC (rev 9841)
@@ -24,9 +24,27 @@
import org.jboss.portal.portlet.test.jsp.response.portlet.StartPortletChunk;
import org.jboss.portal.portlet.test.jsp.response.portlet.EndPortletChunk;
+import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
+import org.jboss.portal.portlet.test.controller.TestInstanceContext;
+import org.jboss.portal.portlet.test.controller.TestPortalContext;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
+import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
+import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
+import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
+import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.ParameterMap;
import javax.servlet.jsp.JspException;
import java.io.IOException;
@@ -114,6 +132,38 @@
public int doStartTag() throws JspException
{
+
+ //
+ BufferingResponse response = (BufferingResponse)pageContext.getResponse();
+ StartPortletChunk chunk = render(response);
+
+ //
+ try
+ {
+ pageContext.getOut().flush();
+ }
+ catch (IOException e)
+ {
+ throw new JspException(e);
+ }
+
+ //
+ addChunk(chunk);
+
+ //
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException
+ {
+ addChunk(new EndPortletChunk());
+
+ //
+ return EVAL_PAGE;
+ }
+
+ public StartPortletChunk render(BufferingResponse response)
+ {
Set<Mode> supportedModes = new LinkedHashSet<Mode>();
if (supportedModeValues != null)
{
@@ -151,32 +201,91 @@
}
//
+ PagePortletControllerContext context = response.getPortletControllerContext();
+
+ //
+ Portlet portlet = context.findPortlet(applicationName, name);
+
+ //
+ String windowId = portlet.getContext().getId() + "." + response.nextId();
+ PageNavigationalState pageNS = response.getPageState();
+
+ //
+ WindowNavigationalState windowNS = null;
+ if (pageNS != null)
+ {
+ windowNS = pageNS.getWindowNavigationalState(windowId);
+ }
+
+ //
+ ParameterMap publicNS = null;
+ if (pageNS != null)
+ {
+ publicNS = pageNS.getPublicNavigationalState(windowId);
+ }
+
+ //
+ Mode mode = Mode.VIEW;
+ WindowState windowState = WindowState.NORMAL;
+ StateString portletNS = null;
+
+ //
+ if (windowNS != null)
+ {
+ if (windowNS.getMode() != null)
+ {
+ mode = windowNS.getMode();
+ }
+ if (windowNS.getWindowState() != null)
+ {
+ windowState = windowNS.getWindowState();
+ }
+ if (windowNS.getPortletNavigationalState() != null)
+ {
+ portletNS = windowNS.getPortletNavigationalState();
+ }
+ }
+
+
+ //
+ PortletInvocationContext renderContext = context.createPortletInvocationContext(windowId, pageNS);
+ RenderInvocation render = new RenderInvocation(renderContext);
+ render.setClientContext(new AbstractClientContext(context.getClientRequest()));
+ render.setServerContext(new AbstractServerContext(context.getClientRequest(), context.getClientResponse()));
+ render.setInstanceContext(new TestInstanceContext(context.getClientRequest(), portlet.getContext(), false));
+ render.setUserContext(new AbstractUserContext(context.getClientRequest()));
+ render.setWindowContext(new AbstractWindowContext(windowId));
+ render.setPortalContext(new TestPortalContext());
+ render.setSecurityContext(new AbstractSecurityContext(context.getClientRequest()));
+ render.setTarget(portlet.getContext());
+ render.setMode(mode);
+ render.setWindowState(windowState);
+ render.setNavigationalState(portletNS);
+ render.setPublicNavigationalState(publicNS);
+
+ //
+ PortletInvocationResponse portletResponse = null;
try
{
- pageContext.getOut().flush();
+ portletResponse = context.invoke(render);
+
+
}
- catch (IOException e)
+ catch (PortletInvokerException e)
{
- throw new JspException(e);
+ e.printStackTrace();
+
+ // todo
}
//
- addChunk(new StartPortletChunk(
+ return new StartPortletChunk(
name,
applicationName,
+ windowId,
+ portletResponse,
initialMode,
supportedModes,
- supportedWindowStates));
-
- //
- return EVAL_BODY_INCLUDE;
+ supportedWindowStates);
}
-
- public int doEndTag() throws JspException
- {
- addChunk(new EndPortletChunk());
-
- //
- return EVAL_PAGE;
- }
}
16 years, 5 months
JBoss Portal SVN: r9840 - modules/portlet/trunk/test/src/test/resources/simple-portal-war.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-02-07 16:33:34 -0500 (Thu, 07 Feb 2008)
New Revision: 9840
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
Log:
- Prepare markup for styling.
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-07 19:11:18 UTC (rev 9839)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-07 21:33:34 UTC (rev 9840)
@@ -4,41 +4,58 @@
<html>
<body>
<portal:page>
-****************************************************<br/>
- <portal:portlet
- name="GoogleWeather"
- applicationName="google-weather-portlet">
------------------------------------<br/>
-<portal:portlettitle/><br/>
-<a href="<portal:portleturl windowState='maximized'/>">Maximized<a/><br/>
-<a href="<portal:portleturl windowState='normal'/>">Normal<a/><br/>
-<a href="<portal:portleturl windowState='minimized'/>">Minimized<a/><br/>
-<a href="<portal:portleturl><portal:param name='zipcode' value='20855'/></portal:portleturl>">Derwood<a/><br/>
------------------------------------<br/>
- <portal:portletmarkup/>
------------------------------------<br/>
+ <portal:portlet name="GoogleWeather" applicationName="google-weather-portlet">
+ <div class="portlet">
+ <div class="titlebar">
+ <div class="title"><portal:portlettitle/></div>
+ <ul class="actions">
+ <li><a title="Maximize" href="<portal:portleturl windowState='maximized'/>">M</a></li>
+ <li><a title="Normal" href="<portal:portleturl windowState='normal'/>">n</a></li>
+ <li><a title="Minimize" href="<portal:portleturl windowState='minimized'/>">m</a></li>
+ <li><a title="Edit" href="<portal:portleturl mode='edit'/>">Edit</a></li>
+ </ul>
+ </div>
+ <div class="portletcontent">
+ <portal:portletmarkup/>
+ </div>
+ </div>
</portal:portlet>
-****************************************************<br/>
- <portal:portlet
- name="GoogleMap"
- applicationName="google-map-portlet">
------------------------------------<br/>
-<portal:portlettitle/><br/>
------------------------------------<br/>
- <portal:portletmarkup/>
------------------------------------<br/>
+
+
+ <portal:portlet name="GoogleMap" applicationName="google-map-portlet">
+ <div class="portlet">
+ <div class="titlebar">
+ <div class="title"><portal:portlettitle/></div>
+ <ul class="actions">
+ <li><a title="Maximize" href="<portal:portleturl windowState='maximized'/>">M</a></li>
+ <li><a title="Normal" href="<portal:portleturl windowState='normal'/>">n</a></li>
+ <li><a title="Minimize" href="<portal:portleturl windowState='minimized'/>">m</a></li>
+ <li><a title="Edit" href="<portal:portleturl mode='edit'/>">Edit</a></li>
+ </ul>
+ </div>
+ <div class="portletcontent">
+ <portal:portletmarkup/>
+ </div>
+ </div>
</portal:portlet>
-****************************************************<br/>
- <portal:portlet
- name="RemoteControl"
- applicationName="remotecontrol-portlet">
------------------------------------<br/>
-<portal:portlettitle/><br/>
------------------------------------<br/>
- <portal:portletmarkup/>
------------------------------------<br/>
+
+ <br/>
+ <portal:portlet name="RemoteControl" applicationName="remotecontrol-portlet">
+ <div class="portlet">
+ <div class="titlebar">
+ <div class="title"><portal:portlettitle/></div>
+ <ul class="actions">
+ <li><a title="Maximize" href="<portal:portleturl windowState='maximized'/>">M</a></li>
+ <li><a title="Normal" href="<portal:portleturl windowState='normal'/>">n</a></li>
+ <li><a title="Minimize" href="<portal:portleturl windowState='minimized'/>">m</a></li>
+ <li><a title="Edit" href="<portal:portleturl mode='edit'/>">Edit</a></li>
+ </ul>
+ </div>
+ <div class="portletcontent">
+ <portal:portletmarkup/>
+ </div>
+ </div>
</portal:portlet>
-****************************************************<br/>
</portal:page>
</body>
</html>
16 years, 5 months