Author: julien(a)jboss.com
Date: 2007-06-26 11:28:42 -0400 (Tue, 26 Jun 2007)
New Revision: 7553
Added:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/BasicPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/CharsetPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/CounterPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/EncodingPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/ExceptionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FSContentDrivenPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FileUploadPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FormAutoSubmitPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/HeaderContentPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/PortletSessionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/URLPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/
Removed:
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/
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/EventPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortalEventListenerLogger.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortletA.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortletB.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/UserCounterListener.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/WindowConstraintEventListener.java
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.xml
Log:
put basic samples at the right place
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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;
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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;
- }
- }
-
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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();
- }
-
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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();
- }
-
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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();
- }
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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;
- }
- }
- };
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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>");
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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>");
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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();
- }
-}
Deleted:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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>");
- }
-
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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;
- }
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.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
Copied: trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/BasicPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/BasicPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/BasicPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/BasicPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/CharsetPortlet.java (from
rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/CharsetPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/CharsetPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/CharsetPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/CounterPortlet.java (from
rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/CounterPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/CounterPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/CounterPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/EncodingPortlet.java (from
rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/EncodingPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/EncodingPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/EncodingPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/ExceptionPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/ExceptionPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/ExceptionPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/ExceptionPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FSContentDrivenPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FSContentDrivenPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FSContentDrivenPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/FileUploadPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FileUploadPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FileUploadPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/FormAutoSubmitPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FormAutoSubmitPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/FormAutoSubmitPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/HeaderContentPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/HeaderContentPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/HeaderContentPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/HeaderContentPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/PortletSessionPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java)
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/PortletSessionPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/PortletSessionPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/PortletSessionPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/TestPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/URLPortlet.java
(from rev 7551,
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/URLPortlet.java
(rev 0)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/URLPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.samples.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/samples/basic/URLPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event (from rev
7551, trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event)
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/EventPortlet.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/EventPortlet.java 2007-06-26
15:22:59 UTC (rev 7551)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/EventPortlet.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.portal.core.portlet.basic.event;
+package org.jboss.portal.core.samples.basic.event;
import javax.portlet.GenericPortlet;
import javax.portlet.RenderRequest;
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortalEventListenerLogger.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java 2007-06-26
15:22:59 UTC (rev 7551)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortalEventListenerLogger.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.core.samples.basic.event;
import org.jboss.portal.api.event.PortalEventListener;
import org.jboss.portal.api.event.PortalEvent;
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortletA.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java 2007-06-26
15:22:59 UTC (rev 7551)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortletA.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.core.samples.basic.event;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortletB.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java 2007-06-26
15:22:59 UTC (rev 7551)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/PortletB.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.core.samples.basic.event;
import org.jboss.portal.WindowState;
import org.jboss.portal.api.node.PortalNode;
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/UserCounterListener.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java 2007-06-26
15:22:59 UTC (rev 7551)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/UserCounterListener.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.core.samples.basic.event;
import org.jboss.portal.api.event.PortalEvent;
import org.jboss.portal.api.event.PortalEventContext;
Modified:
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/WindowConstraintEventListener.java
===================================================================
---
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java 2007-06-26
15:22:59 UTC (rev 7551)
+++
trunk/core-samples/src/main/org/jboss/portal/core/samples/basic/event/WindowConstraintEventListener.java 2007-06-26
15:28:42 UTC (rev 7553)
@@ -20,7 +20,7 @@
* 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;
+package org.jboss.portal.core.samples.basic.event;
import org.jboss.portal.api.node.event.PortalNodeEventListener;
import org.jboss.portal.api.node.event.PortalNodeEvent;
Modified:
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml 2007-06-26
15:28:42 UTC (rev 7553)
@@ -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.basic.event.PortletB$Listener</attribute>
+ <attribute
name="ListenerClassName">org.jboss.portal.core.samples.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.basic.event.WindowConstraintEventListener</attribute>
+ <attribute
name="ListenerClassName">org.jboss.portal.core.samples.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.basic.event.PortalEventListenerLogger</attribute>
+ <attribute
name="ListenerClassName">org.jboss.portal.core.samples.basic.event.PortalEventListenerLogger</attribute>
</mbean>
<!-- mbean
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
Modified: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
---
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2007-06-26
15:26:42 UTC (rev 7552)
+++
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2007-06-26
15:28:42 UTC (rev 7553)
@@ -46,7 +46,7 @@
<portlet-name>HeaderContentPortlet</portlet-name>
<display-name>Header Content Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.basic.HeaderContentPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.HeaderContentPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -61,7 +61,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.basic.TestPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.TestPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -105,7 +105,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.basic.CounterPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.CounterPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -118,7 +118,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.basic.CounterPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.CounterPortlet</portlet-class>
<expiration-cache>60</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
@@ -131,7 +131,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.basic.ExceptionPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.ExceptionPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -144,7 +144,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.basic.PortletSessionPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.PortletSessionPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -157,7 +157,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.basic.event.PortletA</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.event.PortletA</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -171,7 +171,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.basic.event.PortletB</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.event.PortletB</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -185,7 +185,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.basic.CharsetPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.CharsetPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -200,7 +200,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.basic.EncodingPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.EncodingPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -214,7 +214,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.basic.TestPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.TestPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -230,7 +230,7 @@
<description>URL Portlet</description>
<portlet-name>URLPortlet</portlet-name>
<display-name>URL Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.basic.URLPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.URLPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -244,7 +244,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.basic.URLPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.URLPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -256,7 +256,7 @@
</portlet>
<portlet>
<portlet-name>BasicPortlet</portlet-name>
-
<portlet-class>org.jboss.portal.core.portlet.basic.BasicPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.BasicPortlet</portlet-class>
<display-name>Basic Portlet</display-name>
<supports>
<mime-type>text/html</mime-type>
@@ -271,7 +271,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.basic.FSContentDrivenPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.FSContentDrivenPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -286,7 +286,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.basic.FileUploadPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.FileUploadPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -299,7 +299,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.basic.FormAutoSubmitPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.core.samples.basic.FormAutoSubmitPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>