Author: julien(a)jboss.com
Date: 2007-06-26 09:40:06 -0400 (Tue, 26 Jun 2007)
New Revision: 7549
Added:
trunk/core-samples/src/bin/portal-basic-samples-war/
trunk/core-samples/src/bin/portal-basic-samples-war/images/
trunk/core-samples/src/bin/portal-basic-samples-war/portlet-styles/
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java
trunk/core-samples/src/resources/portal-basic-samples-sar/
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/
trunk/core-samples/src/resources/portal-basic-samples-war/
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/
trunk/core-samples/src/resources/portal-basic-samples-war/dir1/
trunk/core-samples/src/resources/portal-basic-samples-war/dir2/
Removed:
trunk/core-samples/src/bin/portal-basic-samples-war/images/
trunk/core-samples/src/bin/portal-basic-samples-war/portlet-styles/
trunk/core-samples/src/bin/portal-samples-war/
trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/
trunk/core-samples/src/resources/portal-basic-samples-war/dir1/
trunk/core-samples/src/resources/portal-basic-samples-war/dir2/
trunk/core-samples/src/resources/portal-samples-sar/
trunk/core-samples/src/resources/portal-samples-war/
Modified:
trunk/core-samples/build.xml
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
Log:
renamed samples to basic-samples (need to remove the non basic sample in a separate
package after that)
Modified: trunk/core-samples/build.xml
===================================================================
--- trunk/core-samples/build.xml 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/build.xml 2007-06-26 13:40:06 UTC (rev 7549)
@@ -192,42 +192,42 @@
<mkdir dir="${build.lib}"/>
<!-- portal-core-samples-lib.jar -->
- <jar jarfile="${build.lib}/portal-core-samples-lib.jar">
+ <jar jarfile="${build.lib}/portal-basic-samples-lib.jar">
<fileset dir="${build.classes}">
</fileset>
</jar>
<!-- portal-samples.sar -->
- <copy todir="${build.resources}/portal-samples">
- <fileset dir="${build.resources}/portal-samples-sar"/>
+ <copy todir="${build.resources}/portal-basic-samples">
+ <fileset dir="${build.resources}/portal-basic-samples-sar"/>
</copy>
<!-- portal-samples.war -->
- <copy
todir="${build.resources}/portal-samples/portal-samples.war">
- <fileset dir="${source.bin}/portal-samples-war"/>
- <fileset dir="${build.resources}/portal-samples-war"/>
+ <copy
todir="${build.resources}/portal-samples/portal-basic-samples.war">
+ <fileset dir="${source.bin}/portal-basic-samples-war"/>
+ <fileset dir="${build.resources}/portal-basic-samples-war"/>
</copy>
- <!-- hibernate configuration for identity -->
- <copy todir="${build.resources}/portal-samples/lib">
- <fileset dir="${build.lib}"
includes="portal-core-samples-lib.jar"/>
+ <!-- -->
+ <copy todir="${build.resources}/portal-basic-samples/lib">
+ <fileset dir="${build.lib}"
includes="portal-basic-samples-lib.jar"/>
</copy>
</target>
- <!-- Build the portal-samples.sar -->
+ <!-- Build the portal-basic-samples.sar -->
<target name="output" depends="artifacts">
- <copy todir="${build.resources}/portal-samples.sar">
- <fileset dir="${build.resources}/portal-samples"
excludes="**/*.xml"/>
+ <copy todir="${build.resources}/portal-basic-samples.sar">
+ <fileset dir="${build.resources}/portal-basic-samples"
excludes="**/*.xml"/>
</copy>
- <copy todir="${build.resources}/portal-samples.sar">
+ <copy todir="${build.resources}/portal-basic-samples.sar">
<filterset>
<filtersfile file="../build/etc/single.properties"/>
</filterset>
- <fileset dir="${build.resources}/portal-samples"
includes="**/*.xml"/>
+ <fileset dir="${build.resources}/portal-basic-samples"
includes="**/*.xml"/>
</copy>
<implode
- dir="${build.resources}/portal-samples.sar"
- tofile="${build.lib}/portal-samples.sar"/>
+ dir="${build.resources}/portal-basic-samples.sar"
+ tofile="${build.lib}/portal-basic-samples.sar"/>
</target>
<!-- create artifacts for running the portlet tests (except TCK) target output
should have already been executed -->
Copied: trunk/core-samples/src/bin/portal-basic-samples-war (from rev 7535,
trunk/core-samples/src/bin/portal-samples-war)
Copied: trunk/core-samples/src/bin/portal-basic-samples-war/images (from rev 7548,
trunk/core-samples/src/bin/portal-samples-war/images)
Copied: trunk/core-samples/src/bin/portal-basic-samples-war/portlet-styles (from rev 7548,
trunk/core-samples/src/bin/portal-samples-war/portlet-styles)
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,149 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class BasicPortlet implements Portlet
+{
+
+ private PortletConfig config;
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ this.config = config;
+ }
+
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ for (Iterator i = request.getParameterMap().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ String[] values = (String[])entry.getValue();
+ response.setRenderParameter(name + " from action", values);
+ }
+ response.setWindowState(request.getWindowState());
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+
+ //
+ writer.write("window state : " + request.getWindowState());
+
writer.write("<table><th><td>name</td><td>value</td></th>");
+ for (Iterator i = request.getParameterMap().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ String[] values = (String[])entry.getValue();
+ writer.write("<tr><td>" + name +
"</td><td>" + values[0] + "</td></tr>");
+ }
+ writer.write("</table>");
+
+ //
+ PortletURL renderURL = response.createRenderURL();
+ writeLink(writer, renderURL, "empty");
+
+ //
+ renderURL.setParameter("foo", "bar");
+ writeLink(writer, renderURL, "foo=bar");
+
+ //
+ renderURL.setWindowState(WindowState.MAXIMIZED);
+ writeLink(writer, renderURL, "maximized,foo=bar");
+
+ //
+ renderURL = response.createRenderURL();
+ renderURL.setWindowState(WindowState.MAXIMIZED);
+ writeLink(writer, renderURL, "maximized");
+
+ //
+ renderURL = response.createRenderURL();
+ renderURL.setWindowState(WindowState.NORMAL);
+ writeLink(writer, renderURL, "normal");
+
+ //
+ renderURL.setWindowState(WindowState.NORMAL);
+ renderURL.setParameter("foo", "bar");
+ writeLink(writer, renderURL, "normal,foo=bar");
+
+ PortletURL actionURL = response.createActionURL();
+ writeLink(writer, actionURL, "empty");
+
+ //
+ actionURL.setParameter("foo", "bar");
+ writeLink(writer, actionURL, "foo=bar");
+
+ //
+ actionURL.setWindowState(WindowState.MAXIMIZED);
+ writeLink(writer, actionURL, "maximized,foo=bar");
+
+ //
+ actionURL = response.createRenderURL();
+ actionURL.setWindowState(WindowState.MAXIMIZED);
+ writeLink(writer, actionURL, "maximized");
+
+ //
+ actionURL = response.createRenderURL();
+ actionURL.setWindowState(WindowState.NORMAL);
+ writeLink(writer, actionURL, "normal");
+
+ //
+ actionURL.setWindowState(WindowState.NORMAL);
+ actionURL.setParameter("foo", "bar");
+ writeLink(writer, actionURL, "normal,foo=bar");
+
+ //
+ writer.close();
+ }
+
+ private void writeLink(PrintWriter writer, PortletURL url, String label)
+ {
+ writer.print("<div><a href=\"" + url +
"\">" + label + "</a></div>");
+ }
+
+ public void destroy()
+ {
+ this.config = null;
+ }
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java (from
rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,281 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.format.util.EntityTable;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * This portlet is used to display a form that helps to test the charset handling by the
portal and the client. When a
+ * fault occurs it may be the client fault (for instance the char with unicode value 160
fail the test in firefox but
+ * succeds in IE6).
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class CharsetPortlet extends GenericPortlet
+{
+
+ private static final Logger log = Logger.getLogger(CharsetPortlet.class);
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ String fromString = req.getParameter("from");
+ String toString = req.getParameter("to");
+ int from;
+ int to;
+ try
+ {
+ from = Integer.parseInt(fromString);
+ to = Integer.parseInt(toString);
+ }
+ catch (NumberFormatException ignore)
+ {
+ from = 65;
+ to = 256;
+ }
+ resp.setRenderParameter("from", "" + from);
+ resp.setRenderParameter("to", "" + to);
+
+ //
+ String text = req.getParameter("text");
+ if (text != null)
+ {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = from; i < to; i++)
+ {
+ char c = (char)i;
+ if (useChar(c))
+ {
+ buffer.append(c);
+ }
+ }
+ String expectedText = buffer.toString();
+ boolean same = expectedText.equals(text);
+ if (!same)
+ {
+ log.error("The input does not match the expected string");
+ log.error("Expected string " + expectedText);
+ log.error("Received string " + text);
+ }
+ resp.setRenderParameter("same", "" + same);
+ }
+ }
+
+
+ protected void doHelp(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.print("This portlet shows different ways to properly display and submit
unicode text");
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ String sameString = req.getParameter("same");
+ Boolean same = null;
+ if ("true".equalsIgnoreCase(sameString))
+ {
+ same = Boolean.TRUE;
+ }
+ else if ("false".equalsIgnoreCase(sameString))
+ {
+ same = Boolean.FALSE;
+ }
+
+ //
+ String fromString = req.getParameter("from");
+ String toString = req.getParameter("to");
+ int from = 65;
+ int to = 256;
+ try
+ {
+ from = Integer.parseInt(fromString);
+ to = from + 16;
+ to = Integer.parseInt(toString);
+ }
+ catch (NumberFormatException ignore)
+ {
+ //
+ }
+
+ //
+ if (to <= from)
+ {
+ to = from + 16;
+ }
+
+ //
+ StringBuffer escapedText = new StringBuffer();
+ StringBuffer text = new StringBuffer();
+ for (int i = from; i < to; i++)
+ {
+ char c = (char)i;
+ if (useChar(c))
+ {
+ text.append(c);
+ String s = EntityTable.FULL.lookup(c);
+ if (s == null)
+ {
+ escapedText.append(c);
+ }
+ else
+ {
+ escapedText.append("&").append(s).append(";");
+ }
+ }
+ }
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.println("<div style=\"border-top:solid 1px\">Testing
range:</div>");
+ writer.print(
+ "<div>" +
+ "<form action=\"" + resp.createActionURL() + "\"
method=\"post\"\">" +
+ "<input type=\"text\" name=\"from\" value=\""
+ from + "\"/>" +
+ "<input type=\"text\" name=\"to\" value=\"" +
to + "\"/>" +
+ "<input type=\"submit\" value=\"change\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ writer.println("<div style=\"border-top:solid 1px\">Test
processAction() with a textarea field:</div>");
+ writer.println(
+ "<div>" +
+ "<form action=\"" + resp.createActionURL() + "\"
accept-charset=\"" + resp.getCharacterEncoding() + "\"
method=\"post\">" +
+ "<input type=\"hidden\" name=\"from\"
value=\"" + from + "\"/>" +
+ "<input type=\"hidden\" name=\"to\" value=\""
+ to + "\"/>" +
+ "<textarea name=\"text\" cols=\"20\"
rows=\"10\" wrap=\"virtual\">" + escapedText +
"</textarea>" +
+ "<input type=\"submit\" value=\"check\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ writer.println("<div style=\"border-top:solid 1px\">Test
processAction() with a text field:</div>");
+ writer.println(
+ "<div>" +
+ "<form action=\"" + resp.createActionURL() + "\"
accept-charset=\"" + resp.getCharacterEncoding() + "\"
method=\"post\">" +
+ "<input type=\"hidden\" name=\"from\"
value=\"" + from + "\"/>" +
+ "<input type=\"hidden\" name=\"to\" value=\""
+ to + "\"/>" +
+ "<input type=\"text\" name=\"text\" value=\""
+ escapedText + "\"/>" +
+ "<input type=\"submit\" value=\"check\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ PortletURL url = resp.createActionURL();
+ url.setParameter("text", text.toString());
+ writer.println("<div style=\"border-top:solid 1px\">Test
processAction() with a portlet parameter:</div>");
+ writer.println(
+ "<div>" +
+ "<form action=\"" + url + "\"
accept-charset=\"" + resp.getCharacterEncoding() + "\"
method=\"post\">" +
+ "<input type=\"hidden\" name=\"from\"
value=\"" + from + "\"/>" +
+ "<input type=\"hidden\" name=\"to\" value=\""
+ to + "\"/>" +
+ "<input type=\"submit\" value=\"check\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ PortletURL url2 = resp.createActionURL();
+ url2.setParameter("text", text.toString());
+ url2.setParameter("from", "" + from);
+ url2.setParameter("to", "" + to);
+ writer.println("<div style=\"border-top:solid 1px\"><a
href=\"" + url2 + "\">Test</a> processAction() with a portlet
parameter:</div>");
+
+ //
+ if (same != null)
+ {
+ writer.print("<div
style=\"color:red;margin-top:2em;margin-bottom:2em\">Test result: ");
+ if (same == Boolean.TRUE)
+ {
+ writer.print("The input matched the expected result");
+ }
+ else if (same == Boolean.FALSE)
+ {
+ writer.print("The input did not matched the expected result");
+ }
+ writer.print("</div>");
+ }
+
+ //
+ writer.close();
+ }
+
+ public static boolean useChar(char c)
+ {
+ switch (Character.getType(c))
+ {
+ case Character.LOWERCASE_LETTER: // Ll
+ case Character.UPPERCASE_LETTER: // Lu
+ case Character.TITLECASE_LETTER: // Lt
+ case Character.MODIFIER_LETTER: // Lm
+ case Character.OTHER_LETTER: // Lo
+ case Character.NON_SPACING_MARK: // Mn
+ case Character.ENCLOSING_MARK: // Me
+ case Character.COMBINING_SPACING_MARK: // Mc
+ case Character.DECIMAL_DIGIT_NUMBER: // Nd
+ case Character.LETTER_NUMBER: // Nl
+ case Character.OTHER_NUMBER: // No
+ case Character.SPACE_SEPARATOR: // Zs
+ case Character.LINE_SEPARATOR: // Zl
+ case Character.PARAGRAPH_SEPARATOR: // Zp
+ case Character.DASH_PUNCTUATION: // Pd
+ case Character.START_PUNCTUATION: // Ps
+ case Character.END_PUNCTUATION: // Pe
+ case Character.CONNECTOR_PUNCTUATION: // Pc
+ case Character.OTHER_PUNCTUATION: // Po
+ case Character.INITIAL_QUOTE_PUNCTUATION: // Pi
+ case Character.FINAL_QUOTE_PUNCTUATION: // Pf
+ case Character.MATH_SYMBOL: // Sm
+ case Character.CURRENCY_SYMBOL: // Sc
+ case Character.MODIFIER_SYMBOL: // Sk
+ case Character.OTHER_SYMBOL: // So
+ return true;
+ default:
+ case Character.UNASSIGNED: // Cn
+ case Character.CONTROL: // Cc
+ case Character.FORMAT: // Cf
+ case Character.PRIVATE_USE: // Co
+ case Character.SURROGATE: // Cs
+ return false;
+ }
+ }
+
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java (from
rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class CounterPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ PortletSession session = req.getPortletSession();
+ int count = 0;
+ if (session.getAttribute("count") != null)
+ {
+ count = ((Integer)session.getAttribute("count")).intValue() + 1;
+ }
+ session.setAttribute("count", new Integer(count));
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Render
call count</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>" + count + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ writer.write("<div class=\"portlet-section-header\">Render
call count</div>");
+ writer.write("<div><a href=\"" + resp.createActionURL() +
"\">action</a></div");
+ writer.write("<div><a href=\"" + resp.createRenderURL() +
"\">render</a></div");
+
+ //
+ writer.close();
+ }
+
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java (from
rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 5448 $
+ */
+public class EncodingPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ resp.setRenderParameter("text", req.getParameter("text"));
+ req.getPortletSession().setAttribute("text",
req.getParameter("text"));
+
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ String param = req.getParameter("text");
+ String attr = (String)req.getPortletSession().getAttribute("text");
+
+ //
+ writer.print(
+ "<div> Text to pass : " +
+ "<form action=\"" + resp.createRenderURL() + "\"
method=\"post\"\">" +
+ "<input type=\"text\" name=\"text\"
value=\"\"/>" +
+ "<input type=\"submit\" value=\"Submit to render
phase\"/>" +
+ "</form>" +
+ "<form action=\"" + resp.createActionURL() + "\"
method=\"post\"\">" +
+ "<input type=\"text\" name=\"text\"
value=\"\"/>" +
+ "<input type=\"submit\" value=\"Submit to action
phase\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ writer.println(
+ "<div>" + "Text retrieved from request parameter: " +
+ "</div>" +
+ "<div>" +
+ "<textarea name=\"text\" cols=\"20\"
rows=\"4\" wrap=\"virtual\">");
+
+ if (param != null)
+ {
+ writer.println(param);
+ }
+
+ writer.println(
+ "</textarea>" +
+ "</div>");
+
+ writer.println(
+ "<div>" + "Text retrieved from portlet session (value set
during Action Phase): " +
+ "</div>" +
+ "<div>" +
+ "<textarea name=\"text\" cols=\"20\"
rows=\"4\" wrap=\"virtual\">");
+
+ if (attr != null)
+ {
+ writer.println(attr);
+ }
+
+ writer.println(
+ "</textarea>" +
+ "</div>");
+
+ //
+ writer.close();
+ }
+
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class ExceptionPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ throwException(req);
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ throwException(req);
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ PortletURL renderURL = resp.createRenderURL();
+ PortletURL actionURL = resp.createActionURL();
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Throw
:</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ renderURL.setParameter("op", "portletexception");
+ writer.write("<div><a href=\"" + renderURL +
"\">render PortletException</a></div>");
+ renderURL.setParameter("op", "portletsecurityexception");
+ writer.write("<div><a href=\"" + renderURL +
"\">render PortletSecurityException</a></div>");
+ renderURL.setParameter("op", "ioexception");
+ writer.write("<div><a href=\"" + renderURL +
"\">render IOException</a></div>");
+ renderURL.setParameter("op", "runtimeexception");
+ writer.write("<div><a href=\"" + renderURL +
"\">render RuntimeException</a></div>");
+ actionURL.setParameter("op", "error");
+ writer.write("<div><a href=\"" + renderURL +
"\">render Error</a></div>");
+ actionURL.setParameter("op", "portletexception");
+ writer.write("<div><a href=\"" + actionURL +
"\">action PortletException</a></div>");
+ actionURL.setParameter("op", "portletsecurityexception");
+ writer.write("<div><a href=\"" + actionURL +
"\">action PortletSecurityException</a></div>");
+ actionURL.setParameter("op", "ioexception");
+ writer.write("<div><a href=\"" + actionURL +
"\">action IOException</a></div>");
+ actionURL.setParameter("op", "runtimeexception");
+ writer.write("<div><a href=\"" + actionURL +
"\">action RuntimeException</a></div>");
+ actionURL.setParameter("op", "error");
+ writer.write("<div><a href=\"" + actionURL +
"\">action Error</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+ }
+
+ private void throwException(PortletRequest req) throws PortletException, IOException
+ {
+ String op = req.getParameter("op");
+
+ // Throw any required exception
+ if ("portletexception".equals(op))
+ {
+ throw new PortletException();
+ }
+ if ("portletsecurityexception".equals(op))
+ {
+ throw new PortletSecurityException("");
+ }
+ if ("ioexception".equals(op))
+ {
+ throw new IOException();
+ }
+ if ("runtimeexception".equals(op))
+ {
+ throw new RuntimeException();
+ }
+ if ("error".equals(op))
+ {
+ throw new Error();
+ }
+ }
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java
(from rev 7543,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,274 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.io.IOException;
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.nio.channels.FileChannel;
+import java.nio.ByteBuffer;
+
+/**
+ * <p>An example of content driven portlet that display the files located in the
war file. The portlet does not implement
+ * any code to improve performance like caching in order to keep the code easier to
understand. It should not be
+ * used in production for a large scale portal.</p>
+ *
+ * <p>Content URI is defined as the canonical path of the file relative to the war
file context root.</p>
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class FSContentDrivenPortlet extends GenericPortlet
+{
+
+ /** The edit_content mode. */
+ public static final PortletMode EDIT_CONTENT_MODE = new
PortletMode("edit_content");
+
+ /**
+ * Additional dispatch that will call the
<code>doEditContent(RenderRequest,RenderResponse)</code> method.
+ */
+ protected void doDispatch(RenderRequest req, RenderResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
+ {
+ doEditContent(req, resp);
+ }
+ else
+ {
+ super.doDispatch(req, resp);
+ }
+ }
+
+ /**
+ * Implements the edit content functionnality.
+ */
+ protected void doEditContent(RenderRequest req, RenderResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ // Get the uri value optionally provided by the portal
+ String uri = req.getParameter("content.uri");
+
+ // Get the working directory directory
+ File workingDir;
+ if (uri != null)
+ {
+ workingDir = getFile(uri).getParentFile();
+ }
+ else
+ {
+ // Otherwise try to get the current directory we are browsing, if no current dir
exist we use the root
+ String currentDir = req.getParameter("current_dir");
+ if (currentDir == null)
+ {
+ currentDir = "/";
+ }
+ workingDir = getFile(currentDir);
+ }
+
+ // Get the parent path
+ String parentPath = getContentURI(workingDir.getParentFile());
+
+ // Get the children of the selected file, we use a filter to retain only text files
and avoid WEB-INF dir
+ File[] children = workingDir.listFiles(filter);
+
+ // Configure the response
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.print("Directories:<br/>");
+ writer.print("<ul>");
+ PortletURL choseDirURL = resp.createRenderURL();
+ if (parentPath != null)
+ {
+ choseDirURL.setParameter("current_dir", parentPath);
+ writer.print("<li><a href=\"" + choseDirURL +
"\">..</a></li>");
+ }
+ for (int i = 0;i < children.length;i++)
+ {
+ File child = children[i];
+ if (child.isDirectory())
+ {
+ choseDirURL.setParameter("current_dir", getContentURI(child));
+ writer.print("<li><a href=\"" + choseDirURL +
"\">" + child.getName() + "</a></li>");
+ }
+ }
+ writer.print("</ul><br/>");
+
+ //
+ writer.print("Files:<br/>");
+ writer.print("<ul>");
+ PortletURL selectFileURL = resp.createActionURL();
+ selectFileURL.setParameter("content.action.select", "select");
+ for (int i = 0;i < children.length;i++)
+ {
+ File child = children[i];
+ if (child.isFile())
+ {
+ selectFileURL.setParameter("content.uri", getContentURI(child));
+ writer.print("<li><a href=\"" + selectFileURL +
"\">" + child.getName() + "</a></li>");
+ }
+ }
+ writer.print("</ul><br/>");
+
+ //
+ writer.close();
+ }
+
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ // Get the URI provided by the portal
+ String uri = req.getParameter("uri");
+
+ // Configure the response
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ if (uri == null)
+ {
+ writer.print("No selected file");
+ }
+ else
+ {
+ File file = getFile(uri);
+ FileInputStream in = null;
+ try
+ {
+ in = new FileInputStream(file);
+ FileChannel channel = in.getChannel();
+ byte[] bytes = new byte[(int)channel.size()];
+ ByteBuffer buffer = ByteBuffer.wrap(bytes);
+ channel.read(buffer);
+ writer.write(new String(bytes, 0, bytes.length, "UTF8"));
+ }
+ catch (FileNotFoundException e)
+ {
+ writer.print("No such file " + uri);
+ getPortletContext().log("Cannot find file " + uri, e);
+ }
+ finally
+ {
+ if (in != null)
+ {
+ in.close();
+ }
+ }
+ }
+
+ //
+ writer.close();
+ }
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
+ {
+ String contentURI = req.getParameter("content.uri");
+
+ // We just propagate the content URI as a render parameter for the doEditContent
method
+ if (contentURI != null)
+ {
+ resp.setRenderParameter("content.uri", contentURI);
+ }
+ }
+ }
+
+ /**
+ * Return a file from the specified path or null if the file cannot be determined.
+ *
+ * @param contentURI the file path
+ * @return the file or null
+ */
+ protected File getFile(String contentURI) throws IOException
+ {
+ String realPath = getPortletContext().getRealPath(contentURI);
+ if (realPath == null)
+ {
+ throw new IOException("Cannot access war file content");
+ }
+ File file = new File(realPath);
+ if (!file.exists())
+ {
+ throw new IOException("File " + contentURI + " does not
exist");
+ }
+ return file;
+ }
+
+ /**
+ * Return the content uri of the file or null if it cannot be determined.
+ *
+ * @param file the file to get the URI from
+ * @return the URI or null
+ */
+ protected String getContentURI(File file) throws IOException
+ {
+ String rootPath = getPortletContext().getRealPath("/");
+ if (rootPath == null)
+ {
+ throw new IOException("Cannot access war file content");
+ }
+
+ // Make it canonical
+ rootPath = new File(rootPath).getCanonicalPath();
+
+ // Get the portion of the path that is significant for us
+ String filePath = file.getCanonicalPath();
+ return filePath.length() >= rootPath.length() ?
filePath.substring(rootPath.length()) : null;
+ }
+
+ /**
+ * Avoid the WEB-INF directory and list only text files.
+ */
+ private final FileFilter filter = new FileFilter()
+ {
+ public boolean accept(File file)
+ {
+ String name = file.getName();
+ if (file.isDirectory())
+ {
+ return !"WEB-INF".equals(name);
+ }
+ else if (file.isFile())
+ {
+ return name.endsWith(".txt");
+ }
+ else
+ {
+ return false;
+ }
+ }
+ };
+}
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import org.apache.commons.fileupload.portlet.PortletFileUpload;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class FileUploadPortlet extends GenericPortlet
+{
+
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+
+ //
+ List fileNames = new ArrayList();
+ List fileSizes = new ArrayList();
+
+ //
+ try
+ {
+ DiskFileItemFactory factory = new DiskFileItemFactory();
+ PortletFileUpload upload = new PortletFileUpload(factory);
+ List fileItems = upload.parseRequest(req);
+ for (Iterator iterator = fileItems.iterator();iterator.hasNext();)
+ {
+ FileItem item = (FileItem)iterator.next();
+ if (!item.isFormField())
+ {
+ fileNames.add("" + item.getName());
+ fileSizes.add("" + item.getSize());
+ }
+ }
+ }
+ catch (FileUploadException e)
+ {
+ throw new PortletException(e);
+ }
+
+ //
+ resp.setRenderParameter("fileNames", (String[])fileNames.toArray(new
String[fileNames.size()]));
+ resp.setRenderParameter("fileSizes", (String[])fileSizes.toArray(new
String[fileSizes.size()]));
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ //
+ resp.setContentType("text/html");
+
+ //
+ PrintWriter writer = resp.getWriter();
+
+ String[] fileNames = req.getParameterValues("fileNames");
+ String[] fileSizes = req.getParameterValues("fileSizes");
+ if (fileNames != null && fileSizes != null && fileNames.length ==
fileSizes.length)
+ {
+ for (int i = 0;i < fileNames.length;i++)
+ {
+ writer.println("Received file " + fileNames[i] + " with size
" + fileSizes[i] + "<br/>");
+ }
+ }
+
+ //
+ writer.println("<form action=\"" + resp.createActionURL() +
"\" method=\"post\"
enctype=\"multipart/form-data\">");
+ writer.println("<input type=\"file\"
name=\"File\">");
+ writer.println("<input type=\"submit\"
name=\"Upload\">");
+ writer.println("</form>");
+ }
+}
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class FormAutoSubmitPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+
+ //
+ PrintWriter writer = resp.getWriter();
+ PortletURL actionURL = resp.createActionURL();
+ String formId = resp.getNamespace() + "_the_form";
+
+ //
+ writer.write("<form id=\"" + formId + "\"
action=\"" + actionURL + "\">");
+ writer.write("<select onclick=\"document.getElementById('" +
formId + "').submit()\" multiple=\"multiple\">");
+ writer.write("<option>A</option>");
+ writer.write("<option>B</option>");
+ writer.write("<option>C</option>");
+ writer.write("</select>");
+ writer.write("</form>");
+ writer.write("<a href=\"javascript:document.getElementById('"
+ formId + "').submit()\">submit</a>");
+ }
+}
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/*
+ * Portlet to demonstrate the declarative header content feature.
+ * <p>This portlet injects css into the html HEAD tag via
jboss-portlet.xml</p>
+ *
+ * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
+ * @version $Revision: 5448 $
+*/
+
+public class HeaderContentPortlet extends GenericPortlet
+{
+ public void doView(RenderRequest req, RenderResponse res) throws PortletException,
IOException
+ {
+ res.setProperty("HEADER_CONTENT", "<script
type=\"text/javascript\">/* Just to check it is inserted in the headers
*/</script>");
+
+ res.setContentType("text/html");
+ Writer writer = res.getWriter();
+ writer.write("<div id='Introducing-HeaderContent'/>");
+ writer.write("<div class=\"portlet-section-body\"><p
id='rewrite-js'><button id=\"Introducing-HeaderContentInput\"
class=\"portlet-form-button\" type='button'
onClick='injectJS()'>Call injected
javascript</button></p></div>");
+ writer.flush();
+ writer.close();
+ }
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PortletSessionPortlet extends GenericPortlet
+{
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, IOException
+ {
+ String name = req.getParameter("name");
+ String value = req.getParameter("value");
+ boolean portletScope = req.getParameter("portlet") != null;
+ if (name != null && value != null)
+ {
+ req.getPortletSession().setAttribute(name, value, portletScope ?
PortletSession.PORTLET_SCOPE : PortletSession.APPLICATION_SCOPE);
+ }
+ if (req.getParameter("invalidate") != null)
+ {
+ req.getPortletSession().invalidate();
+ }
+ }
+
+ public void render(RenderRequest req, RenderResponse resp) throws PortletException,
IOException
+ {
+ PortletSession session = req.getPortletSession(false);
+ PortletURL purl = resp.createActionURL();
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ if (session == null)
+ {
+ writer.println("No session");
+ }
+ else
+ {
+ writer.println("Session id = " + session.getId());
+ writer.println("<br/>");
+
+ //
+ print(session, PortletSession.PORTLET_SCOPE, writer);
+ writer.println("<br/>");
+
+ //
+ print(session, PortletSession.APPLICATION_SCOPE, writer);
+ writer.println("<br/>");
+
+ }
+
+ //
+ writer.println("<form action=\"" + purl.toString() +
"\" method=\"post\">");
+ writer.println("<input type=\"text\"
name=\"name\"/>");
+ writer.println("<input type=\"text\"
name=\"value\"/>");
+ writer.println("<input type=\"submit\" name=\"portlet\"
value=\"Add to portlet scope\"/>");
+ writer.println("<input type=\"submit\"
name=\"application\" value=\"Add to application scope\"/>");
+ writer.println("</form><br/>");
+
+ //
+ purl.setParameter("invalidate", "true");
+ writer.println("<a href=\"" + purl.toString() +
"\">invalidate</a><br/>");
+ }
+
+ private void print(PortletSession session, int scope, PrintWriter writer)
+ {
+ writer.println("<table>");
+
writer.println("<tr><td>name</td><td>value</td>");
+ for (Enumeration e = session.getAttributeNames(scope); e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ Object value = session.getAttribute(name, scope);
+ writer.println("<tr><td>" + name +
"</td><td>" + value + "</td>");
+ }
+ writer.println("</table>");
+ }
+
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,237 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import org.jboss.portal.common.transaction.TransactionManagerProvider;
+import org.jboss.portal.core.CoreConstants;
+import org.jboss.portal.identity.User;
+import org.jboss.portlet.JBossActionRequest;
+import org.jboss.portlet.JBossActionResponse;
+import org.jboss.portlet.JBossPortlet;
+import org.jboss.portlet.JBossRenderRequest;
+import org.jboss.portlet.JBossRenderResponse;
+
+import javax.portlet.PortalContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.transaction.Transaction;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5883 $
+ */
+public class TestPortlet extends JBossPortlet
+{
+
+ public void main(JBossActionRequest req, JBossActionResponse resp)
+ {
+ }
+
+ public void addrole(JBossActionRequest req, JBossActionResponse resp)
+ {
+ String role = req.getParameter("role");
+ Set roles = (Set)req.getPortletSession().getAttribute("roles");
+ if (roles == null)
+ {
+ roles = new HashSet();
+ req.getPortletSession().setAttribute("roles", roles);
+ }
+ roles.add(role);
+ }
+
+ public void testaction(JBossActionRequest req, JBossActionResponse resp)
+ {
+ resp.setRenderParameter("name", "value");
+ }
+
+ protected void doView(JBossRenderRequest req, JBossRenderResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ User user = req.getUser();
+ if (user != null)
+ {
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">User
infos</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+
+ //TODO: update this with new Identity API
+ //writer.write("<div>Last visit date : " +
user.getLastVisitDate() + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+ }
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Portlet
security infos</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>RemoteUser : " + req.getRemoteUser() +
"</div>");
+ writer.write("<div>Principal : " + req.getUserPrincipal() +
"</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Portlet
security role test</div>");
+ Set roles = (Set)req.getPortletSession().getAttribute("roles");
+ if (roles != null)
+ {
+ writer.write("<div class=\"portlet-section-body\">");
+ for (Iterator i = roles.iterator(); i.hasNext();)
+ {
+ String role = (String)i.next();
+ writer.write("<div>" + role + " " +
req.isUserInRole(role) + "</div>");
+ }
+ writer.write("</div>");
+ }
+ PortletURL roleURL = resp.createActionURL();
+ roleURL.setParameter("op", "addrole");
+ writer.write("<div>" +
+ "<form action=\"" + roleURL + "\"
method=\"post\">" +
+ "<input class=\"portlet-form-input-field\"
type=\"text\" name=\"role\" value=\"\"/>" +
+ "<input class=\"portlet-form-button\"
type=\"submit\" value=\"add role\"/>" +
+ "</form>" +
+ "</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div
class=\"portlet-section-header\">Capabilities</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>Content type " + req.getResponseContentType() +
"</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ PortletURL url = resp.createRenderURL();
+ url.setSecure(false);
+ String httpURL = url.toString();
+ url.setSecure(true);
+ String httpsURL = url.toString();
+ writer.write("<p>");
+ writer.write("<div
class=\"portlet-section-header\">Secure</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div><a href=\"" + httpURL +
"\">http</a></div>");
+ writer.write("<div><a href=\"" + httpsURL +
"\">https</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ writer.write("<p>");
+ writer.write("<div
class=\"portlet-section-header\">Path</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>portal path info = " +
req.getAttribute("PATH") + "</div>");
+ writer.write("<div>portal path info = " +
req.getParameter("PATH") + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Portal
infos</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ PortalContext portalCtx = req.getPortalContext();
+ writer.write("<div>version : " + portalCtx.getPortalInfo() +
"</div>");
+ for (Enumeration e = portalCtx.getPropertyNames(); e.hasMoreElements();)
+ {
+ String propertyName = (String)e.nextElement();
+ String propertyValue = portalCtx.getProperty(propertyName);
+ writer.write("<div>" + propertyName + " : " +
propertyValue + "</div>");
+ }
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Request
attributes</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ for (Enumeration e = req.getAttributeNames(); e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ Object value = req.getAttribute(name);
+ writer.write("<div>" + name + " : " + value +
"</div>");
+ }
+ writer.write("</div>");
+ writer.write("</p>");
+
+ // User properties
+ Map userInfoMap = (Map)req.getAttribute(PortletRequest.USER_INFO);
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">User
properties</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ if (userInfoMap != null)
+ {
+ for (Iterator i = userInfoMap.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String key = (String)entry.getKey();
+ String value = (String)entry.getValue();
+ writer.write("<div>" + key + " : " + value +
"</div>");
+ }
+ }
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ PortletURL actionURL = resp.createActionURL();
+ actionURL.setParameter("op", "testaction");
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Test
action</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div><a href=\"" + actionURL +
"\">action</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Test
current transaction</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>" + getCurrentTransaction() +
"</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.close();
+ }
+
+ private Transaction getCurrentTransaction()
+ {
+ try
+ {
+ return
TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager().getTransaction();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+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.PrintWriter;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class URLPortlet extends GenericPortlet
+{
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, IOException
+ {
+ for (Enumeration e = req.getParameterNames(); e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ String value = req.getParameter(name);
+ if (!"name".equals(name) && !"value".equals(name))
+ {
+ resp.setRenderParameter(name, value);
+ }
+ }
+ String name = req.getParameter("name");
+ String value = req.getParameter("value");
+ if (name != null && value != null)
+ {
+ resp.setRenderParameter(name, value);
+ }
+ }
+
+ public void render(RenderRequest req, RenderResponse resp) throws PortletException,
IOException
+ {
+ String color = req.getParameter("color");
+ if (color == null)
+ {
+ color = "white";
+ }
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ PortletURL renderURL = resp.createRenderURL();
+
+ //
+ renderURL.setParameter("color", "blue");
+ String blueURL = renderURL.toString();
+
+ //
+ renderURL.setParameter("color", "red");
+ String redURL = renderURL.toString();
+
+ //
+ renderURL.setParameter("color", "white");
+ String whiteURL = renderURL.toString();
+
+ //
+ writer.print("<a href=\"" + blueURL +
"\">blue</a> -");
+ writer.print("<a href=\"" + redURL +
"\">red</a> -");
+ writer.print("<a href=\"" + whiteURL +
"\">white</a><br/>");
+
+ //
+ writer.print("Parameters :<br/>");
+ writer.print("<table bgcolor=\"" + color +
"\">");
+
writer.print("<tr><td>Name</td><td>value</td></tr>");
+ for (Enumeration e = req.getParameterNames(); e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ String value = req.getParameter(name);
+ writer.print("<tr><td>" + name +
"</td><td>" + value + "</td></tr>");
+ }
+ writer.print("</table>");
+
+ //
+ PortletURL actionURL = resp.createActionURL();
+ writer.print("<form action=\"" + actionURL.toString() +
"\" method=\"post\">");
+ writer.print("<input type=\"text\"
name=\"name\"/>");
+ writer.print("<input type=\"text\"
name=\"value\"/>");
+ writer.print("<input type=\"submit\"
value=\"add\"/>");
+ writer.print("</form>");
+
+ //
+ writer.print("<a href=\"" + req.getContextPath() +
"/test.txt\">test</a>");
+
+ //
+ writer.close();
+ }
+}
\ No newline at end of file
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import org.jboss.portal.api.event.PortalEventListener;
+import org.jboss.portal.api.event.PortalEvent;
+import org.jboss.portal.api.event.PortalEventContext;
+import org.jboss.portal.api.session.event.PortalSessionEvent;
+import org.jboss.portal.api.user.event.UserAuthenticationEvent;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalEventListenerLogger implements PortalEventListener
+{
+ public void onEvent(PortalEventContext eventContext, PortalEvent event)
+ {
+ if (event instanceof PortalSessionEvent)
+ {
+ PortalSessionEvent use = (PortalSessionEvent)event;
+ System.out.println(use.getType() == PortalSessionEvent.SESSION_CREATED ?
"session created" : "session destroyed");
+ }
+ else if (event instanceof UserAuthenticationEvent)
+ {
+ UserAuthenticationEvent uae = (UserAuthenticationEvent)event;
+ System.out.println(uae.getType() == UserAuthenticationEvent.SIGN_IN ? "user
login" : "user logout");
+ }
+ else
+ {
+ System.out.println("event = " + event);
+ }
+ }
+}
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java (from
rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PortletA extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.println("<form action=\"" + response.createActionURL() +
"\" method=\"post\">");
+ writer.println("<select name=\"color\">");
+ writer.println("<option>blue</option>");
+ writer.println("<option>red</option>");
+ writer.println("<option>black</option>");
+ writer.println("</select>");
+ writer.println("<input type=\"submit\"/>");
+ writer.println("</form>");
+ writer.close();
+ }
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java (from
rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.event.PortalNodeEvent;
+import org.jboss.portal.api.node.event.PortalNodeEventContext;
+import org.jboss.portal.api.node.event.PortalNodeEventListener;
+import org.jboss.portal.api.node.event.WindowActionEvent;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PortletB extends GenericPortlet
+{
+
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ String color = request.getParameter("color");
+ if (color != null)
+ {
+ response.setRenderParameter("color", color);
+ }
+ }
+
+ protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ String color = request.getParameter("color");
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.println("<div" +
+ (color == null ? "" : " style=\"color:" + color +
";\"") +
+ ">some text in color</div>");
+ writer.close();
+ }
+
+ public static class Listener implements PortalNodeEventListener
+ {
+ public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent
event)
+ {
+ PortalNode node = event.getNode();
+
+ // Get node name
+ String nodeName = node.getName();
+
+ // See if we need to create a new event or not
+ WindowActionEvent newEvent = null;
+ if (nodeName.equals("PortletAWindow") && event instanceof
WindowActionEvent)
+ {
+ // Find window B
+ WindowActionEvent wae = (WindowActionEvent)event;
+ PortalNode windowB = node.resolve("../PortletBWindow");
+ if (windowB != null)
+ {
+ // We can redirect
+ newEvent = new WindowActionEvent(windowB);
+ newEvent.setMode(wae.getMode());
+ newEvent.setWindowState(WindowState.MAXIMIZED);
+ newEvent.setParameters(wae.getParameters());
+ }
+ }
+
+ //
+ if (newEvent != null)
+ {
+ // If we have a new event redirect to it
+ return newEvent;
+ }
+ else
+ {
+ // Otherwise bubble up
+ return context.dispatch();
+ }
+ }
+ }
+}
Property changes on:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import org.jboss.portal.api.event.PortalEvent;
+import org.jboss.portal.api.event.PortalEventContext;
+import org.jboss.portal.api.event.PortalEventListener;
+import org.jboss.portal.api.user.event.UserAuthenticationEvent;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserCounterListener implements PortalEventListener
+{
+
+ /** . */
+ private final SynchronizedLong counter = new SynchronizedLong(0);
+
+ /** . */
+ private final SynchronizedLong counterEver = new SynchronizedLong(0);
+
+ public void onEvent(PortalEventContext eventContext, PortalEvent event)
+ {
+ if (event instanceof UserAuthenticationEvent)
+ {
+ UserAuthenticationEvent userEvent = (UserAuthenticationEvent)event;
+ if (userEvent.getType() == UserAuthenticationEvent.SIGN_IN)
+ {
+ counter.increment();
+ counterEver.increment();
+ }
+ else if (userEvent.getType() == UserAuthenticationEvent.SIGN_OUT)
+ {
+ counter.decrement();
+ }
+ System.out.println("Counter : " + counter.get());
+ System.out.println("Counter ever: " + counterEver.get());
+ }
+ }
+}
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java
(from rev 7535,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -0,0 +1,254 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import org.jboss.portal.api.node.event.PortalNodeEventListener;
+import org.jboss.portal.api.node.event.PortalNodeEvent;
+import org.jboss.portal.api.node.event.PortalNodeEventContext;
+import org.jboss.portal.api.node.event.PageRenderEvent;
+import org.jboss.portal.api.node.event.WindowNavigationEvent;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.navstate.NavigationalStateContext;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.WindowState;
+
+import java.util.Map;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WindowConstraintEventListener implements PortalNodeEventListener
+{
+
+ public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event)
+ {
+ if (event instanceof PageRenderEvent)
+ {
+ PortalNode targetPage = event.getNode();
+ WindowManipulator manipulator = new
WindowManipulator(context.getPortalRuntimeContext().getNavigationalStateContext(),
targetPage);
+
+ // Filter window state for normal and minimized
+ for (Iterator i = manipulator.getRegionNames().iterator();i.hasNext();)
+ {
+ boolean foundNormal = false;
+ PortalNode firstWindow = null;
+ String regionName = (String)i.next();
+ for (Iterator j =
manipulator.getWindows(regionName).iterator();j.hasNext();)
+ {
+ PortalNode window = (PortalNode)j.next();
+
+ // Keep a ref on first window which can be used later
+ if (firstWindow == null)
+ {
+ firstWindow = window;
+ }
+
+ //
+ WindowState ws = manipulator.getWindowState(window);
+ if (WindowState.NORMAL.equals(ws))
+ {
+ if (foundNormal)
+ {
+ manipulator.setWindowState(window, WindowState.MINIMIZED);
+ }
+ else
+ {
+ foundNormal = true;
+ }
+ }
+ else if (WindowState.MINIMIZED.equals(ws))
+ {
+ //
+ }
+ else
+ {
+ manipulator.setWindowState(window, WindowState.MINIMIZED);
+ }
+ }
+
+ //
+ if (foundNormal == false && firstWindow != null)
+ {
+ manipulator.setWindowState(firstWindow, WindowState.NORMAL);
+ }
+ }
+ }
+ else if (event instanceof WindowNavigationEvent)
+ {
+ WindowNavigationEvent wne = (WindowNavigationEvent)event;
+ PortalNode targetWindow = event.getNode();
+ WindowManipulator manipulator = new
WindowManipulator(context.getPortalRuntimeContext().getNavigationalStateContext(),
targetWindow.getParent());
+
+ //
+ WindowState ws = wne.getWindowState();
+
+ //
+ if (WindowState.NORMAL.equals(ws))
+ {
+ String regionName = manipulator.getRegionName(targetWindow);
+ if (regionName != null)
+ {
+ for (Iterator i =
manipulator.getWindows(regionName).iterator();i.hasNext();)
+ {
+ PortalNode currentWindow = (PortalNode)i.next();
+ if (currentWindow.equals(targetWindow))
+ {
+ // Do nothing
+ }
+ else
+ {
+ manipulator.setWindowState(currentWindow, WindowState.MINIMIZED);
+ }
+ }
+ }
+ }
+ else if (WindowState.MINIMIZED.equals(ws))
+ {
+ String regionName = manipulator.getRegionName(targetWindow);
+ if (regionName != null)
+ {
+ // Find the window following the minimized one
+ PortalNode nextWindow = null;
+ for (Iterator i =
manipulator.getWindows(regionName).iterator();i.hasNext();)
+ {
+ PortalNode currentWindow = (PortalNode)i.next();
+
+ // Keep a ref on the first window for later use
+ if (nextWindow == null)
+ {
+ nextWindow = currentWindow;
+ }
+
+ //
+ if (currentWindow.equals(targetWindow))
+ {
+ // Try to get the next window otherwise it means it's the last
window
+ // and we'll use the window we saved at the first iteration
+ if (i.hasNext())
+ {
+ nextWindow = (PortalNode)i.next();
+ }
+
+ //
+ break;
+ }
+ }
+
+ // Normalize the next window
+ if (nextWindow != null)
+ {
+ manipulator.setWindowState(nextWindow, WindowState.NORMAL);
+ }
+ }
+ }
+ }
+ return context.dispatch();
+ }
+
+ public class WindowManipulator
+ {
+
+ /** . */
+ private Map regionMap;
+
+ /** . */
+ private NavigationalStateContext nsContext;
+
+ public WindowManipulator(NavigationalStateContext nsContext, PortalNode parent)
+ {
+ this.nsContext = nsContext;
+
+ // Build appropriate structure
+ regionMap = new HashMap();
+ for (Iterator i = parent.getChildren().iterator();i.hasNext();)
+ {
+ try
+ {
+ PortalNode object = (PortalNode)i.next();
+ if (object.getType() == PortalNode.TYPE_WINDOW)
+ {
+ String region =
(String)object.getProperties().get(ThemeConstants.PORTAL_PROP_REGION);
+ Integer order = new
Integer((String)object.getProperties().get(ThemeConstants.PORTAL_PROP_ORDER));
+
+ //
+ SortedMap windowMap = (SortedMap)regionMap.get(region);
+ if (windowMap == null)
+ {
+ windowMap = new TreeMap();
+ regionMap.put(region, windowMap);
+ }
+ windowMap.put(order, object);
+ }
+ }
+ catch (NumberFormatException ignore)
+ {
+ }
+ }
+ }
+
+ public String getRegionName(PortalNode window)
+ {
+ for (Iterator i = regionMap.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ SortedMap windows = (SortedMap)entry.getValue();
+ for (Iterator j = windows.values().iterator();j.hasNext();)
+ {
+ PortalNode window2 = (PortalNode)j.next();
+ if (window.equals(window2))
+ {
+ return (String)entry.getKey();
+ }
+ }
+ }
+ return null;
+ }
+
+ public Set getRegionNames()
+ {
+ return regionMap.keySet();
+ }
+
+ public Collection getWindows(String regionName)
+ {
+ return ((Map)regionMap.get(regionName)).values();
+ }
+
+ public WindowState getWindowState(PortalNode window)
+ {
+ return nsContext.getWindowState(window);
+ }
+
+ public void setWindowState(PortalNode window, WindowState windowState)
+ {
+ nsContext.setWindowState(window, windowState);
+ }
+ }
+}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.plugins;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.Writer;
-
-/*
- * Portlet to demonstrate the declarative header content feature.
- * <p>This portlet injects css into the html HEAD tag via
jboss-portlet.xml</p>
- *
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision: 5448 $
-*/
-
-public class HeaderContentPortlet extends GenericPortlet
-{
- public void doView(RenderRequest req, RenderResponse res) throws PortletException,
IOException
- {
- res.setProperty("HEADER_CONTENT", "<script
type=\"text/javascript\">/* Just to check it is inserted in the headers
*/</script>");
-
- res.setContentType("text/html");
- Writer writer = res.getWriter();
- writer.write("<div id='Introducing-HeaderContent'/>");
- writer.write("<div class=\"portlet-section-body\"><p
id='rewrite-js'><button id=\"Introducing-HeaderContentInput\"
class=\"portlet-form-button\" type='button'
onClick='injectJS()'>Call injected
javascript</button></p></div>");
- writer.flush();
- writer.close();
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,149 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.WindowState;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class BasicPortlet implements Portlet
-{
-
- private PortletConfig config;
-
- public void init(PortletConfig config) throws PortletException
- {
- this.config = config;
- }
-
- public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
- {
- for (Iterator i = request.getParameterMap().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- String[] values = (String[])entry.getValue();
- response.setRenderParameter(name + " from action", values);
- }
- response.setWindowState(request.getWindowState());
- }
-
- public void render(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
- {
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
-
- //
- writer.write("window state : " + request.getWindowState());
-
writer.write("<table><th><td>name</td><td>value</td></th>");
- for (Iterator i = request.getParameterMap().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- String[] values = (String[])entry.getValue();
- writer.write("<tr><td>" + name +
"</td><td>" + values[0] + "</td></tr>");
- }
- writer.write("</table>");
-
- //
- PortletURL renderURL = response.createRenderURL();
- writeLink(writer, renderURL, "empty");
-
- //
- renderURL.setParameter("foo", "bar");
- writeLink(writer, renderURL, "foo=bar");
-
- //
- renderURL.setWindowState(WindowState.MAXIMIZED);
- writeLink(writer, renderURL, "maximized,foo=bar");
-
- //
- renderURL = response.createRenderURL();
- renderURL.setWindowState(WindowState.MAXIMIZED);
- writeLink(writer, renderURL, "maximized");
-
- //
- renderURL = response.createRenderURL();
- renderURL.setWindowState(WindowState.NORMAL);
- writeLink(writer, renderURL, "normal");
-
- //
- renderURL.setWindowState(WindowState.NORMAL);
- renderURL.setParameter("foo", "bar");
- writeLink(writer, renderURL, "normal,foo=bar");
-
- PortletURL actionURL = response.createActionURL();
- writeLink(writer, actionURL, "empty");
-
- //
- actionURL.setParameter("foo", "bar");
- writeLink(writer, actionURL, "foo=bar");
-
- //
- actionURL.setWindowState(WindowState.MAXIMIZED);
- writeLink(writer, actionURL, "maximized,foo=bar");
-
- //
- actionURL = response.createRenderURL();
- actionURL.setWindowState(WindowState.MAXIMIZED);
- writeLink(writer, actionURL, "maximized");
-
- //
- actionURL = response.createRenderURL();
- actionURL.setWindowState(WindowState.NORMAL);
- writeLink(writer, actionURL, "normal");
-
- //
- actionURL.setWindowState(WindowState.NORMAL);
- actionURL.setParameter("foo", "bar");
- writeLink(writer, actionURL, "normal,foo=bar");
-
- //
- writer.close();
- }
-
- private void writeLink(PrintWriter writer, PortletURL url, String label)
- {
- writer.print("<div><a href=\"" + url +
"\">" + label + "</a></div>");
- }
-
- public void destroy()
- {
- this.config = null;
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,281 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.format.util.EntityTable;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletURL;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * This portlet is used to display a form that helps to test the charset handling by the
portal and the client. When a
- * fault occurs it may be the client fault (for instance the char with unicode value 160
fail the test in firefox but
- * succeds in IE6).
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class CharsetPortlet extends GenericPortlet
-{
-
- private static final Logger log = Logger.getLogger(CharsetPortlet.class);
-
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- String fromString = req.getParameter("from");
- String toString = req.getParameter("to");
- int from;
- int to;
- try
- {
- from = Integer.parseInt(fromString);
- to = Integer.parseInt(toString);
- }
- catch (NumberFormatException ignore)
- {
- from = 65;
- to = 256;
- }
- resp.setRenderParameter("from", "" + from);
- resp.setRenderParameter("to", "" + to);
-
- //
- String text = req.getParameter("text");
- if (text != null)
- {
- StringBuffer buffer = new StringBuffer();
- for (int i = from; i < to; i++)
- {
- char c = (char)i;
- if (useChar(c))
- {
- buffer.append(c);
- }
- }
- String expectedText = buffer.toString();
- boolean same = expectedText.equals(text);
- if (!same)
- {
- log.error("The input does not match the expected string");
- log.error("Expected string " + expectedText);
- log.error("Received string " + text);
- }
- resp.setRenderParameter("same", "" + same);
- }
- }
-
-
- protected void doHelp(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
- {
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.print("This portlet shows different ways to properly display and submit
unicode text");
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
- {
- String sameString = req.getParameter("same");
- Boolean same = null;
- if ("true".equalsIgnoreCase(sameString))
- {
- same = Boolean.TRUE;
- }
- else if ("false".equalsIgnoreCase(sameString))
- {
- same = Boolean.FALSE;
- }
-
- //
- String fromString = req.getParameter("from");
- String toString = req.getParameter("to");
- int from = 65;
- int to = 256;
- try
- {
- from = Integer.parseInt(fromString);
- to = from + 16;
- to = Integer.parseInt(toString);
- }
- catch (NumberFormatException ignore)
- {
- //
- }
-
- //
- if (to <= from)
- {
- to = from + 16;
- }
-
- //
- StringBuffer escapedText = new StringBuffer();
- StringBuffer text = new StringBuffer();
- for (int i = from; i < to; i++)
- {
- char c = (char)i;
- if (useChar(c))
- {
- text.append(c);
- String s = EntityTable.FULL.lookup(c);
- if (s == null)
- {
- escapedText.append(c);
- }
- else
- {
- escapedText.append("&").append(s).append(";");
- }
- }
- }
-
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.println("<div style=\"border-top:solid 1px\">Testing
range:</div>");
- writer.print(
- "<div>" +
- "<form action=\"" + resp.createActionURL() + "\"
method=\"post\"\">" +
- "<input type=\"text\" name=\"from\" value=\""
+ from + "\"/>" +
- "<input type=\"text\" name=\"to\" value=\"" +
to + "\"/>" +
- "<input type=\"submit\" value=\"change\"/>" +
- "</form>" +
- "</div>");
-
- //
- writer.println("<div style=\"border-top:solid 1px\">Test
processAction() with a textarea field:</div>");
- writer.println(
- "<div>" +
- "<form action=\"" + resp.createActionURL() + "\"
accept-charset=\"" + resp.getCharacterEncoding() + "\"
method=\"post\">" +
- "<input type=\"hidden\" name=\"from\"
value=\"" + from + "\"/>" +
- "<input type=\"hidden\" name=\"to\" value=\""
+ to + "\"/>" +
- "<textarea name=\"text\" cols=\"20\"
rows=\"10\" wrap=\"virtual\">" + escapedText +
"</textarea>" +
- "<input type=\"submit\" value=\"check\"/>" +
- "</form>" +
- "</div>");
-
- //
- writer.println("<div style=\"border-top:solid 1px\">Test
processAction() with a text field:</div>");
- writer.println(
- "<div>" +
- "<form action=\"" + resp.createActionURL() + "\"
accept-charset=\"" + resp.getCharacterEncoding() + "\"
method=\"post\">" +
- "<input type=\"hidden\" name=\"from\"
value=\"" + from + "\"/>" +
- "<input type=\"hidden\" name=\"to\" value=\""
+ to + "\"/>" +
- "<input type=\"text\" name=\"text\" value=\""
+ escapedText + "\"/>" +
- "<input type=\"submit\" value=\"check\"/>" +
- "</form>" +
- "</div>");
-
- //
- PortletURL url = resp.createActionURL();
- url.setParameter("text", text.toString());
- writer.println("<div style=\"border-top:solid 1px\">Test
processAction() with a portlet parameter:</div>");
- writer.println(
- "<div>" +
- "<form action=\"" + url + "\"
accept-charset=\"" + resp.getCharacterEncoding() + "\"
method=\"post\">" +
- "<input type=\"hidden\" name=\"from\"
value=\"" + from + "\"/>" +
- "<input type=\"hidden\" name=\"to\" value=\""
+ to + "\"/>" +
- "<input type=\"submit\" value=\"check\"/>" +
- "</form>" +
- "</div>");
-
- //
- PortletURL url2 = resp.createActionURL();
- url2.setParameter("text", text.toString());
- url2.setParameter("from", "" + from);
- url2.setParameter("to", "" + to);
- writer.println("<div style=\"border-top:solid 1px\"><a
href=\"" + url2 + "\">Test</a> processAction() with a portlet
parameter:</div>");
-
- //
- if (same != null)
- {
- writer.print("<div
style=\"color:red;margin-top:2em;margin-bottom:2em\">Test result: ");
- if (same == Boolean.TRUE)
- {
- writer.print("The input matched the expected result");
- }
- else if (same == Boolean.FALSE)
- {
- writer.print("The input did not matched the expected result");
- }
- writer.print("</div>");
- }
-
- //
- writer.close();
- }
-
- public static boolean useChar(char c)
- {
- switch (Character.getType(c))
- {
- case Character.LOWERCASE_LETTER: // Ll
- case Character.UPPERCASE_LETTER: // Lu
- case Character.TITLECASE_LETTER: // Lt
- case Character.MODIFIER_LETTER: // Lm
- case Character.OTHER_LETTER: // Lo
- case Character.NON_SPACING_MARK: // Mn
- case Character.ENCLOSING_MARK: // Me
- case Character.COMBINING_SPACING_MARK: // Mc
- case Character.DECIMAL_DIGIT_NUMBER: // Nd
- case Character.LETTER_NUMBER: // Nl
- case Character.OTHER_NUMBER: // No
- case Character.SPACE_SEPARATOR: // Zs
- case Character.LINE_SEPARATOR: // Zl
- case Character.PARAGRAPH_SEPARATOR: // Zp
- case Character.DASH_PUNCTUATION: // Pd
- case Character.START_PUNCTUATION: // Ps
- case Character.END_PUNCTUATION: // Pe
- case Character.CONNECTOR_PUNCTUATION: // Pc
- case Character.OTHER_PUNCTUATION: // Po
- case Character.INITIAL_QUOTE_PUNCTUATION: // Pi
- case Character.FINAL_QUOTE_PUNCTUATION: // Pf
- case Character.MATH_SYMBOL: // Sm
- case Character.CURRENCY_SYMBOL: // Sc
- case Character.MODIFIER_SYMBOL: // Sk
- case Character.OTHER_SYMBOL: // So
- return true;
- default:
- case Character.UNASSIGNED: // Cn
- case Character.CONTROL: // Cc
- case Character.FORMAT: // Cf
- case Character.PRIVATE_USE: // Co
- case Character.SURROGATE: // Cs
- return false;
- }
- }
-
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,75 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletSession;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class CounterPortlet extends GenericPortlet
-{
-
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
- {
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- PortletSession session = req.getPortletSession();
- int count = 0;
- if (session.getAttribute("count") != null)
- {
- count = ((Integer)session.getAttribute("count")).intValue() + 1;
- }
- session.setAttribute("count", new Integer(count));
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Render
call count</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>" + count + "</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- writer.write("<div class=\"portlet-section-header\">Render
call count</div>");
- writer.write("<div><a href=\"" + resp.createActionURL() +
"\">action</a></div");
- writer.write("<div><a href=\"" + resp.createRenderURL() +
"\">render</a></div");
-
- //
- writer.close();
- }
-
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,105 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 5448 $
- */
-public class EncodingPortlet extends GenericPortlet
-{
-
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- resp.setRenderParameter("text", req.getParameter("text"));
- req.getPortletSession().setAttribute("text",
req.getParameter("text"));
-
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
- {
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- String param = req.getParameter("text");
- String attr = (String)req.getPortletSession().getAttribute("text");
-
- //
- writer.print(
- "<div> Text to pass : " +
- "<form action=\"" + resp.createRenderURL() + "\"
method=\"post\"\">" +
- "<input type=\"text\" name=\"text\"
value=\"\"/>" +
- "<input type=\"submit\" value=\"Submit to render
phase\"/>" +
- "</form>" +
- "<form action=\"" + resp.createActionURL() + "\"
method=\"post\"\">" +
- "<input type=\"text\" name=\"text\"
value=\"\"/>" +
- "<input type=\"submit\" value=\"Submit to action
phase\"/>" +
- "</form>" +
- "</div>");
-
- //
- writer.println(
- "<div>" + "Text retrieved from request parameter: " +
- "</div>" +
- "<div>" +
- "<textarea name=\"text\" cols=\"20\"
rows=\"4\" wrap=\"virtual\">");
-
- if (param != null)
- {
- writer.println(param);
- }
-
- writer.println(
- "</textarea>" +
- "</div>");
-
- writer.println(
- "<div>" + "Text retrieved from portlet session (value set
during Action Phase): " +
- "</div>" +
- "<div>" +
- "<textarea name=\"text\" cols=\"20\"
rows=\"4\" wrap=\"virtual\">");
-
- if (attr != null)
- {
- writer.println(attr);
- }
-
- writer.println(
- "</textarea>" +
- "</div>");
-
- //
- writer.close();
- }
-
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,113 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletURL;
-import javax.portlet.GenericPortlet;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletRequest;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class ExceptionPortlet extends GenericPortlet
-{
-
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- throwException(req);
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
- {
- throwException(req);
-
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
- PortletURL renderURL = resp.createRenderURL();
- PortletURL actionURL = resp.createActionURL();
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Throw
:</div>");
- writer.write("<div class=\"portlet-section-body\">");
- renderURL.setParameter("op", "portletexception");
- writer.write("<div><a href=\"" + renderURL +
"\">render PortletException</a></div>");
- renderURL.setParameter("op", "portletsecurityexception");
- writer.write("<div><a href=\"" + renderURL +
"\">render PortletSecurityException</a></div>");
- renderURL.setParameter("op", "ioexception");
- writer.write("<div><a href=\"" + renderURL +
"\">render IOException</a></div>");
- renderURL.setParameter("op", "runtimeexception");
- writer.write("<div><a href=\"" + renderURL +
"\">render RuntimeException</a></div>");
- actionURL.setParameter("op", "error");
- writer.write("<div><a href=\"" + renderURL +
"\">render Error</a></div>");
- actionURL.setParameter("op", "portletexception");
- writer.write("<div><a href=\"" + actionURL +
"\">action PortletException</a></div>");
- actionURL.setParameter("op", "portletsecurityexception");
- writer.write("<div><a href=\"" + actionURL +
"\">action PortletSecurityException</a></div>");
- actionURL.setParameter("op", "ioexception");
- writer.write("<div><a href=\"" + actionURL +
"\">action IOException</a></div>");
- actionURL.setParameter("op", "runtimeexception");
- writer.write("<div><a href=\"" + actionURL +
"\">action RuntimeException</a></div>");
- actionURL.setParameter("op", "error");
- writer.write("<div><a href=\"" + actionURL +
"\">action Error</a></div>");
- writer.write("</div>");
- writer.write("</p>");
- }
-
- private void throwException(PortletRequest req) throws PortletException, IOException
- {
- String op = req.getParameter("op");
-
- // Throw any required exception
- if ("portletexception".equals(op))
- {
- throw new PortletException();
- }
- if ("portletsecurityexception".equals(op))
- {
- throw new PortletSecurityException("");
- }
- if ("ioexception".equals(op))
- {
- throw new IOException();
- }
- if ("runtimeexception".equals(op))
- {
- throw new RuntimeException();
- }
- if ("error".equals(op))
- {
- throw new Error();
- }
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,274 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderResponse;
-import javax.portlet.RenderRequest;
-import javax.portlet.PortletException;
-import javax.portlet.PortletURL;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import java.io.IOException;
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.nio.channels.FileChannel;
-import java.nio.ByteBuffer;
-
-/**
- * <p>An example of content driven portlet that display the files located in the
war file. The portlet does not implement
- * any code to improve performance like caching in order to keep the code easier to
understand. It should not be
- * used in production for a large scale portal.</p>
- *
- * <p>Content URI is defined as the canonical path of the file relative to the war
file context root.</p>
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class FSContentDrivenPortlet extends GenericPortlet
-{
-
- /** The edit_content mode. */
- public static final PortletMode EDIT_CONTENT_MODE = new
PortletMode("edit_content");
-
- /**
- * Additional dispatch that will call the
<code>doEditContent(RenderRequest,RenderResponse)</code> method.
- */
- protected void doDispatch(RenderRequest req, RenderResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
- {
- doEditContent(req, resp);
- }
- else
- {
- super.doDispatch(req, resp);
- }
- }
-
- /**
- * Implements the edit content functionnality.
- */
- protected void doEditContent(RenderRequest req, RenderResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- // Get the uri value optionally provided by the portal
- String uri = req.getParameter("content.uri");
-
- // Get the working directory directory
- File workingDir;
- if (uri != null)
- {
- workingDir = getFile(uri).getParentFile();
- }
- else
- {
- // Otherwise try to get the current directory we are browsing, if no current dir
exist we use the root
- String currentDir = req.getParameter("current_dir");
- if (currentDir == null)
- {
- currentDir = "/";
- }
- workingDir = getFile(currentDir);
- }
-
- // Get the parent path
- String parentPath = getContentURI(workingDir.getParentFile());
-
- // Get the children of the selected file, we use a filter to retain only text files
and avoid WEB-INF dir
- File[] children = workingDir.listFiles(filter);
-
- // Configure the response
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.print("Directories:<br/>");
- writer.print("<ul>");
- PortletURL choseDirURL = resp.createRenderURL();
- if (parentPath != null)
- {
- choseDirURL.setParameter("current_dir", parentPath);
- writer.print("<li><a href=\"" + choseDirURL +
"\">..</a></li>");
- }
- for (int i = 0;i < children.length;i++)
- {
- File child = children[i];
- if (child.isDirectory())
- {
- choseDirURL.setParameter("current_dir", getContentURI(child));
- writer.print("<li><a href=\"" + choseDirURL +
"\">" + child.getName() + "</a></li>");
- }
- }
- writer.print("</ul><br/>");
-
- //
- writer.print("Files:<br/>");
- writer.print("<ul>");
- PortletURL selectFileURL = resp.createActionURL();
- selectFileURL.setParameter("content.action.select", "select");
- for (int i = 0;i < children.length;i++)
- {
- File child = children[i];
- if (child.isFile())
- {
- selectFileURL.setParameter("content.uri", getContentURI(child));
- writer.print("<li><a href=\"" + selectFileURL +
"\">" + child.getName() + "</a></li>");
- }
- }
- writer.print("</ul><br/>");
-
- //
- writer.close();
- }
-
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
- {
- // Get the URI provided by the portal
- String uri = req.getParameter("uri");
-
- // Configure the response
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- if (uri == null)
- {
- writer.print("No selected file");
- }
- else
- {
- File file = getFile(uri);
- FileInputStream in = null;
- try
- {
- in = new FileInputStream(file);
- FileChannel channel = in.getChannel();
- byte[] bytes = new byte[(int)channel.size()];
- ByteBuffer buffer = ByteBuffer.wrap(bytes);
- channel.read(buffer);
- writer.write(new String(bytes, 0, bytes.length, "UTF8"));
- }
- catch (FileNotFoundException e)
- {
- writer.print("No such file " + uri);
- getPortletContext().log("Cannot find file " + uri, e);
- }
- finally
- {
- if (in != null)
- {
- in.close();
- }
- }
- }
-
- //
- writer.close();
- }
-
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
- {
- String contentURI = req.getParameter("content.uri");
-
- // We just propagate the content URI as a render parameter for the doEditContent
method
- if (contentURI != null)
- {
- resp.setRenderParameter("content.uri", contentURI);
- }
- }
- }
-
- /**
- * Return a file from the specified path or null if the file cannot be determined.
- *
- * @param contentURI the file path
- * @return the file or null
- */
- protected File getFile(String contentURI) throws IOException
- {
- String realPath = getPortletContext().getRealPath(contentURI);
- if (realPath == null)
- {
- throw new IOException("Cannot access war file content");
- }
- File file = new File(realPath);
- if (!file.exists())
- {
- throw new IOException("File " + contentURI + " does not
exist");
- }
- return file;
- }
-
- /**
- * Return the content uri of the file or null if it cannot be determined.
- *
- * @param file the file to get the URI from
- * @return the URI or null
- */
- protected String getContentURI(File file) throws IOException
- {
- String rootPath = getPortletContext().getRealPath("/");
- if (rootPath == null)
- {
- throw new IOException("Cannot access war file content");
- }
-
- // Make it canonical
- rootPath = new File(rootPath).getCanonicalPath();
-
- // Get the portion of the path that is significant for us
- String filePath = file.getCanonicalPath();
- return filePath.length() >= rootPath.length() ?
filePath.substring(rootPath.length()) : null;
- }
-
- /**
- * Avoid the WEB-INF directory and list only text files.
- */
- private final FileFilter filter = new FileFilter()
- {
- public boolean accept(File file)
- {
- String name = file.getName();
- if (file.isDirectory())
- {
- return !"WEB-INF".equals(name);
- }
- else if (file.isFile())
- {
- return name.endsWith(".txt");
- }
- else
- {
- return false;
- }
- }
- };
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,108 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import org.apache.commons.fileupload.portlet.PortletFileUpload;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileUploadException;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class FileUploadPortlet extends GenericPortlet
-{
-
-
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
-
- //
- List fileNames = new ArrayList();
- List fileSizes = new ArrayList();
-
- //
- try
- {
- DiskFileItemFactory factory = new DiskFileItemFactory();
- PortletFileUpload upload = new PortletFileUpload(factory);
- List fileItems = upload.parseRequest(req);
- for (Iterator iterator = fileItems.iterator();iterator.hasNext();)
- {
- FileItem item = (FileItem)iterator.next();
- if (!item.isFormField())
- {
- fileNames.add("" + item.getName());
- fileSizes.add("" + item.getSize());
- }
- }
- }
- catch (FileUploadException e)
- {
- throw new PortletException(e);
- }
-
- //
- resp.setRenderParameter("fileNames", (String[])fileNames.toArray(new
String[fileNames.size()]));
- resp.setRenderParameter("fileSizes", (String[])fileSizes.toArray(new
String[fileSizes.size()]));
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
- {
- //
- resp.setContentType("text/html");
-
- //
- PrintWriter writer = resp.getWriter();
-
- String[] fileNames = req.getParameterValues("fileNames");
- String[] fileSizes = req.getParameterValues("fileSizes");
- if (fileNames != null && fileSizes != null && fileNames.length ==
fileSizes.length)
- {
- for (int i = 0;i < fileNames.length;i++)
- {
- writer.println("Received file " + fileNames[i] + " with size
" + fileSizes[i] + "<br/>");
- }
- }
-
- //
- writer.println("<form action=\"" + resp.createActionURL() +
"\" method=\"post\"
enctype=\"multipart/form-data\">");
- writer.println("<input type=\"file\"
name=\"File\">");
- writer.println("<input type=\"submit\"
name=\"Upload\">");
- writer.println("</form>");
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,66 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletURL;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class FormAutoSubmitPortlet extends GenericPortlet
-{
-
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
- {
- resp.setContentType("text/html");
-
- //
- PrintWriter writer = resp.getWriter();
- PortletURL actionURL = resp.createActionURL();
- String formId = resp.getNamespace() + "_the_form";
-
- //
- writer.write("<form id=\"" + formId + "\"
action=\"" + actionURL + "\">");
- writer.write("<select onclick=\"document.getElementById('" +
formId + "').submit()\" multiple=\"multiple\">");
- writer.write("<option>A</option>");
- writer.write("<option>B</option>");
- writer.write("<option>C</option>");
- writer.write("</select>");
- writer.write("</form>");
- writer.write("<a href=\"javascript:document.getElementById('"
+ formId + "').submit()\">submit</a>");
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,113 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSession;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PortletSessionPortlet extends GenericPortlet
-{
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, IOException
- {
- String name = req.getParameter("name");
- String value = req.getParameter("value");
- boolean portletScope = req.getParameter("portlet") != null;
- if (name != null && value != null)
- {
- req.getPortletSession().setAttribute(name, value, portletScope ?
PortletSession.PORTLET_SCOPE : PortletSession.APPLICATION_SCOPE);
- }
- if (req.getParameter("invalidate") != null)
- {
- req.getPortletSession().invalidate();
- }
- }
-
- public void render(RenderRequest req, RenderResponse resp) throws PortletException,
IOException
- {
- PortletSession session = req.getPortletSession(false);
- PortletURL purl = resp.createActionURL();
-
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- if (session == null)
- {
- writer.println("No session");
- }
- else
- {
- writer.println("Session id = " + session.getId());
- writer.println("<br/>");
-
- //
- print(session, PortletSession.PORTLET_SCOPE, writer);
- writer.println("<br/>");
-
- //
- print(session, PortletSession.APPLICATION_SCOPE, writer);
- writer.println("<br/>");
-
- }
-
- //
- writer.println("<form action=\"" + purl.toString() +
"\" method=\"post\">");
- writer.println("<input type=\"text\"
name=\"name\"/>");
- writer.println("<input type=\"text\"
name=\"value\"/>");
- writer.println("<input type=\"submit\" name=\"portlet\"
value=\"Add to portlet scope\"/>");
- writer.println("<input type=\"submit\"
name=\"application\" value=\"Add to application scope\"/>");
- writer.println("</form><br/>");
-
- //
- purl.setParameter("invalidate", "true");
- writer.println("<a href=\"" + purl.toString() +
"\">invalidate</a><br/>");
- }
-
- private void print(PortletSession session, int scope, PrintWriter writer)
- {
- writer.println("<table>");
-
writer.println("<tr><td>name</td><td>value</td>");
- for (Enumeration e = session.getAttributeNames(scope); e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- Object value = session.getAttribute(name, scope);
- writer.println("<tr><td>" + name +
"</td><td>" + value + "</td>");
- }
- writer.println("</table>");
- }
-
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,237 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import org.jboss.portal.common.transaction.TransactionManagerProvider;
-import org.jboss.portal.core.CoreConstants;
-import org.jboss.portal.identity.User;
-import org.jboss.portlet.JBossActionRequest;
-import org.jboss.portlet.JBossActionResponse;
-import org.jboss.portlet.JBossPortlet;
-import org.jboss.portlet.JBossRenderRequest;
-import org.jboss.portlet.JBossRenderResponse;
-
-import javax.portlet.PortalContext;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletURL;
-import javax.transaction.Transaction;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5883 $
- */
-public class TestPortlet extends JBossPortlet
-{
-
- public void main(JBossActionRequest req, JBossActionResponse resp)
- {
- }
-
- public void addrole(JBossActionRequest req, JBossActionResponse resp)
- {
- String role = req.getParameter("role");
- Set roles = (Set)req.getPortletSession().getAttribute("roles");
- if (roles == null)
- {
- roles = new HashSet();
- req.getPortletSession().setAttribute("roles", roles);
- }
- roles.add(role);
- }
-
- public void testaction(JBossActionRequest req, JBossActionResponse resp)
- {
- resp.setRenderParameter("name", "value");
- }
-
- protected void doView(JBossRenderRequest req, JBossRenderResponse resp) throws
PortletException, PortletSecurityException, IOException
- {
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- User user = req.getUser();
- if (user != null)
- {
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">User
infos</div>");
- writer.write("<div class=\"portlet-section-body\">");
-
- //TODO: update this with new Identity API
- //writer.write("<div>Last visit date : " +
user.getLastVisitDate() + "</div>");
- writer.write("</div>");
- writer.write("</p>");
- }
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Portlet
security infos</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>RemoteUser : " + req.getRemoteUser() +
"</div>");
- writer.write("<div>Principal : " + req.getUserPrincipal() +
"</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Portlet
security role test</div>");
- Set roles = (Set)req.getPortletSession().getAttribute("roles");
- if (roles != null)
- {
- writer.write("<div class=\"portlet-section-body\">");
- for (Iterator i = roles.iterator(); i.hasNext();)
- {
- String role = (String)i.next();
- writer.write("<div>" + role + " " +
req.isUserInRole(role) + "</div>");
- }
- writer.write("</div>");
- }
- PortletURL roleURL = resp.createActionURL();
- roleURL.setParameter("op", "addrole");
- writer.write("<div>" +
- "<form action=\"" + roleURL + "\"
method=\"post\">" +
- "<input class=\"portlet-form-input-field\"
type=\"text\" name=\"role\" value=\"\"/>" +
- "<input class=\"portlet-form-button\"
type=\"submit\" value=\"add role\"/>" +
- "</form>" +
- "</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div
class=\"portlet-section-header\">Capabilities</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>Content type " + req.getResponseContentType() +
"</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- PortletURL url = resp.createRenderURL();
- url.setSecure(false);
- String httpURL = url.toString();
- url.setSecure(true);
- String httpsURL = url.toString();
- writer.write("<p>");
- writer.write("<div
class=\"portlet-section-header\">Secure</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div><a href=\"" + httpURL +
"\">http</a></div>");
- writer.write("<div><a href=\"" + httpsURL +
"\">https</a></div>");
- writer.write("</div>");
- writer.write("</p>");
-
- writer.write("<p>");
- writer.write("<div
class=\"portlet-section-header\">Path</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>portal path info = " +
req.getAttribute("PATH") + "</div>");
- writer.write("<div>portal path info = " +
req.getParameter("PATH") + "</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Portal
infos</div>");
- writer.write("<div class=\"portlet-section-body\">");
- PortalContext portalCtx = req.getPortalContext();
- writer.write("<div>version : " + portalCtx.getPortalInfo() +
"</div>");
- for (Enumeration e = portalCtx.getPropertyNames(); e.hasMoreElements();)
- {
- String propertyName = (String)e.nextElement();
- String propertyValue = portalCtx.getProperty(propertyName);
- writer.write("<div>" + propertyName + " : " +
propertyValue + "</div>");
- }
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Request
attributes</div>");
- writer.write("<div class=\"portlet-section-body\">");
- for (Enumeration e = req.getAttributeNames(); e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- Object value = req.getAttribute(name);
- writer.write("<div>" + name + " : " + value +
"</div>");
- }
- writer.write("</div>");
- writer.write("</p>");
-
- // User properties
- Map userInfoMap = (Map)req.getAttribute(PortletRequest.USER_INFO);
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">User
properties</div>");
- writer.write("<div class=\"portlet-section-body\">");
- if (userInfoMap != null)
- {
- for (Iterator i = userInfoMap.entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String key = (String)entry.getKey();
- String value = (String)entry.getValue();
- writer.write("<div>" + key + " : " + value +
"</div>");
- }
- }
- writer.write("</div>");
- writer.write("</p>");
-
- //
- PortletURL actionURL = resp.createActionURL();
- actionURL.setParameter("op", "testaction");
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Test
action</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div><a href=\"" + actionURL +
"\">action</a></div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Test
current transaction</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>" + getCurrentTransaction() +
"</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.close();
- }
-
- private Transaction getCurrentTransaction()
- {
- try
- {
- return
TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager().getTransaction();
- }
- catch (Exception e)
- {
- return null;
- }
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,118 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-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.PrintWriter;
-import java.util.Enumeration;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class URLPortlet extends GenericPortlet
-{
- public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, IOException
- {
- for (Enumeration e = req.getParameterNames(); e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- String value = req.getParameter(name);
- if (!"name".equals(name) && !"value".equals(name))
- {
- resp.setRenderParameter(name, value);
- }
- }
- String name = req.getParameter("name");
- String value = req.getParameter("value");
- if (name != null && value != null)
- {
- resp.setRenderParameter(name, value);
- }
- }
-
- public void render(RenderRequest req, RenderResponse resp) throws PortletException,
IOException
- {
- String color = req.getParameter("color");
- if (color == null)
- {
- color = "white";
- }
-
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- PortletURL renderURL = resp.createRenderURL();
-
- //
- renderURL.setParameter("color", "blue");
- String blueURL = renderURL.toString();
-
- //
- renderURL.setParameter("color", "red");
- String redURL = renderURL.toString();
-
- //
- renderURL.setParameter("color", "white");
- String whiteURL = renderURL.toString();
-
- //
- writer.print("<a href=\"" + blueURL +
"\">blue</a> -");
- writer.print("<a href=\"" + redURL +
"\">red</a> -");
- writer.print("<a href=\"" + whiteURL +
"\">white</a><br/>");
-
- //
- writer.print("Parameters :<br/>");
- writer.print("<table bgcolor=\"" + color +
"\">");
-
writer.print("<tr><td>Name</td><td>value</td></tr>");
- for (Enumeration e = req.getParameterNames(); e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- String value = req.getParameter(name);
- writer.print("<tr><td>" + name +
"</td><td>" + value + "</td></tr>");
- }
- writer.print("</table>");
-
- //
- PortletURL actionURL = resp.createActionURL();
- writer.print("<form action=\"" + actionURL.toString() +
"\" method=\"post\">");
- writer.print("<input type=\"text\"
name=\"name\"/>");
- writer.print("<input type=\"text\"
name=\"value\"/>");
- writer.print("<input type=\"submit\"
value=\"add\"/>");
- writer.print("</form>");
-
- //
- writer.print("<a href=\"" + req.getContextPath() +
"/test.txt\">test</a>");
-
- //
- writer.close();
- }
-}
\ No newline at end of file
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,54 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import org.jboss.portal.api.event.PortalEventListener;
-import org.jboss.portal.api.event.PortalEvent;
-import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.api.session.event.PortalSessionEvent;
-import org.jboss.portal.api.user.event.UserAuthenticationEvent;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortalEventListenerLogger implements PortalEventListener
-{
- public void onEvent(PortalEventContext eventContext, PortalEvent event)
- {
- if (event instanceof PortalSessionEvent)
- {
- PortalSessionEvent use = (PortalSessionEvent)event;
- System.out.println(use.getType() == PortalSessionEvent.SESSION_CREATED ?
"session created" : "session destroyed");
- }
- else if (event instanceof UserAuthenticationEvent)
- {
- UserAuthenticationEvent uae = (UserAuthenticationEvent)event;
- System.out.println(uae.getType() == UserAuthenticationEvent.SIGN_IN ? "user
login" : "user logout");
- }
- else
- {
- System.out.println("event = " + event);
- }
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PortletA extends GenericPortlet
-{
- protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
- {
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
- writer.println("<form action=\"" + response.createActionURL() +
"\" method=\"post\">");
- writer.println("<select name=\"color\">");
- writer.println("<option>blue</option>");
- writer.println("<option>red</option>");
- writer.println("<option>black</option>");
- writer.println("</select>");
- writer.println("<input type=\"submit\"/>");
- writer.println("</form>");
- writer.close();
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,108 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import org.jboss.portal.WindowState;
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.node.event.PortalNodeEvent;
-import org.jboss.portal.api.node.event.PortalNodeEventContext;
-import org.jboss.portal.api.node.event.PortalNodeEventListener;
-import org.jboss.portal.api.node.event.WindowActionEvent;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PortletB extends GenericPortlet
-{
-
- public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
- {
- String color = request.getParameter("color");
- if (color != null)
- {
- response.setRenderParameter("color", color);
- }
- }
-
- protected void doView(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
- {
- String color = request.getParameter("color");
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
- writer.println("<div" +
- (color == null ? "" : " style=\"color:" + color +
";\"") +
- ">some text in color</div>");
- writer.close();
- }
-
- public static class Listener implements PortalNodeEventListener
- {
- public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent
event)
- {
- PortalNode node = event.getNode();
-
- // Get node name
- String nodeName = node.getName();
-
- // See if we need to create a new event or not
- WindowActionEvent newEvent = null;
- if (nodeName.equals("PortletAWindow") && event instanceof
WindowActionEvent)
- {
- // Find window B
- WindowActionEvent wae = (WindowActionEvent)event;
- PortalNode windowB = node.resolve("../PortletBWindow");
- if (windowB != null)
- {
- // We can redirect
- newEvent = new WindowActionEvent(windowB);
- newEvent.setMode(wae.getMode());
- newEvent.setWindowState(WindowState.MAXIMIZED);
- newEvent.setParameters(wae.getParameters());
- }
- }
-
- //
- if (newEvent != null)
- {
- // If we have a new event redirect to it
- return newEvent;
- }
- else
- {
- // Otherwise bubble up
- return context.dispatch();
- }
- }
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,62 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import org.jboss.portal.api.event.PortalEvent;
-import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.api.event.PortalEventListener;
-import org.jboss.portal.api.user.event.UserAuthenticationEvent;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision: 1.1 $
- */
-public class UserCounterListener implements PortalEventListener
-{
-
- /** . */
- private final SynchronizedLong counter = new SynchronizedLong(0);
-
- /** . */
- private final SynchronizedLong counterEver = new SynchronizedLong(0);
-
- public void onEvent(PortalEventContext eventContext, PortalEvent event)
- {
- if (event instanceof UserAuthenticationEvent)
- {
- UserAuthenticationEvent userEvent = (UserAuthenticationEvent)event;
- if (userEvent.getType() == UserAuthenticationEvent.SIGN_IN)
- {
- counter.increment();
- counterEver.increment();
- }
- else if (userEvent.getType() == UserAuthenticationEvent.SIGN_OUT)
- {
- counter.decrement();
- }
- System.out.println("Counter : " + counter.get());
- System.out.println("Counter ever: " + counterEver.get());
- }
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java 2007-06-26
13:40:06 UTC (rev 7549)
@@ -1,254 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import org.jboss.portal.api.node.event.PortalNodeEventListener;
-import org.jboss.portal.api.node.event.PortalNodeEvent;
-import org.jboss.portal.api.node.event.PortalNodeEventContext;
-import org.jboss.portal.api.node.event.PageRenderEvent;
-import org.jboss.portal.api.node.event.WindowNavigationEvent;
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.navstate.NavigationalStateContext;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.WindowState;
-
-import java.util.Map;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WindowConstraintEventListener implements PortalNodeEventListener
-{
-
- public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event)
- {
- if (event instanceof PageRenderEvent)
- {
- PortalNode targetPage = event.getNode();
- WindowManipulator manipulator = new
WindowManipulator(context.getPortalRuntimeContext().getNavigationalStateContext(),
targetPage);
-
- // Filter window state for normal and minimized
- for (Iterator i = manipulator.getRegionNames().iterator();i.hasNext();)
- {
- boolean foundNormal = false;
- PortalNode firstWindow = null;
- String regionName = (String)i.next();
- for (Iterator j =
manipulator.getWindows(regionName).iterator();j.hasNext();)
- {
- PortalNode window = (PortalNode)j.next();
-
- // Keep a ref on first window which can be used later
- if (firstWindow == null)
- {
- firstWindow = window;
- }
-
- //
- WindowState ws = manipulator.getWindowState(window);
- if (WindowState.NORMAL.equals(ws))
- {
- if (foundNormal)
- {
- manipulator.setWindowState(window, WindowState.MINIMIZED);
- }
- else
- {
- foundNormal = true;
- }
- }
- else if (WindowState.MINIMIZED.equals(ws))
- {
- //
- }
- else
- {
- manipulator.setWindowState(window, WindowState.MINIMIZED);
- }
- }
-
- //
- if (foundNormal == false && firstWindow != null)
- {
- manipulator.setWindowState(firstWindow, WindowState.NORMAL);
- }
- }
- }
- else if (event instanceof WindowNavigationEvent)
- {
- WindowNavigationEvent wne = (WindowNavigationEvent)event;
- PortalNode targetWindow = event.getNode();
- WindowManipulator manipulator = new
WindowManipulator(context.getPortalRuntimeContext().getNavigationalStateContext(),
targetWindow.getParent());
-
- //
- WindowState ws = wne.getWindowState();
-
- //
- if (WindowState.NORMAL.equals(ws))
- {
- String regionName = manipulator.getRegionName(targetWindow);
- if (regionName != null)
- {
- for (Iterator i =
manipulator.getWindows(regionName).iterator();i.hasNext();)
- {
- PortalNode currentWindow = (PortalNode)i.next();
- if (currentWindow.equals(targetWindow))
- {
- // Do nothing
- }
- else
- {
- manipulator.setWindowState(currentWindow, WindowState.MINIMIZED);
- }
- }
- }
- }
- else if (WindowState.MINIMIZED.equals(ws))
- {
- String regionName = manipulator.getRegionName(targetWindow);
- if (regionName != null)
- {
- // Find the window following the minimized one
- PortalNode nextWindow = null;
- for (Iterator i =
manipulator.getWindows(regionName).iterator();i.hasNext();)
- {
- PortalNode currentWindow = (PortalNode)i.next();
-
- // Keep a ref on the first window for later use
- if (nextWindow == null)
- {
- nextWindow = currentWindow;
- }
-
- //
- if (currentWindow.equals(targetWindow))
- {
- // Try to get the next window otherwise it means it's the last
window
- // and we'll use the window we saved at the first iteration
- if (i.hasNext())
- {
- nextWindow = (PortalNode)i.next();
- }
-
- //
- break;
- }
- }
-
- // Normalize the next window
- if (nextWindow != null)
- {
- manipulator.setWindowState(nextWindow, WindowState.NORMAL);
- }
- }
- }
- }
- return context.dispatch();
- }
-
- public class WindowManipulator
- {
-
- /** . */
- private Map regionMap;
-
- /** . */
- private NavigationalStateContext nsContext;
-
- public WindowManipulator(NavigationalStateContext nsContext, PortalNode parent)
- {
- this.nsContext = nsContext;
-
- // Build appropriate structure
- regionMap = new HashMap();
- for (Iterator i = parent.getChildren().iterator();i.hasNext();)
- {
- try
- {
- PortalNode object = (PortalNode)i.next();
- if (object.getType() == PortalNode.TYPE_WINDOW)
- {
- String region =
(String)object.getProperties().get(ThemeConstants.PORTAL_PROP_REGION);
- Integer order = new
Integer((String)object.getProperties().get(ThemeConstants.PORTAL_PROP_ORDER));
-
- //
- SortedMap windowMap = (SortedMap)regionMap.get(region);
- if (windowMap == null)
- {
- windowMap = new TreeMap();
- regionMap.put(region, windowMap);
- }
- windowMap.put(order, object);
- }
- }
- catch (NumberFormatException ignore)
- {
- }
- }
- }
-
- public String getRegionName(PortalNode window)
- {
- for (Iterator i = regionMap.entrySet().iterator();i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- SortedMap windows = (SortedMap)entry.getValue();
- for (Iterator j = windows.values().iterator();j.hasNext();)
- {
- PortalNode window2 = (PortalNode)j.next();
- if (window.equals(window2))
- {
- return (String)entry.getKey();
- }
- }
- }
- return null;
- }
-
- public Set getRegionNames()
- {
- return regionMap.keySet();
- }
-
- public Collection getWindows(String regionName)
- {
- return ((Map)regionMap.get(regionName)).values();
- }
-
- public WindowState getWindowState(PortalNode window)
- {
- return nsContext.getWindowState(window);
- }
-
- public void setWindowState(PortalNode window, WindowState windowState)
- {
- nsContext.setWindowState(window, windowState);
- }
- }
-}
Copied: trunk/core-samples/src/resources/portal-basic-samples-sar (from rev 7535,
trunk/core-samples/src/resources/portal-samples-sar)
Copied: trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF (from rev 7548,
trunk/core-samples/src/resources/portal-samples-sar/META-INF)
Modified:
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/core-samples/src/resources/portal-samples-sar/META-INF/jboss-service.xml 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml 2007-06-26
13:40:06 UTC (rev 7549)
@@ -35,7 +35,7 @@
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ListenerRegistry</depends>
<attribute name="RegistryId">test_listener</attribute>
- <attribute
name="ListenerClassName">org.jboss.portal.core.portlet.test.event.PortletB$Listener</attribute>
+ <attribute
name="ListenerClassName">org.jboss.portal.core.portlet.basic.event.PortletB$Listener</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
@@ -47,7 +47,7 @@
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ListenerRegistry</depends>
<attribute
name="RegistryId">window_event_listener</attribute>
- <attribute
name="ListenerClassName">org.jboss.portal.core.portlet.test.event.WindowConstraintEventListener</attribute>
+ <attribute
name="ListenerClassName">org.jboss.portal.core.portlet.basic.event.WindowConstraintEventListener</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
@@ -59,7 +59,7 @@
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ListenerRegistry</depends>
<attribute name="RegistryId">user_listener</attribute>
- <attribute
name="ListenerClassName">org.jboss.portal.core.portlet.test.event.PortalEventListenerLogger</attribute>
+ <attribute
name="ListenerClassName">org.jboss.portal.core.portlet.basic.event.PortalEventListenerLogger</attribute>
</mbean>
<!-- mbean
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
Copied: trunk/core-samples/src/resources/portal-basic-samples-war (from rev 7535,
trunk/core-samples/src/resources/portal-samples-war)
Copied: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF (from rev 7548,
trunk/core-samples/src/resources/portal-samples-war/WEB-INF)
Modified:
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
===================================================================
---
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet-instances.xml 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml 2007-06-26
13:40:06 UTC (rev 7549)
@@ -27,6 +27,7 @@
"http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
<deployments>
+<!--
<deployment>
<instance>
<instance-id>JSPPortletInstance</instance-id>
@@ -68,6 +69,8 @@
<portlet-ref>WeatherPortlet</portlet-ref>
</instance>
</deployment>
+-->
+
<deployment>
<instance>
<instance-id>HeaderContentPortletInstance</instance-id>
Modified: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml 2007-06-26
13:25:00 UTC (rev 7548)
+++
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2007-06-26
13:40:06 UTC (rev 7549)
@@ -27,6 +27,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0">
+<!--
<portlet>
<description>Simple JSP portlet</description>
<portlet-name>JSPPortlet</portlet-name>
@@ -41,6 +42,9 @@
<keywords>sample,test</keywords>
</portlet-info>
</portlet>
+-->
+
+<!--
<portlet>
<description>Event Portlet</description>
<portlet-name>EventPortlet</portlet-name>
@@ -55,12 +59,14 @@
<keywords>event, sample,test</keywords>
</portlet-info>
</portlet>
+-->
+
<portlet>
<description>Portlet to test modification of head
content</description>
<portlet-name>HeaderContentPortlet</portlet-name>
<display-name>Header Content Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.plugins.HeaderContentPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.HeaderContentPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -75,7 +81,7 @@
<portlet-name>TestPortlet</portlet-name>
<display-name>Test Portlet</display-name>
<display-name xml:lang="fr">Portlet Test</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.TestPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.TestPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -119,7 +125,7 @@
<description>Portlet displaying the number of it's action/render
calls</description>
<portlet-name>CounterPortlet</portlet-name>
<display-name>Counter Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.CounterPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.CounterPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -132,7 +138,7 @@
<description>Counter Portlet with cache support</description>
<portlet-name>CachedCounterPortlet</portlet-name>
<display-name>Cached Counter Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.CounterPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.CounterPortlet</portlet-class>
<expiration-cache>60</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
@@ -145,7 +151,7 @@
<description>Portlet for testing behaviour on exceptions</description>
<portlet-name>ExceptionPortlet</portlet-name>
<display-name>Exception Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.ExceptionPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.ExceptionPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -158,7 +164,7 @@
<description>Portlet using portlet session</description>
<portlet-name>PortletSessionPortlet</portlet-name>
<display-name>Portlet Session Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.PortletSessionPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.PortletSessionPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -171,7 +177,7 @@
<description>Portlet for demonstrating IPC</description>
<portlet-name>PortletA</portlet-name>
<display-name>Portlet A</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.event.PortletA</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.event.PortletA</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -185,7 +191,7 @@
<description>Portlet for demonstrating IPC</description>
<portlet-name>PortletB</portlet-name>
<display-name>Portlet B</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.event.PortletB</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.event.PortletB</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -199,7 +205,7 @@
<description>Portlet showing different ways to properly display and submit
unicode text</description>
<portlet-name>CharsetPortlet</portlet-name>
<display-name>Charset Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.CharsetPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.CharsetPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -214,7 +220,7 @@
<description>Portlet for testing encoding</description>
<portlet-name>EncodingPortlet</portlet-name>
<display-name>Encoding Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.EncodingPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.EncodingPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -228,7 +234,7 @@
<description>Secured Test Portlet</description>
<portlet-name>SecuredTestPortlet</portlet-name>
<display-name>Secured Test Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.TestPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.TestPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -240,6 +246,7 @@
<keywords>sample,test</keywords>
</portlet-info>
</portlet>
+<!--
<portlet>
<description>Portlet providing weather forecast</description>
<portlet-name>WeatherPortlet</portlet-name>
@@ -279,6 +286,8 @@
</preference>
</portlet-preferences>
</portlet>
+-->
+<!--
<portlet>
<description>Portlet aggregating news from different
feeds</description>
<portlet-name>NewsPortlet</portlet-name>
@@ -321,11 +330,12 @@
</preference>
</portlet-preferences>
</portlet>
+-->
<portlet>
<description>URL Portlet</description>
<portlet-name>URLPortlet</portlet-name>
<display-name>URL Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.URLPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.URLPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -339,7 +349,7 @@
<description>Async URL Portlet</description>
<portlet-name>AsyncURLPortlet</portlet-name>
<display-name>Async URL Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.URLPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.URLPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -351,7 +361,7 @@
</portlet>
<portlet>
<portlet-name>BasicPortlet</portlet-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.BasicPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.BasicPortlet</portlet-class>
<display-name>Basic Portlet</display-name>
<supports>
<mime-type>text/html</mime-type>
@@ -366,7 +376,7 @@
<description>File System Content Driven Portlet</description>
<portlet-name>FSContentDrivenPortlet</portlet-name>
<display-name>File System Content Driven Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.FSContentDrivenPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.FSContentDrivenPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -381,7 +391,7 @@
<description>File Upload Portlet</description>
<portlet-name>FileUploadPortlet</portlet-name>
<display-name>File Upload Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.FileUploadPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.FileUploadPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -394,7 +404,7 @@
<description>Portlet which performs a programmatic submit of a
form</description>
<portlet-name>FormAutoSubmitPortlet</portlet-name>
<display-name>Form auto submit Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.test.FormAutoSubmitPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.portlet.basic.FormAutoSubmitPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Copied: trunk/core-samples/src/resources/portal-basic-samples-war/dir1 (from rev 7548,
trunk/core-samples/src/resources/portal-samples-war/dir1)
Copied: trunk/core-samples/src/resources/portal-basic-samples-war/dir2 (from rev 7548,
trunk/core-samples/src/resources/portal-samples-war/dir2)