JBoss Portal SVN: r9919 - 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-10 08:49:29 -0500 (Sun, 10 Feb 2008)
New Revision: 9919
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/WindowResult.java
Removed:
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/PortalRenderResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
Log:
rename
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-10 13:47:05 UTC (rev 9918)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-10 13:49:29 UTC (rev 9919)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.test.controller.TestInstanceContext;
import org.jboss.portal.portlet.test.controller.TestPortalContext;
-import org.jboss.portal.portlet.test.jsp.PortletResult;
+import org.jboss.portal.portlet.test.jsp.WindowResult;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -62,7 +62,7 @@
private PagePortletControllerContext portletControllerContext;
/** . */
- private Map<String, PortletResult> windowResults;
+ private Map<String, WindowResult> windowResults;
public PortalRenderResponse(
HttpServletResponse response,
@@ -93,7 +93,7 @@
//
this.portletControllerContext = portletControllerContext;
- this.windowResults = new HashMap<String, PortletResult>();
+ this.windowResults = new HashMap<String, WindowResult>();
this.pageState = pageState;
//
@@ -110,7 +110,7 @@
return pageState;
}
- public PortletResult getWindowResult(String windowId)
+ public WindowResult getWindowResult(String windowId)
{
return windowResults.get(windowId);
}
@@ -194,7 +194,7 @@
PortletInvocationResponse portletResponse = render(portlet, windowId);
//
- PortletResult result = new PortletResult(windowDef, portletResponse);
+ WindowResult result = new WindowResult(windowDef, portletResponse);
//
windowResults.put(windowId, result);
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/WindowResult.java (from rev 9918, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortletResult.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/WindowResult.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/WindowResult.java 2008-02-10 13:49:29 UTC (rev 9919)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.test.jsp.WindowDef;
+
+/**
+ * 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 $
+ */
+public class WindowResult
+{
+
+ /** . */
+ private final WindowDef windowDef;
+
+ /** . */
+ private final PortletInvocationResponse response;
+
+ public WindowResult(WindowDef windowDef, PortletInvocationResponse response)
+ {
+ this.windowDef = windowDef;
+ this.response = response;
+ }
+
+ public WindowDef getWindowDef()
+ {
+ return windowDef;
+ }
+
+ public PortletInvocationResponse getResponse()
+ {
+ return response;
+ }
+}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletResult.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletResult.java 2008-02-10 13:47:05 UTC (rev 9918)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletResult.java 2008-02-10 13:49:29 UTC (rev 9919)
@@ -1,114 +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.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-10 13:47:05 UTC (rev 9918)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-10 13:49:29 UTC (rev 9919)
@@ -26,7 +26,7 @@
import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.portlet.test.jsp.WindowDef;
-import org.jboss.portal.portlet.test.jsp.PortletResult;
+import org.jboss.portal.portlet.test.jsp.WindowResult;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
@@ -81,7 +81,7 @@
private PageTag pageTag;
private String windowId;
- PortletResult result;
+ WindowResult result;
public String getName()
{
@@ -229,7 +229,7 @@
initState(renderResponse);
//
- PortletResult result = renderResponse.getWindowResult(windowId);
+ WindowResult result = renderResponse.getWindowResult(windowId);
//
if (result == null || result.getResponse() == null)
@@ -273,7 +273,7 @@
return EVAL_PAGE;
}
- public int render(PortalRenderResponse renderResponse, PortletResult result, int rt)
+ public int render(PortalRenderResponse renderResponse, WindowResult result, int rt)
{
PortletInvocationResponse portletResponse = result.getResponse();
16 years, 5 months
JBoss Portal SVN: r9918 - in modules/portlet/trunk: test/src/main/java/org/jboss/portal/portlet/test/jsp and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-10 08:47:05 -0500 (Sun, 10 Feb 2008)
New Revision: 9918
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageParameterDef.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortletResult.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/WindowDef.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/state/PageNavigationalStateImpl.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/PageEventControllerContext.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/PortalPrepareResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
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/PageParamTag.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/PortletURLTag.java
Log:
make portlet rendering ahead of JSP rendering (between prepare and render phases of portal)
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/state/PageNavigationalStateImpl.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/state/PageNavigationalStateImpl.java 2008-02-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/state/PageNavigationalStateImpl.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -123,7 +123,8 @@
public String[] getPublicNavigationalState(QName name)
{
- return page.get(name).clone();
+ String[] values = page.get(name);
+ return values != null ? values.clone() : null;
}
public void setWindowNavigationalState(String windowId, WindowNavigationalState windowState)
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-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -88,13 +88,13 @@
PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
//
- PortalPrepareResponse prepareResponse = new PortalPrepareResponse(resp, invoker);
+ PortalPrepareResponse prepareResponse = new PortalPrepareResponse(resp);
// Discover existing portlets on the page (introspection phase)
chain.doFilter(req, prepareResponse);
// Now we can create a populated context
- PagePortletControllerContext context = new PagePortletControllerContext(req, resp, getServletContext(), prepareResponse);
+ PagePortletControllerContext context = new PagePortletControllerContext(req, resp, invoker, getServletContext(), prepareResponse);
//
PageNavigationalState pageState = null;
@@ -235,7 +235,7 @@
}
//
- PortalRenderResponse renderResponse = new PortalRenderResponse(resp, invoker, context, pageState);
+ PortalRenderResponse renderResponse = new PortalRenderResponse(resp, context, pageState, prepareResponse);
//
chain.doFilter(req, renderResponse);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -25,6 +25,7 @@
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.PortletInfo;
import java.util.List;
@@ -43,8 +44,14 @@
/** . */
private final PortalPrepareResponse prepareResponse;
- public PageEventControllerContext(PortalPrepareResponse prepareResponse)
+ /** . */
+ private final PagePortletControllerContext context;
+
+ public PageEventControllerContext(
+ PagePortletControllerContext context,
+ PortalPrepareResponse prepareResponse)
{
+ this.context = context;
this.prepareResponse = prepareResponse;
}
@@ -55,16 +62,26 @@
//
for (String windowId : prepareResponse.getWindowIds())
{
- Portlet portlet = prepareResponse.getPortlet(windowId);
+ try
+ {
+ Portlet portlet = context.getPortlet(windowId);
- //
- PortletInfo portletInfo = portlet.getInfo();
+ //
+ if (portlet != null)
+ {
+ PortletInfo portletInfo = portlet.getInfo();
- //
- if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
+ //
+ if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
+ {
+ Event consumedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), windowId);
+ consumedEvents.add(consumedEvent);
+ }
+ }
+ }
+ catch (PortletInvokerException e)
{
- Event consumedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), windowId);
- consumedEvents.add(consumedEvent);
+ e.printStackTrace();
}
}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageParameterDef.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageParameterDef.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageParameterDef.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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 javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageParameterDef
+{
+
+ /** . */
+ private QName name;
+
+ /** . */
+ private String value;
+
+ /** . */
+ private boolean frozen;
+
+ public PageParameterDef(QName name, String value, boolean frozen)
+ {
+ this.name = name;
+ this.value = value;
+ this.frozen = frozen;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public boolean isFrozen()
+ {
+ return frozen;
+ }
+}
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-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -24,6 +24,8 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -35,6 +37,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -49,9 +53,16 @@
/** . */
private final PortalPrepareResponse prepareResponse;
+ /** . */
+ private final Map<Key, Portlet> portlets;
+
+ /** . */
+ private final PortletInvoker invoker;
+
public PagePortletControllerContext(
HttpServletRequest req,
HttpServletResponse resp,
+ PortletInvoker invoker,
ServletContext servletContext,
PortalPrepareResponse prepareResponse)
throws IllegalRequestException, IOException, ServletException, PortletInvokerException
@@ -59,22 +70,78 @@
super(req, resp, servletContext);
//
+ Map<Key, Portlet> portlets = new HashMap<Key, Portlet>();
+ for (Portlet portlet : invoker.getPortlets())
+ {
+ PortletInfo portletInfo = portlet.getInfo();
+ String portletName = portletInfo.getName();
+ String applicationName = portletInfo.getApplicationName();
+ Key key = new Key(applicationName, portletName);
+ portlets.put(key, portlet);
+ }
+
+ //
+ this.invoker = invoker;
+ this.portlets = portlets;
this.prepareResponse = prepareResponse;
- this.eventControllerContext = new PageEventControllerContext(prepareResponse);
+ this.eventControllerContext = new PageEventControllerContext(this, prepareResponse);
}
+ public Portlet findPortlet(String applicationName, String portletName)
+ {
+ return portlets.get(new Key(applicationName, portletName));
+ }
+
protected Portlet getPortlet(String windowId) throws PortletInvokerException
{
- return prepareResponse.getPortlet(windowId);
+ WindowDef windowDef = prepareResponse.getWindowDef(windowId);
+
+ //
+ return findPortlet(windowDef.getApplicationName(), windowDef.getPortletName());
}
public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
{
- return prepareResponse.getInvoker().invoke(invocation);
+ return invoker.invoke(invocation);
}
public EventControllerContext getEventControllerContext()
{
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/PortalPrepareResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java 2008-02-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -22,13 +22,12 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.ServletOutputStream;
+import javax.xml.namespace.QName;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
@@ -63,31 +62,50 @@
private PrintWriter writer;
/** . */
- private Map<String, Portlet> windows;
+ private Map<String, WindowDef> windowDefs;
- public PortalPrepareResponse(HttpServletResponse response, PortletInvoker invoker) throws PortletInvokerException
+ /** . */
+ private Map<QName, PageParameterDef> paramDefs;
+
+ public PortalPrepareResponse(HttpServletResponse response) throws PortletInvokerException
{
- super(response, invoker);
+ super(response);
//
- this.windows = new HashMap<String, Portlet>();
+ this.windowDefs = new HashMap<String, WindowDef>();
+ this.paramDefs = new HashMap<QName, PageParameterDef>();
}
- public void addWindow(String windowId, Portlet portlet)
+ public Set<String> getWindowIds()
{
- windows.put(windowId, portlet);
+ return windowDefs.keySet();
}
- public Set<String> getWindowIds()
+ public WindowDef getWindowDef(String windowId)
{
- return windows.keySet();
+ return windowDefs.get(windowId);
}
- public Portlet getPortlet(String windowId)
+ public void addWindowDef(String windowId, WindowDef portlet)
{
- return windows.get(windowId);
+ windowDefs.put(windowId, portlet);
}
+ public Set<QName> getPageParameterNames()
+ {
+ return paramDefs.keySet();
+ }
+
+ public PageParameterDef getPageParameterDef(QName name)
+ {
+ return paramDefs.get(name);
+ }
+
+ public void setPageParameterDef(PageParameterDef parameterDef)
+ {
+ paramDefs.put(parameterDef.getName(), parameterDef);
+ }
+
public ServletOutputStream getOutputStream() throws IOException
{
if (writer != null)
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.test.controller.TestInstanceContext;
import org.jboss.portal.portlet.test.controller.TestPortalContext;
+import org.jboss.portal.portlet.test.jsp.PortletResult;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -31,7 +32,6 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
@@ -44,6 +44,9 @@
import javax.servlet.http.HttpServletResponse;
import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -55,24 +58,46 @@
/** . */
private PageNavigationalState pageState;
- /** Wether or not the page state can be modified. */
- private boolean pageStateModifiable;
-
/** . */
private PagePortletControllerContext portletControllerContext;
+ /** . */
+ private Map<String, PortletResult> windowResults;
+
public PortalRenderResponse(
HttpServletResponse response,
- PortletInvoker invoker,
PagePortletControllerContext portletControllerContext,
- PageNavigationalState pageState) throws PortletInvokerException
+ PageNavigationalState pageState,
+ PortalPrepareResponse prepareResponse) throws PortletInvokerException
{
- super(response, invoker);
+ super(response);
//
+ Set<QName> pageParameterNames = prepareResponse.getPageParameterNames();
+ if (pageParameterNames.size() > 0)
+ {
+ if (pageState == null)
+ {
+ pageState = portletControllerContext.getStateControllerContext().createPageState(true);
+ }
+ for (QName parameterName : pageParameterNames)
+ {
+ PageParameterDef parameterDef = prepareResponse.getPageParameterDef(parameterName);
+ boolean update = parameterDef.isFrozen() ? true : pageState.getPublicNavigationalState(parameterName) == null;
+ if (update)
+ {
+ pageState.setPublicNavigationalState(parameterName, new String[]{parameterDef.getValue()});
+ }
+ }
+ }
+
+ //
+ this.portletControllerContext = portletControllerContext;
+ this.windowResults = new HashMap<String, PortletResult>();
this.pageState = pageState;
- this.pageStateModifiable = true;
- this.portletControllerContext = portletControllerContext;
+
+ //
+ render(prepareResponse);
}
/**
@@ -85,12 +110,17 @@
return pageState;
}
+ public PortletResult getWindowResult(String windowId)
+ {
+ return windowResults.get(windowId);
+ }
+
public PagePortletControllerContext getPortletControllerContext()
{
return portletControllerContext;
}
- public PortletInvocationResponse render(Portlet portlet, String windowId) throws PortletInvokerException
+ private PortletInvocationResponse render(Portlet portlet, String windowId) throws PortletInvokerException
{
WindowNavigationalState windowNS = null;
if (pageState != null)
@@ -144,36 +174,41 @@
render.setPublicNavigationalState(publicNS);
//
- pageStateModifiable = false;
-
- //
return portletControllerContext.invoke(render);
}
- public boolean isPageStateModifiable()
+ private void render(PortalPrepareResponse prepareResponse)
{
- return pageStateModifiable;
- }
+ for (String windowId : prepareResponse.getWindowIds())
+ {
+ WindowDef windowDef = prepareResponse.getWindowDef(windowId);
- public String getPageParameter(QName name)
- {
- return pageState != null ? pageState.getPublicNavigationalState(name)[0] : null;
- }
+ //
+ try
+ {
+ Portlet portlet = portletControllerContext.getPortlet(windowId);
- public void setPageParameter(QName name, String value)
- {
- if (pageStateModifiable)
- {
- if (pageState == null)
+ //
+ if (portlet != null)
+ {
+ PortletInvocationResponse portletResponse = render(portlet, windowId);
+
+ //
+ PortletResult result = new PortletResult(windowDef, portletResponse);
+
+ //
+ windowResults.put(windowId, result);
+ }
+ else
+ {
+ // log
+ }
+ }
+ catch (PortletInvokerException e)
{
- pageState = portletControllerContext.getStateControllerContext().createPageState(true);
+ e.printStackTrace();
}
- pageState.setPublicNavigationalState(name, new String[]{value});
}
- else
- {
- throw new IllegalStateException("Page state cannot be modified");
- }
}
public String getMaximizedWindowId()
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-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -22,15 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.info.PortletInfo;
import javax.servlet.http.HttpServletResponseWrapper;
import javax.servlet.http.HttpServletResponse;
-import java.util.Map;
-import java.util.HashMap;
/**
* Expose stuff common to action and render response.
@@ -42,46 +37,13 @@
{
/** . */
- private final PortletInvoker invoker;
-
- /** . */
- private final Map<Key, Portlet> portlets;
-
- /** . */
private int count = 0;
- public PortalResponse(
- HttpServletResponse response,
- PortletInvoker invoker) throws PortletInvokerException
+ public PortalResponse(HttpServletResponse response) throws PortletInvokerException
{
super(response);
-
- //
- Map<Key, Portlet> portlets = new HashMap<Key, Portlet>();
- for (Portlet portlet : invoker.getPortlets())
- {
- PortletInfo portletInfo = portlet.getInfo();
- String portletName = portletInfo.getName();
- String applicationName = portletInfo.getApplicationName();
- Key key = new Key(applicationName, portletName);
- portlets.put(key, portlet);
- }
-
- //
- this.portlets = portlets;
- this.invoker = invoker;
}
- public PortletInvoker getInvoker()
- {
- return invoker;
- }
-
- public Portlet findPortlet(String applicationName, String portletName)
- {
- return portlets.get(new Key(applicationName, portletName));
- }
-
/**
* todo : add on JSP portlet tag a notion of 'id', because this id generation relies on the portlet
* rendering order on the page which could not be the same between 2 requests.
@@ -90,39 +52,4 @@
{
return "" + count++;
}
-
- 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();
- }
- }
}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortletResult.java (from rev 9913, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletResult.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortletResult.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortletResult.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.test.jsp.WindowDef;
+
+/**
+ * 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 $
+ */
+public class PortletResult
+{
+
+ /** . */
+ private final WindowDef windowDef;
+
+ /** . */
+ private final PortletInvocationResponse response;
+
+ public PortletResult(WindowDef windowDef, PortletInvocationResponse response)
+ {
+ this.windowDef = windowDef;
+ this.response = response;
+ }
+
+ public WindowDef getWindowDef()
+ {
+ return windowDef;
+ }
+
+ public PortletInvocationResponse getResponse()
+ {
+ return response;
+ }
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/WindowDef.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/WindowDef.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/WindowDef.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.Mode;
+import org.jboss.portal.WindowState;
+
+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 $
+ */
+public class WindowDef
+{
+
+ /** . */
+ private final String portletName;
+
+ /** . */
+ private final String applicationName;
+
+ /** . */
+ private final String windowId;
+
+ /** . */
+ private final Mode initialMode;
+
+ /** . */
+ private final Set<Mode> supportedModes;
+
+ /** . */
+ private final Set<WindowState> supportedWindowStates;
+
+ public WindowDef(
+ String portletName,
+ String applicationName,
+ String windowId,
+ Mode initialMode,
+ Set<Mode> supportedModes,
+ Set<WindowState> supportedWindowStates)
+ {
+ this.portletName = portletName;
+ this.applicationName = applicationName;
+ this.windowId = windowId;
+ 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 Mode getInitialMode()
+ {
+ return initialMode;
+ }
+
+ public Set<Mode> getSupportedModes()
+ {
+ return supportedModes;
+ }
+
+ public Set<WindowState> getSupportedWindowStates()
+ {
+ return supportedWindowStates;
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java 2008-02-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.test.jsp.PageParameterDef;
import javax.servlet.jsp.JspException;
import javax.xml.namespace.QName;
@@ -37,76 +38,66 @@
{
/** . */
- private String namespaceURI;
+ private String namespaceURIAttr;
/** . */
- private String localName;
+ private String localNameAttr;
/** . */
- private String value;
+ private String valueAttr;
/** . */
- private String frozen;
+ private String frozenAttr;
public String getNamespaceURI()
{
- return namespaceURI;
+ return namespaceURIAttr;
}
public void setNamespaceURI(String namespaceURI)
{
- this.namespaceURI = namespaceURI;
+ this.namespaceURIAttr = namespaceURI;
}
public String getLocalName()
{
- return localName;
+ return localNameAttr;
}
public void setLocalName(String localName)
{
- this.localName = localName;
+ this.localNameAttr = localName;
}
public String getValue()
{
- return value;
+ return valueAttr;
}
public void setValue(String value)
{
- this.value = value;
+ this.valueAttr = value;
}
public String getFrozen()
{
- return frozen;
+ return frozenAttr;
}
public void setFrozen(String frozen)
{
- this.frozen = frozen;
+ this.frozenAttr = frozen;
}
public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
- if (renderResponse.isPageStateModifiable())
- {
- QName name = new QName(namespaceURI, localName);
-
- //
- if ("true".equals(frozen))
- {
- //
- }
- else if (renderResponse.getPageParameter(name) == null)
- {
- renderResponse.setPageParameter(name, value);
- }
- }
}
public void doTag(PortalPrepareResponse prepareResponse) throws JspException, IOException
{
+ QName name = new QName(namespaceURIAttr, localNameAttr);
+ boolean frozen = "true".equals(frozenAttr);
+ PageParameterDef parameterDef = new PageParameterDef(name, valueAttr, frozen);
+ prepareResponse.setPageParameterDef(parameterDef);
}
}
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-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -55,7 +55,7 @@
WindowNavigationalState windowNS = null;
if (renderResponse.getPageState() != null)
{
- windowNS = renderResponse.getPageState().getWindowNavigationalState(portletTag.result.getWindowId());
+ windowNS = renderResponse.getPageState().getWindowNavigationalState(portletTag.result.getWindowDef().getWindowId());
}
if (windowNS == null || !windowNS.getWindowState().equals(WindowState.MINIMIZED))
{
@@ -77,13 +77,13 @@
}
else
{
- out.write(portletResp.getClass().getSimpleName() + "[" + portletTag.result.getPortletName() + "," + portletTag.result.getApplicationName() + "]");
+ out.write(portletResp.getClass().getSimpleName() + "[" + portletTag.result.getWindowDef().getPortletName() + "," + portletTag.result.getWindowDef().getApplicationName() + "]");
out.flush();
}
}
else
{
- out.write("Empty[" + portletTag.result.getPortletName() + "," + portletTag.result.getApplicationName() + "]");
+ out.write("Empty[" + portletTag.result.getWindowDef().getPortletName() + "," + portletTag.result.getWindowDef().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-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -25,12 +25,12 @@
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
import org.jboss.portal.portlet.test.jsp.PortalResponse;
+import org.jboss.portal.portlet.test.jsp.WindowDef;
+import org.jboss.portal.portlet.test.jsp.PortletResult;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.Tools;
@@ -79,10 +79,8 @@
private Set<Mode> supportedModes;
private Mode initialMode;
private PageTag pageTag;
- private Portlet portlet;
private String windowId;
- /** . */
PortletResult result;
public String getName()
@@ -185,9 +183,6 @@
}
//
- Portlet portlet = portalResponse.findPortlet(applicationNameAttr, nameAttr);
-
- //
String windowId = portalResponse.nextId();
//
@@ -195,7 +190,6 @@
this.supportedModes = supportedModes;
this.supportedWindowStates = supportedWindowStates;
this.pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
- this.portlet = portlet;
this.windowId = windowId;
}
@@ -205,7 +199,6 @@
this.supportedModes = null;
this.supportedWindowStates = null;
this.pageTag = null;
- this.portlet = null;
this.windowId = null;
}
@@ -214,12 +207,12 @@
initState(prepareResponse);
//
- if (portlet != null)
- {
- prepareResponse.addWindow(windowId, portlet);
- }
+ WindowDef windowDef = new WindowDef(nameAttr, applicationNameAttr, windowId, initialMode, supportedModes, supportedWindowStates);
//
+ prepareResponse.addWindowDef(windowId, windowDef);
+
+ //
return SKIP_BODY;
}
@@ -236,7 +229,10 @@
initState(renderResponse);
//
- if (portlet == null)
+ PortletResult result = renderResponse.getWindowResult(windowId);
+
+ //
+ if (result == null || result.getResponse() == null)
{
handleError(renderResponse, Constants.NOT_FOUND, null, null);
@@ -249,7 +245,7 @@
{
if (windowId.equals(pageTag.maximizedId))
{
- return render(renderResponse, EVAL_BODY_BUFFERED);
+ return render(renderResponse, result, EVAL_BODY_BUFFERED);
}
else
{
@@ -258,7 +254,7 @@
}
else
{
- return render(renderResponse, EVAL_BODY_INCLUDE);
+ return render(renderResponse, result, EVAL_BODY_INCLUDE);
}
}
}
@@ -277,55 +273,37 @@
return EVAL_PAGE;
}
- public int render(PortalRenderResponse renderResponse, int rt)
+ public int render(PortalRenderResponse renderResponse, PortletResult result, int rt)
{
- try
+ PortletInvocationResponse portletResponse = result.getResponse();
+
+ //
+ if (portletResponse instanceof FragmentResponse)
{
- PortletInvocationResponse portletResponse = renderResponse.render(portlet, windowId);
+ this.result = result;
+ //
+ return rt;
+ }
+ else if (portletResponse instanceof ErrorResponse)
+ {
+ ErrorResponse error = (ErrorResponse)portletResponse;
//
- if (portletResponse instanceof FragmentResponse)
- {
- result = new PortletResult(
- nameAttr,
- applicationNameAttr,
- windowId,
- portletResponse,
- initialMode,
- supportedModes,
- supportedWindowStates);
+ handleError(renderResponse, Constants.PORTLET_ERROR, error.getCause(), error.getMessage());
- //
- return rt;
- }
- else if (portletResponse instanceof ErrorResponse)
- {
- ErrorResponse error = (ErrorResponse)portletResponse;
+ //
+ return SKIP_BODY;
+ }
+ else if (portletResponse instanceof UnavailableResponse)
+ {
+ handleError(renderResponse, Constants.UNAVAILABLE, null, null);
- //
- handleError(renderResponse, Constants.PORTLET_ERROR, error.getCause(), error.getMessage());
-
- //
- return SKIP_BODY;
- }
- else if (portletResponse instanceof UnavailableResponse)
- {
- handleError(renderResponse, Constants.UNAVAILABLE, null, null);
-
- //
- return SKIP_BODY;
- }
- else
- {
- handleError(renderResponse, Constants.INTERNAL_ERROR, null, null);
-
- //
- return SKIP_BODY;
- }
+ //
+ return SKIP_BODY;
}
- catch (PortletInvokerException e)
+ else
{
- handleError(renderResponse, Constants.INTERNAL_ERROR, e, e.getMessage());
+ handleError(renderResponse, Constants.INTERNAL_ERROR, null, null);
//
return SKIP_BODY;
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-10 04:31:21 UTC (rev 9917)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-10 13:47:05 UTC (rev 9918)
@@ -130,7 +130,7 @@
try
{
JspWriter out = pageContext.getOut();
- String renderedURL = renderer.renderURL(portletTag.result.getWindowId(), url, null, null, true);
+ String renderedURL = renderer.renderURL(portletTag.result.getWindowDef().getWindowId(), url, null, null, true);
out.write(renderedURL);
}
catch (IOException e)
16 years, 5 months
JBoss Portal SVN: r9917 - in modules/portlet/trunk/test/src: test/resources/simple-portal-war/WEB-INF/jsp and 1 other directories.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-02-09 23:31:21 -0500 (Sat, 09 Feb 2008)
New Revision: 9917
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/master.css
Log:
remote control cleanup
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java 2008-02-10 03:38:03 UTC (rev 9916)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java 2008-02-10 04:31:21 UTC (rev 9917)
@@ -42,23 +42,27 @@
{
resourceResponse.setContentType("text/html");
PrintWriter writer = resourceResponse.getWriter();
- writer.print("<script type='text/javascript'>function openLinkInParent(url){window.open(url,'jbp_parent');}</script>");
+ writer.print("<html><head><script type='text/javascript'>function openLinkInParent(url){window.open(url,'jbp_parent');}</script>" +
+ "<link rel=\"stylesheet\" href=\"/simple/css/master.css\" type=\"text/css\"/></head><body>");
PortletURL url = resourceResponse.createRenderURL();
url.setWindowState(WindowState.MINIMIZED);
- writer.print("<ul><li><a href='#' onclick=\"" + createParentURL(url) + "\">minimize parent portlet</a></li>");
+ writer.print("<div class=\"remote-container\"><ul><li><a href='#' onclick=\"" + createParentURL(url) + "\"><img\n" +
+ " src=\"/simple/images/icon-minimize.gif\" alt=\"\"/> minimize parent portlet</a></li>");
url.setWindowState(WindowState.MAXIMIZED);
- writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">maximize parent portlet</a></li>");
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\"><img\n" +
+ " src=\"/simple/images/icon-maximize.gif\" alt=\"\"/> maximize parent portlet</a></li>");
url.setWindowState(WindowState.NORMAL);
- writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">make parent portlet normal</a></li></ul>");
- writer.print("<p><b>'zipcode'</b> public render parameter value: " + resourceRequest.getParameter(ZIPCODE) + "<br/>");
- writer.print("Set value of <b>'zipcode'</b> public render parameter to:</p>");
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\"><img\n" +
+ " src=\"/simple/images/icon-normal.gif\" alt=\"\"/> make parent portlet normal</a></li></ul>");
+ writer.print("<br/><ul><li><b>'zipcode'</b> public render parameter value: " + resourceRequest.getParameter(ZIPCODE) + "<br/>");
+ writer.print("Set value of <b>'zipcode'</b> public render parameter to:</li>");
url.setParameter(ZIPCODE, "80201");
- writer.print("<ul><li><a href='#' onclick=\"" + createParentURL(url) + "\">Denver</a>");
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">Denver</a>");
url.setParameter(ZIPCODE, "94102");
writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">San Francisco</a>");
url.setParameter(ZIPCODE, "20001");
writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">Washington, DC</a>");
- writer.print("</ul>");
+ writer.print("</ul></div></body></html>");
}
private String createParentURL(PortletURL url)
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp 2008-02-10 03:38:03 UTC (rev 9916)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp 2008-02-10 04:31:21 UTC (rev 9917)
@@ -1,4 +1,5 @@
<%@ page language="java" %>
+
<div class="portlet">
<div class="portlet-frame">
<div class="header full-width">
Modified: 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 2008-02-10 03:38:03 UTC (rev 9916)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/master.css 2008-02-10 04:31:21 UTC (rev 9917)
@@ -281,4 +281,24 @@
color: #cc1100
}
+/*-------------------------------------Remote Window*/
+div.remote-container {
+ padding: 8px 0 0 0;
+}
+
+div.remote-container ul {
+ list-style: none;
+ list-style-position: inside;
+ width: 90%;
+ margin: 0 auto 0 auto;
+}
+
+div.remote-container ul li {
+ padding: 3px 0 3px 0;
+ border-bottom: 1px solid #777777;
+}
+
+div.remote-container ul li a {
+ color: #332299
+}
16 years, 5 months
JBoss Portal SVN: r9916 - in modules/portlet/trunk/test/src/test/resources/simple-portal-war: css and 1 other directory.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-02-09 22:38:03 -0500 (Sat, 09 Feb 2008)
New Revision: 9916
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/master.css
Log:
error formatting and other css
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp 2008-02-10 02:16:32 UTC (rev 9915)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp 2008-02-10 03:38:03 UTC (rev 9916)
@@ -1,21 +1,34 @@
-<%@ page language="java" %>
-
+<%@ page language="java" %>
<div class="portlet">
<div class="portlet-frame">
<div class="header full-width">
<div class="header-layer full-width">
<div class="title two-third-width float-left">
- <h2><%= request.getAttribute("org.jboss.portal.portlet.portal.error.portlet_name")%>
+ <h2>
+ ${requestScope['org.jboss.portal.portlet.portal.error.portlet_name']} ${requestScope['org.jboss.portal.portlet.portal.error.status'] == 'not_found' ? ' not found' : ''}
</h2>
</div>
</div>
</div>
- <p style="font-weight: bold;">Portlet was not rendered</p>
- <b>Error status:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.status")%><br/>
- <b>Portlet name:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.portlet_name")%><br/>
- <b>Portlet application
- name:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.application_name")%><br/>
- <b>Exception:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.cause")%><br/>
- <b>Window id:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.window_id")%><br/>
+ <h3 class="error-header">Portlet was not rendered</h3>
+ <div class="error-container">
+ <ul>
+ <li>
+ <span>Error status:</span> ${requestScope['org.jboss.portal.portlet.portal.error.status']}
+ </li>
+ <li>
+ <span>Portlet name:</span> ${requestScope['org.jboss.portal.portlet.portal.error.portlet_name']}
+ </li>
+ <li>
+ <span>Portlet application name:</span> ${requestScope['org.jboss.portal.portlet.portal.error.application_name']}
+ </li>
+ <li>
+ <span>Exception:</span> ${!empty requestScope['org.jboss.portal.portlet.portal.error.cause'] ? requestScope['org.jboss.portal.portlet.portal.error.cause'] : 'Error cause unavailable'}
+ </li>
+ <li>
+ <span>Window id:</span> ${requestScope['org.jboss.portal.portlet.portal.error.window_id']}
+ </li>
+ </ul>
+ </div>
</div>
</div>
Modified: 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 2008-02-10 02:16:32 UTC (rev 9915)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/css/master.css 2008-02-10 03:38:03 UTC (rev 9916)
@@ -118,7 +118,7 @@
}
a {
- color: #e1d77e;
+ color: #666666;
}
p {
@@ -179,7 +179,7 @@
background-repeat: repeat-x;
background-position: top left;
text-decoration:none;
- font: bold 11px Lucida Sans, Trebuchet, tahoma, sans-serif;
+ font: bold 11px;
}
div#container div.nav ul li a{
@@ -215,7 +215,6 @@
div#container div#content div.portlet-frame{
background-color: #fff;
border: 1px solid #fff;
- /*height: 500px;*/
}
div#container div#content div.portlet div.header {
@@ -246,4 +245,40 @@
div#container div#content div.portlet div.header div.header-layer div.controls span.mode-button{
text-align: right;
padding: 0 5px 0 0;
-}
\ No newline at end of file
+}
+
+div#container div#content div.portlet div.header div.header-layer div.controls span.mode-button a {
+ color: #e1d77e;
+ font: normal 11px;
+ text-decoration:none;
+}
+
+/*----------------------------------Error portlet*/
+
+div.error-container {
+ padding: 5px;
+ background-color: #fff;
+}
+
+h3.error-header {
+ background-color: #cc1100;
+ color: #fff;
+ padding: 3px;
+}
+
+div.error-container ul {
+ list-style: none;
+ list-style-position: inside;
+}
+
+div.error-container ul li {
+ padding: 3px 0 3px 0;
+ border-bottom: 1px solid #777777;
+}
+
+div.error-container ul li span {
+ font-weight: bold;
+ color: #cc1100
+}
+
+
16 years, 5 months
JBoss Portal SVN: r9915 - 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-09 21:16:32 -0500 (Sat, 09 Feb 2008)
New Revision: 9915
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.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/PageEventControllerContext.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/taglib/PageParamTag.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/ParamTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.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 action -> prepare phase
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-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -88,13 +88,13 @@
PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
//
- PortalActionResponse actionResponse = new PortalActionResponse(resp, invoker);
+ PortalPrepareResponse prepareResponse = new PortalPrepareResponse(resp, invoker);
// Discover existing portlets on the page (introspection phase)
- chain.doFilter(req, actionResponse);
+ chain.doFilter(req, prepareResponse);
// Now we can create a populated context
- PagePortletControllerContext context = new PagePortletControllerContext(req, resp, getServletContext(), actionResponse);
+ PagePortletControllerContext context = new PagePortletControllerContext(req, resp, getServletContext(), prepareResponse);
//
PageNavigationalState pageState = null;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -41,11 +41,11 @@
{
/** . */
- private final PortalActionResponse actionResponse;
+ private final PortalPrepareResponse prepareResponse;
- public PageEventControllerContext(PortalActionResponse actionResponse)
+ public PageEventControllerContext(PortalPrepareResponse prepareResponse)
{
- this.actionResponse = actionResponse;
+ this.prepareResponse = prepareResponse;
}
public List<Event> getConsumedEvents(Event producedEvent)
@@ -53,9 +53,9 @@
ArrayList<Event> consumedEvents = new ArrayList<Event>();
//
- for (String windowId : actionResponse.getWindowIds())
+ for (String windowId : prepareResponse.getWindowIds())
{
- Portlet portlet = actionResponse.getPortlet(windowId);
+ Portlet portlet = prepareResponse.getPortlet(windowId);
//
PortletInfo portletInfo = portlet.getInfo();
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-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -47,30 +47,30 @@
private final EventControllerContext eventControllerContext;
/** . */
- private final PortalActionResponse actionResponse;
+ private final PortalPrepareResponse prepareResponse;
public PagePortletControllerContext(
HttpServletRequest req,
HttpServletResponse resp,
ServletContext servletContext,
- PortalActionResponse actionResponse)
+ PortalPrepareResponse prepareResponse)
throws IllegalRequestException, IOException, ServletException, PortletInvokerException
{
super(req, resp, servletContext);
//
- this.actionResponse = actionResponse;
- this.eventControllerContext = new PageEventControllerContext(actionResponse);
+ this.prepareResponse = prepareResponse;
+ this.eventControllerContext = new PageEventControllerContext(prepareResponse);
}
protected Portlet getPortlet(String windowId) throws PortletInvokerException
{
- return actionResponse.getPortlet(windowId);
+ return prepareResponse.getPortlet(windowId);
}
public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
{
- return actionResponse.getInvoker().invoke(invocation);
+ return prepareResponse.getInvoker().invoke(invocation);
}
public EventControllerContext getEventControllerContext()
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.java 2008-02-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -1,242 +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.PortletInvoker;
-import org.jboss.portal.portlet.PortletInvokerException;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.Cookie;
-import javax.servlet.ServletOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.Locale;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortalActionResponse extends PortalResponse
-{
-
- /** . */
- private String contentType;
-
- /** . */
- private Locale locale;
-
- /** . */
- private String characterEncoding;
-
- /** . */
- private int bufferSize;
-
- /** . */
- private ServletOutputStream outputStream;
-
- /** . */
- private PrintWriter writer;
-
- /** . */
- private Map<String, Portlet> windows;
-
- public PortalActionResponse(HttpServletResponse response, PortletInvoker invoker) throws PortletInvokerException
- {
- super(response, invoker);
-
- //
- this.windows = new HashMap<String, Portlet>();
- }
-
- public void addWindow(String windowId, Portlet portlet)
- {
- windows.put(windowId, portlet);
- }
-
- public Set<String> getWindowIds()
- {
- return windows.keySet();
- }
-
- public Portlet getPortlet(String windowId)
- {
- return windows.get(windowId);
- }
-
- public ServletOutputStream getOutputStream() throws IOException
- {
- if (writer != null)
- {
- throw new IllegalStateException();
- }
- if (outputStream == null)
- {
- outputStream = new ServletOutputStream()
- {
- public void write(int b) throws IOException
- {
- }
- };
- }
- return outputStream;
- }
-
- public PrintWriter getWriter() throws IOException
- {
- if (outputStream != null)
- {
- throw new IllegalStateException();
- }
- if (writer == null)
- {
- Writer tmp = new Writer()
- {
- public void write(char cbuf[], int off, int len) throws IOException
- {
- }
- public void flush() throws IOException
- {
- }
- public void close() throws IOException
- {
- }
- };
- writer = new PrintWriter(tmp);
- }
- return writer;
- }
-
- public void flushBuffer() throws IOException
- {
- }
-
- public boolean isCommitted()
- {
- return false;
- }
-
- public void reset()
- {
- }
-
- public void resetBuffer()
- {
- }
-
- public void sendError(int i, String s) throws IOException
- {
- }
-
- public void sendError(int i) throws IOException
- {
- }
-
- public void sendRedirect(String s) throws IOException
- {
- }
-
- public void addCookie(Cookie cookie)
- {
- }
-
- public void setDateHeader(String s, long l)
- {
- }
-
- public void addDateHeader(String s, long l)
- {
- }
-
- public void setHeader(String s, String s1)
- {
- }
-
- public void addHeader(String s, String s1)
- {
- }
-
- public void setContentType(String contentType)
- {
- this.contentType = contentType;
- }
-
- public void setContentLength(int i)
- {
- }
-
- public void setCharacterEncoding(String characterEncoding)
- {
- this.characterEncoding = characterEncoding;
- }
-
- public void setIntHeader(String s, int i)
- {
- }
-
- public void addIntHeader(String s, int i)
- {
- }
-
- public void setStatus(int i)
- {
- }
-
- public void setStatus(int i, String s)
- {
- }
-
- public void setLocale(Locale locale)
- {
- this.locale = locale;
- }
-
- public String getContentType()
- {
- return contentType;
- }
-
- public Locale getLocale()
- {
- return locale;
- }
-
- public String getCharacterEncoding()
- {
- return characterEncoding;
- }
-
- public void setBufferSize(int bufferSize)
- {
- this.bufferSize = bufferSize;
- }
-
- public int getBufferSize()
- {
- return bufferSize;
- }
-}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java (from rev 9913, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -0,0 +1,242 @@
+/******************************************************************************
+ * 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.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Locale;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalPrepareResponse extends PortalResponse
+{
+
+ /** . */
+ private String contentType;
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String characterEncoding;
+
+ /** . */
+ private int bufferSize;
+
+ /** . */
+ private ServletOutputStream outputStream;
+
+ /** . */
+ private PrintWriter writer;
+
+ /** . */
+ private Map<String, Portlet> windows;
+
+ public PortalPrepareResponse(HttpServletResponse response, PortletInvoker invoker) throws PortletInvokerException
+ {
+ super(response, invoker);
+
+ //
+ this.windows = new HashMap<String, Portlet>();
+ }
+
+ public void addWindow(String windowId, Portlet portlet)
+ {
+ windows.put(windowId, portlet);
+ }
+
+ public Set<String> getWindowIds()
+ {
+ return windows.keySet();
+ }
+
+ public Portlet getPortlet(String windowId)
+ {
+ return windows.get(windowId);
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ if (writer != null)
+ {
+ throw new IllegalStateException();
+ }
+ if (outputStream == null)
+ {
+ outputStream = new ServletOutputStream()
+ {
+ public void write(int b) throws IOException
+ {
+ }
+ };
+ }
+ return outputStream;
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ if (outputStream != null)
+ {
+ throw new IllegalStateException();
+ }
+ if (writer == null)
+ {
+ Writer tmp = new Writer()
+ {
+ public void write(char cbuf[], int off, int len) throws IOException
+ {
+ }
+ public void flush() throws IOException
+ {
+ }
+ public void close() throws IOException
+ {
+ }
+ };
+ writer = new PrintWriter(tmp);
+ }
+ return writer;
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ }
+
+ public boolean isCommitted()
+ {
+ return false;
+ }
+
+ public void reset()
+ {
+ }
+
+ public void resetBuffer()
+ {
+ }
+
+ public void sendError(int i, String s) throws IOException
+ {
+ }
+
+ public void sendError(int i) throws IOException
+ {
+ }
+
+ public void sendRedirect(String s) throws IOException
+ {
+ }
+
+ public void addCookie(Cookie cookie)
+ {
+ }
+
+ public void setDateHeader(String s, long l)
+ {
+ }
+
+ public void addDateHeader(String s, long l)
+ {
+ }
+
+ public void setHeader(String s, String s1)
+ {
+ }
+
+ public void addHeader(String s, String s1)
+ {
+ }
+
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ public void setContentLength(int i)
+ {
+ }
+
+ public void setCharacterEncoding(String characterEncoding)
+ {
+ this.characterEncoding = characterEncoding;
+ }
+
+ public void setIntHeader(String s, int i)
+ {
+ }
+
+ public void addIntHeader(String s, int i)
+ {
+ }
+
+ public void setStatus(int i)
+ {
+ }
+
+ public void setStatus(int i, String s)
+ {
+ }
+
+ public void setLocale(Locale locale)
+ {
+ this.locale = locale;
+ }
+
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return characterEncoding;
+ }
+
+ public void setBufferSize(int bufferSize)
+ {
+ this.bufferSize = bufferSize;
+ }
+
+ public int getBufferSize()
+ {
+ return bufferSize;
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java 2008-02-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
import javax.servlet.jsp.JspException;
import javax.xml.namespace.QName;
@@ -87,7 +88,7 @@
this.frozen = frozen;
}
- public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
if (renderResponse.isPageStateModifiable())
{
@@ -105,7 +106,7 @@
}
}
- public void doActionTag() throws JspException, IOException
+ public void doTag(PortalPrepareResponse prepareResponse) throws JspException, IOException
{
}
}
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-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -23,8 +23,7 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
-import org.jboss.portal.portlet.test.jsp.PortalResponse;
-import org.jboss.portal.portlet.test.jsp.PortalActionResponse;
+import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
import javax.servlet.jsp.JspException;
import javax.xml.namespace.QName;
@@ -55,7 +54,7 @@
/** . */
Status status = Status.ACTIVE;
- public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
{
maximizedId = renderResponse.getMaximizedWindowId();
@@ -70,7 +69,7 @@
}
}
- public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
{
if (maximizedId != null)
{
@@ -88,12 +87,12 @@
return EVAL_PAGE;
}
- public int doStartActionTag(PortalActionResponse portalResponse) throws JspException
+ public int doStartTag(PortalPrepareResponse portalResponse) throws JspException
{
return EVAL_BODY_INCLUDE;
}
- public int doEndActionTag(PortalActionResponse portalResponse) throws JspException
+ public int doEndTag(PortalPrepareResponse portalResponse) throws JspException
{
return EVAL_PAGE;
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/ParamTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/ParamTag.java 2008-02-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/ParamTag.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -61,7 +61,7 @@
this.value = value;
}
- public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
AbstractURLTag urlTag = (AbstractURLTag)SimpleTagSupport.findAncestorWithClass(this, AbstractURLTag.class);
urlTag.setParam(name, value);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java 2008-02-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
-import org.jboss.portal.portlet.test.jsp.PortalActionResponse;
+import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.common.NotYetImplemented;
@@ -72,13 +72,13 @@
}
else
{
- if (portalResponse instanceof PortalActionResponse)
+ if (portalResponse instanceof PortalPrepareResponse)
{
- return doStartActionTag((PortalActionResponse)portalResponse);
+ return doStartTag((PortalPrepareResponse)portalResponse);
}
else
{
- return doStartRenderTag((PortalRenderResponse)portalResponse);
+ return doStartTag((PortalRenderResponse)portalResponse);
}
}
}
@@ -96,13 +96,13 @@
//
if (pageTag != null && pageTag.status == PageTag.Status.ACTIVE)
{
- if (portalResponse instanceof PortalActionResponse)
+ if (portalResponse instanceof PortalPrepareResponse)
{
- return doEndActionTag((PortalActionResponse)portalResponse);
+ return doEndTag((PortalPrepareResponse)portalResponse);
}
else
{
- return doEndRenderTag((PortalRenderResponse)portalResponse);
+ return doEndTag((PortalRenderResponse)portalResponse);
}
}
else
@@ -111,22 +111,22 @@
}
}
- public int doStartActionTag(PortalActionResponse actionResponse) throws JspException
+ public int doStartTag(PortalPrepareResponse prepareResponse) throws JspException
{
throw new NotYetImplemented();
}
- public int doEndActionTag(PortalActionResponse actionResponse) throws JspException
+ public int doEndTag(PortalPrepareResponse prepareResponse) throws JspException
{
throw new NotYetImplemented();
}
- public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
{
throw new NotYetImplemented();
}
- public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
{
throw new NotYetImplemented();
}
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-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import org.jboss.portal.portlet.test.jsp.PortalResponse;
-import org.jboss.portal.portlet.test.jsp.PortalActionResponse;
+import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
import org.jboss.portal.common.NotYetImplemented;
import javax.servlet.jsp.tagext.SimpleTagSupport;
@@ -51,24 +51,27 @@
//
if (pageTag != null && pageTag.status == PageTag.Status.ACTIVE)
{
- if (getPortalResponse() instanceof PortalActionResponse)
+ PortalResponse portalResponse = getPortalResponse();
+
+ //
+ if (portalResponse instanceof PortalPrepareResponse)
{
- doActionTag();
+ doTag((PortalPrepareResponse)portalResponse);
}
else
{
- doRenderTag((PortalRenderResponse)getPortalResponse());
+ doTag((PortalRenderResponse)portalResponse);
}
}
}
- public void doActionTag() throws JspException, IOException
+ public void doTag(PortalPrepareResponse prepareResponse) throws JspException, IOException
{
throw new NotYetImplemented();
}
- public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
- super.doTag();
+ throw new NotYetImplemented();
}
}
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-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -39,7 +39,7 @@
*/
public class PortletMarkupTag extends PortalSimpleTagSupport
{
- public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
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-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
-import org.jboss.portal.portlet.test.jsp.PortalActionResponse;
+import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
@@ -209,21 +209,21 @@
this.windowId = null;
}
- public int doStartActionTag(PortalActionResponse actionResponse) throws JspException
+ public int doStartTag(PortalPrepareResponse prepareResponse) throws JspException
{
- initState(actionResponse);
+ initState(prepareResponse);
//
if (portlet != null)
{
- actionResponse.addWindow(windowId, portlet);
+ prepareResponse.addWindow(windowId, portlet);
}
//
return SKIP_BODY;
}
- public int doEndActionTag(PortalActionResponse actionResponse) throws JspException
+ public int doEndTag(PortalPrepareResponse prepareResponse) throws JspException
{
destroyState();
@@ -231,7 +231,7 @@
return EVAL_PAGE;
}
- public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
{
initState(renderResponse);
@@ -263,7 +263,7 @@
}
}
- public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
{
if (bodyContent != null)
{
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-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -38,7 +38,7 @@
public class PortletTitleTag extends PortalSimpleTagSupport
{
- public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ public void doTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
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-10 01:37:59 UTC (rev 9914)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-10 02:16:32 UTC (rev 9915)
@@ -70,12 +70,12 @@
this.windowStateValue = windowState;
}
- public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
{
return EVAL_BODY_BUFFERED;
}
- public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
{
PagePortletControllerContext context = renderResponse.getPortletControllerContext();
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
16 years, 5 months
JBoss Portal SVN: r9913 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 20:34:14 -0500 (Sat, 09 Feb 2008)
New Revision: 9913
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/PortalBodyTagSupport.java
Log:
fixed maximized not work
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-10 01:17:56 UTC (rev 9912)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-10 01:34:14 UTC (rev 9913)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import org.jboss.portal.portlet.test.jsp.PortalResponse;
+import org.jboss.portal.portlet.test.jsp.PortalActionResponse;
import javax.servlet.jsp.JspException;
import javax.xml.namespace.QName;
@@ -87,12 +88,12 @@
return EVAL_PAGE;
}
- public int doStartTag(PortalResponse portalResponse) throws JspException
+ public int doStartActionTag(PortalActionResponse portalResponse) throws JspException
{
return EVAL_BODY_INCLUDE;
}
- public int doEndTag(PortalResponse portalResponse) throws JspException
+ public int doEndActionTag(PortalActionResponse portalResponse) throws JspException
{
return EVAL_PAGE;
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java 2008-02-10 01:17:56 UTC (rev 9912)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java 2008-02-10 01:34:14 UTC (rev 9913)
@@ -123,11 +123,11 @@
public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
{
- return super.doStartTag();
+ throw new NotYetImplemented();
}
public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
{
- return super.doEndTag();
+ throw new NotYetImplemented();
}
}
16 years, 5 months
JBoss Portal SVN: r9912 - in modules/portlet/trunk/test/src: main/java/org/jboss/portal/portlet/portal/samples/event and 13 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 20:17:56 -0500 (Sat, 09 Feb 2008)
New Revision: 9912
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java
modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war/
modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war/
modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war/
modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war/
modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war/WEB-INF/
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/
modules/portlet/trunk/test/src/test/resources/cart-event-portlet-war/
modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/
modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/
modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/
Modified:
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo1.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp
Log:
- moved stuff for more consistency but had to merge with changes so it may be f. up, will clean up just after
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java (from rev 9905, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -0,0 +1,178 @@
+/******************************************************************************
+ * 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.portal.samples;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * A simple portlet using Google's search services to extract interesting information (weather, map, ...) from first
+ * result.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class GoogleClippingPortlet extends GenericPortlet
+{
+ protected static final String A = "<a";
+ private static final String A_TARGET_BLANK = "<a target='_blank'";
+ private static final String ZIP = "zipcode";
+ private static final String SAN_FRAN = "94102";
+ private static final String GOOGLE = "http://www.google.com/search?q=";
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ String zip = getZipCode(renderRequest);
+
+ String query = getQueryString(zip);
+
+ URL url = new URL(query);
+
+ URLConnection connection = url.openConnection();
+ connection.setRequestProperty("User-Agent", "Mozilla/5.0");
+
+ BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
+ String html = new String(getBytes(in, 16384), "UTF-8");
+ in.close();
+
+ String beg = "<div class=e>";
+ String end = "</table>";
+ int begIndex = html.indexOf(beg);
+ if (begIndex != -1)
+ {
+ // extract table containing specific first result
+ int endIndex = html.indexOf(end, begIndex);
+ html = html.substring(begIndex + beg.length(), endIndex + end.length());
+
+ html = postProcessHTML(html);
+
+ renderResponse.setContentType("text/html");
+ PrintWriter printWriter = renderResponse.getWriter();
+ printWriter.print(html);
+ }
+ }
+
+ protected String getZipCode(RenderRequest renderRequest)
+ {
+ String zip = renderRequest.getParameter(ZIP);
+ if (zip == null)
+ {
+ zip = renderRequest.getPreferences().getValue(ZIP, SAN_FRAN);
+ }
+ return zip;
+ }
+
+ @Override
+ protected void doEdit(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ renderResponse.getWriter().print(
+ "<div align='center'>\n" +
+ " <br/>\n" +
+ " <font class='portlet-font'>Change Location:</font>\n" +
+ "\n" +
+ " <form method='post' action='" + renderResponse.createActionURL() + "'\n" +
+ " <font class='portlet-font'>Zip Code:</font><br/>\n" +
+ " <input class='portlet-form-input-field' type='text' value='' size='12' name='" + ZIP + "'/>\n" +
+ " <br/>\n" +
+ " <input class='portlet-form-input-field' type='submit' name='submit' value='submit'>\n" +
+ " </form>\n" +
+ "</div>");
+ }
+
+ @Override
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
+ {
+ String zip = actionRequest.getParameter(ZIP);
+
+ if (null != zip)
+ {
+ PortletPreferences prefs = actionRequest.getPreferences();
+ prefs.setValue(ZIP, zip);
+ prefs.store();
+ }
+
+ // set zip as render parameter
+ actionResponse.setRenderParameter(ZIP, zip);
+
+ // request view
+ actionResponse.setPortletMode(PortletMode.VIEW);
+ }
+
+ protected String postProcessHTML(String html)
+ {
+ // links should open in new windows
+ html = html.replaceAll(A, A_TARGET_BLANK);
+
+ // src attributes should be absolute
+ html = html.replaceAll("src=/", "src=http://google.com/");
+ html = html.replaceAll("src=\"/", "src=\"http://google.com/");
+
+ // forms should open in new windows and have an absolute action URL
+ html = html.replaceAll("action=\"/", "target='_blank' action=\"http://google.com/");
+
+ return html;
+ }
+
+ protected String getQueryString(String zip)
+ {
+ return GOOGLE + zip;
+ }
+
+ private byte[] getBytes(InputStream in, int bufferSize) throws IOException, IllegalArgumentException
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ byte[] buffer = new byte[bufferSize];
+ while (true)
+ {
+ int i = in.read(buffer);
+ if (i == 0)
+ {
+ continue;
+ }
+ if (i == -1)
+ {
+ break;
+ }
+ out.write(buffer, 0, i);
+ }
+ return out.toByteArray();
+ }
+
+}
Property changes on: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java (from rev 9905, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.portal.samples;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class GoogleWeatherClippingPortlet extends GoogleClippingPortlet
+{
+ private final static String WEATHER_URL = "http://www.google.com/search?q=weather+";
+ private static final String A_END = "</a>";
+
+ protected String getQueryString(String zip)
+ {
+ return WEATHER_URL + zip;
+ }
+
+ protected String postProcessHTML(String html)
+ {
+ int begIndex;
+ int endIndex;
+
+ // remove add to iGoogle link
+ begIndex = html.indexOf(A);
+ if (begIndex != -1)
+ {
+ endIndex = html.indexOf(A_END, begIndex);
+ html = html.substring(0, begIndex) + html.substring(endIndex + A_END.length());
+ }
+
+ return super.postProcessHTML(html);
+ }
+}
Property changes on: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java (from rev 9905, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2008, Your Corporation. All Rights Reserved.
+ */
+
+package org.jboss.portal.portlet.portal.samples;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RemoteControlResourcePortlet extends GenericPortlet
+{
+ private static final String ZIPCODE = "zipcode";
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ PrintWriter printWriter = renderResponse.getWriter();
+ printWriter.print("<script type='text/javascript'>function openRemote(url){window.name='jbp_parent';" +
+ "window.open(url, 'jbp_remote', 'width=400,height=200,scrollable=yes')}</script>");
+ printWriter.print("<p><a href='#' onclick=\"openRemote('");
+ ResourceURL resource = renderResponse.createResourceURL();
+ printWriter.print(resource);
+ printWriter.print("')\">Open remote control!</a></p>");
+ }
+
+ @Override
+ public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws PortletException, IOException
+ {
+ resourceResponse.setContentType("text/html");
+ PrintWriter writer = resourceResponse.getWriter();
+ writer.print("<script type='text/javascript'>function openLinkInParent(url){window.open(url,'jbp_parent');}</script>");
+ PortletURL url = resourceResponse.createRenderURL();
+ url.setWindowState(WindowState.MINIMIZED);
+ writer.print("<ul><li><a href='#' onclick=\"" + createParentURL(url) + "\">minimize parent portlet</a></li>");
+ url.setWindowState(WindowState.MAXIMIZED);
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">maximize parent portlet</a></li>");
+ url.setWindowState(WindowState.NORMAL);
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">make parent portlet normal</a></li></ul>");
+ writer.print("<p><b>'zipcode'</b> public render parameter value: " + resourceRequest.getParameter(ZIPCODE) + "<br/>");
+ writer.print("Set value of <b>'zipcode'</b> public render parameter to:</p>");
+ url.setParameter(ZIPCODE, "80201");
+ writer.print("<ul><li><a href='#' onclick=\"" + createParentURL(url) + "\">Denver</a>");
+ url.setParameter(ZIPCODE, "94102");
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">San Francisco</a>");
+ url.setParameter(ZIPCODE, "20001");
+ writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">Washington, DC</a>");
+ writer.print("</ul>");
+ }
+
+ private String createParentURL(PortletURL url)
+ {
+ return "openLinkInParent('" + url + "')";
+ }
+}
Property changes on: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event (from rev 9905, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event)
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CartEvent.java 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -1,50 +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.simple.samples.event;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.namespace.QName;
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-@XmlRootElement
-public class CartEvent implements Serializable
-{
- private String id;
-
- public static final QName QNAME = new QName("urn:jboss:portal:samples:event", "CartEvent");
-
- public CartEvent(String id)
- {
- this.id = id;
- }
-
- public String getId()
- {
- return id;
- }
-}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java (from rev 9911, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CartEvent.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * 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.portal.samples.event;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+@XmlRootElement
+public class CartEvent implements Serializable
+{
+ private String id;
+
+ public static final QName QNAME = new QName("urn:jboss:portal:samples:event", "CartEvent");
+
+ public CartEvent(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CartPortlet.java 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -1,82 +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.simple.samples.event;
-
-import javax.portlet.Event;
-import javax.portlet.EventRequest;
-import javax.portlet.EventResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class CartPortlet extends GenericPortlet
-{
- List<CatalogItem> items = new ArrayList<CatalogItem>(7);
-
- @Override
- protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
- {
- renderResponse.setContentType("text/html");
- Writer writer = renderResponse.getWriter();
-
-
- if (!items.isEmpty())
- {
- writer.append("<table><thead><tr><th>Description</th><th>Price</th></tr></thead><tbody>");
- int total = 0;
- for (CatalogItem item : items)
- {
- int price = item.getPrice();
- total += price;
- writer.append("<tr><td>").append(item.getDescription()).append("</td><td align='right'>$").append("" + price)
- .append("</td></tr>");
- }
- writer.append("<tr><td colspan='2' align='right'>").append("$" + total).append("</td></tr></tbody></table>");
- }
- else
- {
- writer.append("Cart is empty.");
- }
- }
-
- @Override
- public void processEvent(EventRequest eventRequest, EventResponse eventResponse) throws PortletException, IOException
- {
- Event event = eventRequest.getEvent();
- if (event.getName().equals("CartEvent"))
- {
- CartEvent cartEvent = (CartEvent)event.getValue();
- items.add(Catalog.get(cartEvent.getId()));
- }
- }
-}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java (from rev 9911, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CartPortlet.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.portal.samples.event;
+
+import javax.portlet.Event;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class CartPortlet extends GenericPortlet
+{
+ List<CatalogItem> items = new ArrayList<CatalogItem>(7);
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ Writer writer = renderResponse.getWriter();
+
+
+ if (!items.isEmpty())
+ {
+ writer.append("<table width='95%'><thead><tr align='left'><th width='66%'>Description</th><th align='right'>Price</th></tr></thead><tbody>");
+ int total = 0;
+ for (CatalogItem item : items)
+ {
+ int price = item.getPrice();
+ total += price;
+ writer.append("<tr><td>").append(item.getDescription()).append("</td><td align='right'>$").append("" + price)
+ .append("</td></tr>");
+ }
+ writer.append("<tr><td><b>Total:</b></td><td align='right' style='border-top: 2px solid #000;'>")
+ .append("$" + total).append("</td></tr></tbody></table>");
+ }
+ else
+ {
+ writer.append("Cart is empty.");
+ }
+ }
+
+ @Override
+ public void processEvent(EventRequest eventRequest, EventResponse eventResponse) throws PortletException, IOException
+ {
+ Event event = eventRequest.getEvent();
+ if (event.getName().equals("CartEvent"))
+ {
+ CartEvent cartEvent = (CartEvent)event.getValue();
+ items.add(Catalog.get(cartEvent.getId()));
+ }
+ }
+}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/Catalog.java 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -1,63 +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.simple.samples.event;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class Catalog
-{
- private static Map<String, CatalogItem> items;
-
- static
- {
- items = new HashMap<String, CatalogItem>(7);
- items.put("1", new CatalogItem("1", 800, "Bike"));
- items.put("2", new CatalogItem("2", 450, "Snowboard"));
- items.put("3", new CatalogItem("3", 225, "Tent"));
- items.put("4", new CatalogItem("4", 75, "Backpack"));
- items.put("5", new CatalogItem("5", 119, "Skateboard"));
- items.put("6", new CatalogItem("6", 333, "Surfboard"));
- items.put("7", new CatalogItem("7", 90, "Sneakers"));
- }
-
- private Catalog()
- {
- }
-
- public static CatalogItem get(String id)
- {
- return items.get(id);
- }
-
- public static Collection<CatalogItem> getAll()
- {
- return items.values();
- }
-}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java (from rev 9911, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/Catalog.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.portal.samples.event;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class Catalog
+{
+ private static Map<String, CatalogItem> items;
+
+ static
+ {
+ items = new HashMap<String, CatalogItem>(7);
+ items.put("1", new CatalogItem("1", 800, "Bike"));
+ items.put("2", new CatalogItem("2", 450, "Snowboard"));
+ items.put("3", new CatalogItem("3", 225, "Tent"));
+ items.put("4", new CatalogItem("4", 75, "Backpack"));
+ items.put("5", new CatalogItem("5", 119, "Skateboard"));
+ items.put("6", new CatalogItem("6", 333, "Surfboard"));
+ items.put("7", new CatalogItem("7", 90, "Sneakers"));
+ }
+
+ private Catalog()
+ {
+ }
+
+ public static CatalogItem get(String id)
+ {
+ return items.get(id);
+ }
+
+ public static Collection<CatalogItem> getAll()
+ {
+ return items.values();
+ }
+}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CatalogItem.java 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -1,57 +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.simple.samples.event;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class CatalogItem
-{
- private String id;
- private int price;
- private String description;
-
- public CatalogItem(String id, int price, String description)
- {
- this.id = id;
- this.price = price;
- this.description = description;
- }
-
- public String getId()
- {
- return id;
- }
-
- public int getPrice()
- {
- return price;
- }
-
- public String getDescription()
- {
- return description;
- }
-}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java (from rev 9911, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CatalogItem.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.portal.samples.event;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class CatalogItem
+{
+ private String id;
+ private int price;
+ private String description;
+
+ public CatalogItem(String id, int price, String description)
+ {
+ this.id = id;
+ this.price = price;
+ this.description = description;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public int getPrice()
+ {
+ return price;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CatalogPortlet.java 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -1,71 +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.simple.samples.event;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class CatalogPortlet extends GenericPortlet
-{
- @Override
- protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
- {
- renderResponse.setContentType("text/html");
- Writer writer = renderResponse.getWriter();
-
- writer.append("<table><thead><tr><th>Description</th><th>Price</th><th>Actions</th></tr></thead><tbody>");
-
- PortletURL addURL = renderResponse.createActionURL();
- addURL.setParameter("op", "add");
-
- Collection<CatalogItem> items = Catalog.getAll();
- for (CatalogItem item : items)
- {
- addURL.setParameter("id", item.getId());
- writer.append("<tr><td>").append(item.getDescription()).append("</td><td>$").append("" + item.getPrice())
- .append("</td><td><a href='").append(addURL.toString()).append("'>Add to cart</a></td></tr>");
- }
-
- writer.append("</tbody></table>");
- }
-
- @Override
- public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
- {
- String value = actionRequest.getParameter("id");
- actionResponse.setEvent(CartEvent.QNAME, new CartEvent(value));
- }
-}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java (from rev 9911, modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CatalogPortlet.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.portal.samples.event;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class CatalogPortlet extends GenericPortlet
+{
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ Writer writer = renderResponse.getWriter();
+
+ writer.append("<table width='95%'><thead><tr align='left'><th width='50%'>Description</th><th width='25%'>Price</th><th>Actions</th></tr></thead><tbody>");
+
+ PortletURL addURL = renderResponse.createActionURL();
+ addURL.setParameter("op", "add");
+
+ Collection<CatalogItem> items = Catalog.getAll();
+ for (CatalogItem item : items)
+ {
+ addURL.setParameter("id", item.getId());
+ writer.append("<tr><td>").append(item.getDescription()).append("</td><td>$").append("" + item.getPrice())
+ .append("</td><td><a href='").append(addURL.toString()).append("'>Add to cart</a></td></tr>");
+ }
+
+ writer.append("</tbody></table>");
+ }
+
+ @Override
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
+ {
+ String value = actionRequest.getParameter("id");
+ actionResponse.setEvent(CartEvent.QNAME, new CartEvent(value));
+ }
+}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleClippingPortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -1,178 +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.simple.samples;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletPreferences;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.net.URL;
-import java.net.URLConnection;
-
-/**
- * A simple portlet using Google's search services to extract interesting information (weather, map, ...) from first
- * result.
- *
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class GoogleClippingPortlet extends GenericPortlet
-{
- protected static final String A = "<a";
- private static final String A_TARGET_BLANK = "<a target='_blank'";
- private static final String ZIP = "zipcode";
- private static final String SAN_FRAN = "94102";
- private static final String GOOGLE = "http://www.google.com/search?q=";
-
- @Override
- protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
- {
- String zip = getZipCode(renderRequest);
-
- String query = getQueryString(zip);
-
- URL url = new URL(query);
-
- URLConnection connection = url.openConnection();
- connection.setRequestProperty("User-Agent", "Mozilla/5.0");
-
- BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
- String html = new String(getBytes(in, 16384), "UTF-8");
- in.close();
-
- String beg = "<div class=e>";
- String end = "</table>";
- int begIndex = html.indexOf(beg);
- if (begIndex != -1)
- {
- // extract table containing specific first result
- int endIndex = html.indexOf(end, begIndex);
- html = html.substring(begIndex + beg.length(), endIndex + end.length());
-
- html = postProcessHTML(html);
-
- renderResponse.setContentType("text/html");
- PrintWriter printWriter = renderResponse.getWriter();
- printWriter.print(html);
- }
- }
-
- protected String getZipCode(RenderRequest renderRequest)
- {
- String zip = renderRequest.getParameter(ZIP);
- if (zip == null)
- {
- zip = renderRequest.getPreferences().getValue(ZIP, SAN_FRAN);
- }
- return zip;
- }
-
- @Override
- protected void doEdit(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
- {
- renderResponse.setContentType("text/html");
- renderResponse.getWriter().print(
- "<div align='center'>\n" +
- " <br/>\n" +
- " <font class='portlet-font'>Change Location:</font>\n" +
- "\n" +
- " <form method='post' action='" + renderResponse.createActionURL() + "'\n" +
- " <font class='portlet-font'>Zip Code:</font><br/>\n" +
- " <input class='portlet-form-input-field' type='text' value='' size='12' name='" + ZIP + "'/>\n" +
- " <br/>\n" +
- " <input class='portlet-form-input-field' type='submit' name='submit' value='submit'>\n" +
- " </form>\n" +
- "</div>");
- }
-
- @Override
- public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException
- {
- String zip = actionRequest.getParameter(ZIP);
-
- if (null != zip)
- {
- PortletPreferences prefs = actionRequest.getPreferences();
- prefs.setValue(ZIP, zip);
- prefs.store();
- }
-
- // set zip as render parameter
- actionResponse.setRenderParameter(ZIP, zip);
-
- // request view
- actionResponse.setPortletMode(PortletMode.VIEW);
- }
-
- protected String postProcessHTML(String html)
- {
- // links should open in new windows
- html = html.replaceAll(A, A_TARGET_BLANK);
-
- // src attributes should be absolute
- html = html.replaceAll("src=/", "src=http://google.com/");
- html = html.replaceAll("src=\"/", "src=\"http://google.com/");
-
- // forms should open in new windows and have an absolute action URL
- html = html.replaceAll("action=\"/", "target='_blank' action=\"http://google.com/");
-
- return html;
- }
-
- protected String getQueryString(String zip)
- {
- return GOOGLE + zip;
- }
-
- private byte[] getBytes(InputStream in, int bufferSize) throws IOException, IllegalArgumentException
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- byte[] buffer = new byte[bufferSize];
- while (true)
- {
- int i = in.read(buffer);
- if (i == 0)
- {
- continue;
- }
- if (i == -1)
- {
- break;
- }
- out.write(buffer, 0, i);
- }
- return out.toByteArray();
- }
-
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/GoogleWeatherClippingPortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -1,55 +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.simple.samples;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class GoogleWeatherClippingPortlet extends GoogleClippingPortlet
-{
- private final static String WEATHER_URL = "http://www.google.com/search?q=weather+";
- private static final String A_END = "</a>";
-
- protected String getQueryString(String zip)
- {
- return WEATHER_URL + zip;
- }
-
- protected String postProcessHTML(String html)
- {
- int begIndex;
- int endIndex;
-
- // remove add to iGoogle link
- begIndex = html.indexOf(A);
- if (begIndex != -1)
- {
- endIndex = html.indexOf(A_END, begIndex);
- html = html.substring(0, begIndex) + html.substring(endIndex + A_END.length());
- }
-
- return super.postProcessHTML(html);
- }
-}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java 2008-02-10 01:17:56 UTC (rev 9912)
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2008, Your Corporation. All Rights Reserved.
- */
-
-package org.jboss.portal.simple.samples;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.ResourceRequest;
-import javax.portlet.ResourceResponse;
-import javax.portlet.ResourceURL;
-import javax.portlet.WindowState;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class RemoteControlResourcePortlet extends GenericPortlet
-{
- private static final String ZIPCODE = "zipcode";
-
- @Override
- protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
- {
- renderResponse.setContentType("text/html");
- PrintWriter printWriter = renderResponse.getWriter();
- printWriter.print("<script type='text/javascript'>function openRemote(url){window.name='jbp_parent';" +
- "window.open(url, 'jbp_remote', 'width=400,height=200,scrollable=yes')}</script>");
- printWriter.print("<p><a href='#' onclick=\"openRemote('");
- ResourceURL resource = renderResponse.createResourceURL();
- printWriter.print(resource);
- printWriter.print("')\">Open remote control!</a></p>");
- }
-
- @Override
- public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws PortletException, IOException
- {
- resourceResponse.setContentType("text/html");
- PrintWriter writer = resourceResponse.getWriter();
- writer.print("<script type='text/javascript'>function openLinkInParent(url){window.open(url,'jbp_parent');}</script>");
- PortletURL url = resourceResponse.createRenderURL();
- url.setWindowState(WindowState.MINIMIZED);
- writer.print("<ul><li><a href='#' onclick=\"" + createParentURL(url) + "\">minimize parent portlet</a></li>");
- url.setWindowState(WindowState.MAXIMIZED);
- writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">maximize parent portlet</a></li>");
- url.setWindowState(WindowState.NORMAL);
- writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">make parent portlet normal</a></li></ul>");
- writer.print("<p><b>'zipcode'</b> public render parameter value: " + resourceRequest.getParameter(ZIPCODE) + "<br/>");
- writer.print("Set value of <b>'zipcode'</b> public render parameter to:</p>");
- url.setParameter(ZIPCODE, "80201");
- writer.print("<ul><li><a href='#' onclick=\"" + createParentURL(url) + "\">Denver</a>");
- url.setParameter(ZIPCODE, "94102");
- writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">San Francisco</a>");
- url.setParameter(ZIPCODE, "20001");
- writer.print("<li><a href='#' onclick=\"" + createParentURL(url) + "\">Washington, DC</a>");
- writer.print("</ul>");
- }
-
- private String createParentURL(PortletURL url)
- {
- return "openLinkInParent('" + url + "')";
- }
-}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-10 01:17:56 UTC (rev 9912)
@@ -755,46 +755,48 @@
</target>
<target name="package-demo-portlets" depends="prepare_env">
- <copy todir="${test.temp.dir}/google-map-portlet-war">
- <fileset dir="src/test/resources/google-map-portlet-war"/>
- <fileset dir="${target}/classes" includes="org/jboss/portal/simple/samples/GoogleClippingPortlet.class"/>
+
+ <mkdir dir="${test.temp.dir}/portal"/>
+ <mkdir dir="${test.temp.dir}/portal/samples"/>
+ <mkdir dir="${target}/portal"/>
+
+ <copy todir="${test.temp.dir}/portal/samples-google-map-portlet-war">
+ <fileset dir="src/test/resources/portal/samples/google-map-portlet-war"/>
+ <fileset dir="${target}/classes" includes="org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.class"/>
</copy>
- <jar jarfile="${target}/google-map-portlet.war">
- <fileset dir="${test.temp.dir}/google-map-portlet-war"/>
+ <jar jarfile="${target}/portal/samples-google-map-portlet.war">
+ <fileset dir="${test.temp.dir}/portal/samples-google-map-portlet-war"/>
</jar>
- <copy todir="${test.temp.dir}/google-weather-portlet-war">
- <fileset dir="src/test/resources/google-weather-portlet-war"/>
- <fileset dir="${target}/classes" includes="org/jboss/portal/simple/samples/*.class"/>
+ <copy todir="${test.temp.dir}/portal/samples-google-weather-portlet-war">
+ <fileset dir="src/test/resources/portal/samples/google-weather-portlet-war"/>
+ <fileset dir="${target}/classes" includes="org/jboss/portal/portlet/portal/samples/*.class"/>
</copy>
- <jar jarfile="${target}/google-weather-portlet.war">
- <fileset dir="${test.temp.dir}/google-weather-portlet-war"/>
+ <jar jarfile="${target}/portal/samples-google-weather-portlet.war">
+ <fileset dir="${test.temp.dir}/portal/samples-google-weather-portlet-war"/>
</jar>
- <copy todir="${test.temp.dir}/remotecontrol-portlet-war">
- <fileset dir="src/test/resources/remotecontrol-portlet-war"/>
+ <copy todir="${test.temp.dir}/portal/samples-remotecontrol-portlet-war">
+ <fileset dir="src/test/resources/portal/samples/remotecontrol-portlet-war"/>
<fileset dir="${target}/classes"
- includes="org/jboss/portal/simple/samples/RemoteControlResourcePortlet.class"/>
+ includes="org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.class"/>
</copy>
- <jar jarfile="${target}/remotecontrol-portlet.war">
- <fileset dir="${test.temp.dir}/remotecontrol-portlet-war"/>
+ <jar jarfile="${target}/portal/samples-remotecontrol-portlet.war">
+ <fileset dir="${test.temp.dir}/portal/samples-remotecontrol-portlet-war"/>
</jar>
- <copy todir="${test.temp.dir}/cart-event-portlet-war">
- <fileset dir="src/test/resources/cart-event-portlet-war"/>
- <fileset dir="${target}/classes" includes="org/jboss/portal/simple/samples/event/*.class"/>
+ <copy todir="${test.temp.dir}/portal/samples-cart-event-portlet-war">
+ <fileset dir="src/test/resources/portal/samples/cart-event-portlet-war"/>
+ <fileset dir="${target}/classes" includes="org/jboss/portal/portlet/portal/samples/event/*.class"/>
</copy>
- <jar jarfile="${target}/cart-event-portlet.war">
- <fileset dir="${test.temp.dir}/cart-event-portlet-war"/>
+ <jar jarfile="${target}/portal/samples-cart-event-portlet.war">
+ <fileset dir="${test.temp.dir}/portal/samples-cart-event-portlet-war"/>
</jar>
- <mkdir dir="${test.temp.dir}/portal"/>
- <mkdir dir="${test.temp.dir}/portal/samples"/>
<copy todir="${test.temp.dir}/portal/samples-basic-war">
<fileset dir="src/test/resources/portal/samples/basic-war"/>
<fileset dir="${target}/classes" includes="org/jboss/portal/portlet/portal/samples/basic/**"/>
</copy>
- <mkdir dir="${target}/portal"/>
<jar jarfile="${target}/portal/samples-basic.war">
<fileset dir="${test.temp.dir}/portal/samples-basic-war"/>
</jar>
Copied: modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war (from rev 9905, modules/portlet/trunk/test/src/test/resources/cart-event-portlet-war)
Copied: modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war/WEB-INF (from rev 9911, modules/portlet/trunk/test/src/test/resources/cart-event-portlet-war/WEB-INF)
Modified: modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/cart-event-portlet-war/WEB-INF/portlet.xml 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war/WEB-INF/portlet.xml 2008-02-10 01:17:56 UTC (rev 9912)
@@ -30,7 +30,7 @@
<description>Catalog Portlet</description>
<portlet-name>Catalog</portlet-name>
<display-name>Catalog Portlet</display-name>
- <portlet-class>org.jboss.portal.simple.samples.event.CatalogPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.portlet.portal.samples.event.CatalogPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -48,7 +48,7 @@
<description>Cart Portlet</description>
<portlet-name>Cart</portlet-name>
<display-name>Cart Portlet</display-name>
- <portlet-class>org.jboss.portal.simple.samples.event.CartPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.portlet.portal.samples.event.CartPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -64,7 +64,7 @@
<event-definition>
<qname xmlns:jbp='urn:jboss:portal:samples:event'>jbp:CartEvent</qname>
- <value-type>org.jboss.portal.simple.samples.event.CartEvent</value-type>
+ <value-type>org.jboss.portal.portlet.portal.samples.event.CartEvent</value-type>
</event-definition>
</portlet-app>
Copied: modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war (from rev 9905, modules/portlet/trunk/test/src/test/resources/google-map-portlet-war)
Copied: modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war/WEB-INF (from rev 9911, modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF)
Modified: modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war/WEB-INF/portlet.xml 2008-02-10 01:17:56 UTC (rev 9912)
@@ -29,7 +29,7 @@
<description>Portlet displaying a location on Google Maps</description>
<portlet-name>GoogleMap</portlet-name>
<display-name>Google Map Portlet</display-name>
- <portlet-class>org.jboss.portal.simple.samples.GoogleClippingPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.portlet.portal.samples.GoogleClippingPortlet</portlet-class>
<expiration-cache>120</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
Copied: modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war (from rev 9905, modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war)
Copied: modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war/WEB-INF (from rev 9911, modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF)
Modified: modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war/WEB-INF/portlet.xml 2008-02-10 01:17:56 UTC (rev 9912)
@@ -29,7 +29,7 @@
<description>Portlet displaying the weather forecast for the specified location</description>
<portlet-name>GoogleWeather</portlet-name>
<display-name>Google Weather Portlet</display-name>
- <portlet-class>org.jboss.portal.simple.samples.GoogleWeatherClippingPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.portlet.portal.samples.GoogleWeatherClippingPortlet</portlet-class>
<expiration-cache>120</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
Copied: modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war (from rev 9905, modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war)
Copied: modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war/WEB-INF (from rev 9911, modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF)
Modified: modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/portlet.xml 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war/WEB-INF/portlet.xml 2008-02-10 01:17:56 UTC (rev 9912)
@@ -29,7 +29,7 @@
<description>Portlet controlling display of other portlets</description>
<portlet-name>RemoteControl</portlet-name>
<display-name>Remote Control Resource Portlet</display-name>
- <portlet-class>org.jboss.portal.simple.samples.RemoteControlResourcePortlet</portlet-class>
+ <portlet-class>org.jboss.portal.portlet.portal.samples.RemoteControlResourcePortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo.jsp 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo.jsp 2008-02-10 01:17:56 UTC (rev 9912)
@@ -10,15 +10,15 @@
<portal:pageparam namespaceURI="urn:jboss:portal:simple:google" localName="zipcode" value="80201"/>
<jbp:layout1>
<jsp:attribute name="leftcol">
- <jbp:portlet name="RemoteControl" applicationName="remotecontrol-portlet"/>
+ <jbp:portlet name="RemoteControl" applicationName="samples-remotecontrol-portlet"/>
<jbp:portlet name="Foo" applicationName="bar"/>
<jbp:portlet name="ExceptionPortlet" applicationName="samples-basic"/>
- <jbp:portlet name="Cart" applicationName="cart-event-portlet"/>
+ <jbp:portlet name="Cart" applicationName="samples-cart-event-portlet"/>
</jsp:attribute>
<jsp:attribute name="rightcol">
- <jbp:portlet name="GoogleMap" applicationName="google-map-portlet"/>
- <jbp:portlet name="GoogleWeather" applicationName="google-weather-portlet"/>
- <jbp:portlet name="Catalog" applicationName="cart-event-portlet"/>
+ <jbp:portlet name="GoogleMap" applicationName="samples-google-map-portlet"/>
+ <jbp:portlet name="GoogleWeather" applicationName="samples-google-weather-portlet"/>
+ <jbp:portlet name="Catalog" applicationName="samples-cart-event-portlet"/>
</jsp:attribute>
</jbp:layout1>
</portal:page>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo1.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo1.jsp 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo1.jsp 2008-02-10 01:17:56 UTC (rev 9912)
@@ -10,10 +10,10 @@
<portal:pageparam namespaceURI="urn:jboss:portal:simple:google" localName="zipcode" value="80201"/>
<jbp:layout1>
<jsp:attribute name="leftcol">
- <jbp:portlet name="Cart" applicationName="cart-event-portlet"/>
+ <jbp:portlet name="Cart" applicationName="samples-cart-event-portlet"/>
</jsp:attribute>
<jsp:attribute name="rightcol">
- <jbp:portlet name="Catalog" applicationName="cart-event-portlet"/>
+ <jbp:portlet name="Catalog" applicationName="samples-cart-event-portlet"/>
</jsp:attribute>
</jbp:layout1>
</portal:page>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp 2008-02-09 20:42:01 UTC (rev 9911)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp 2008-02-10 01:17:56 UTC (rev 9912)
@@ -10,13 +10,13 @@
<portal:pageparam namespaceURI="urn:jboss:portal:simple:google" localName="zipcode" value="80201"/>
<jbp:layout1>
<jsp:attribute name="leftcol">
- <jbp:portlet name="RemoteControl" applicationName="remotecontrol-portlet"/>
+ <jbp:portlet name="RemoteControl" applicationName="samples-remotecontrol-portlet"/>
</jsp:attribute>
<jsp:attribute name="rightcol">
- <jbp:portlet name="GoogleMap" applicationName="google-map-portlet"/>
- <jbp:portlet name="GoogleWeather" applicationName="google-weather-portlet"/>
+ <jbp:portlet name="GoogleMap" applicationName="samples-google-map-portlet"/>
+ <jbp:portlet name="GoogleWeather" applicationName="samples-google-weather-portlet"/>
</jsp:attribute>
</jbp:layout1>
16 years, 5 months
JBoss Portal SVN: r9911 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-02-09 15:42:01 -0500 (Sat, 09 Feb 2008)
New Revision: 9911
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CartPortlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CatalogPortlet.java
Log:
- Minor cosmetic changes.
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CartPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CartPortlet.java 2008-02-09 20:41:37 UTC (rev 9910)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CartPortlet.java 2008-02-09 20:42:01 UTC (rev 9911)
@@ -52,7 +52,7 @@
if (!items.isEmpty())
{
- writer.append("<table><thead><tr><th>Description</th><th>Price</th></tr></thead><tbody>");
+ writer.append("<table width='95%'><thead><tr align='left'><th width='66%'>Description</th><th align='right'>Price</th></tr></thead><tbody>");
int total = 0;
for (CatalogItem item : items)
{
@@ -61,7 +61,8 @@
writer.append("<tr><td>").append(item.getDescription()).append("</td><td align='right'>$").append("" + price)
.append("</td></tr>");
}
- writer.append("<tr><td colspan='2' align='right'>").append("$" + total).append("</td></tr></tbody></table>");
+ writer.append("<tr><td><b>Total:</b></td><td align='right' style='border-top: 2px solid #000;'>")
+ .append("$" + total).append("</td></tr></tbody></table>");
}
else
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CatalogPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CatalogPortlet.java 2008-02-09 20:41:37 UTC (rev 9910)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/event/CatalogPortlet.java 2008-02-09 20:42:01 UTC (rev 9911)
@@ -46,7 +46,7 @@
renderResponse.setContentType("text/html");
Writer writer = renderResponse.getWriter();
- writer.append("<table><thead><tr><th>Description</th><th>Price</th><th>Actions</th></tr></thead><tbody>");
+ writer.append("<table width='95%'><thead><tr align='left'><th width='50%'>Description</th><th width='25%'>Price</th><th>Actions</th></tr></thead><tbody>");
PortletURL addURL = renderResponse.createActionURL();
addURL.setParameter("op", "add");
16 years, 5 months
JBoss Portal SVN: r9910 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-02-09 15:41:37 -0500 (Sat, 09 Feb 2008)
New Revision: 9910
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
Log:
- Removed output to sysout.
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-02-09 17:34:08 UTC (rev 9909)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-02-09 20:41:37 UTC (rev 9910)
@@ -45,7 +45,6 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.namespace.QName;
import java.io.Serializable;
-import java.lang.annotation.Annotation;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
@@ -283,10 +282,6 @@
// Check jaxb annotation
if (requiresJAXBAnnotation(valueType))
{
- for (Annotation a : valueType.getAnnotations())
- {
- System.out.println("a = " + a);
- }
boolean b = valueType.isAnnotationPresent(XmlRootElement.class);
if (!b)
{
16 years, 5 months