JBoss Portal SVN: r7562 - trunk/core/src/main/org/jboss/portal/core/controller/portlet.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-26 15:11:26 -0400 (Tue, 26 Jun 2007)
New Revision: 7562
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerResponseFactory.java
Log:
handle SecurityError response from portlet actions
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerResponseFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerResponseFactory.java 2007-06-26 18:43:48 UTC (rev 7561)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/ControllerResponseFactory.java 2007-06-26 19:11:26 UTC (rev 7562)
@@ -23,20 +23,18 @@
package org.jboss.portal.core.controller.portlet;
import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.command.response.SignOutResponse;
import org.jboss.portal.core.controller.command.response.RedirectionResponse;
import org.jboss.portal.core.controller.command.response.SecurityErrorResponse;
import org.jboss.portal.core.controller.command.response.UnavailableResourceResponse;
+import org.jboss.portal.core.controller.command.response.ErrorResponse;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.command.response.PortletWindowActionResponse;
import org.jboss.portal.core.model.instance.command.response.PortletInstanceActionResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
-import org.jboss.portal.portlet.invocation.response.InsufficientTransportGuaranteeResponse;
-import org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.RenderResponse;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.NoSuchPortletException;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.common.FixMe;
/**
@@ -73,7 +71,7 @@
public static ControllerResponse createActionResponse(String instanceId, PortletInvocationResponse response)
{
- if (response instanceof RenderResponse)
+ if (response instanceof org.jboss.portal.portlet.invocation.response.RenderResponse)
{
RenderResponse renderResult = (RenderResponse)response;
return new PortletInstanceActionResponse(instanceId, renderResult.getWindowState(), renderResult.getMode(), renderResult.getNavigationalState());
@@ -86,32 +84,36 @@
private static ControllerResponse createResponse(PortletInvocationResponse response)
{
- if (response instanceof HTTPRedirectionResponse)
+ if (response instanceof org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse)
{
- HTTPRedirectionResponse redirection = (HTTPRedirectionResponse)response;
+ org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse redirection = (org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse)response;
String location = redirection.getLocation();
return new RedirectionResponse(location);
}
- else if (response instanceof InsufficientTransportGuaranteeResponse)
+ else if (response instanceof org.jboss.portal.portlet.invocation.response.InsufficientTransportGuaranteeResponse)
{
return new SecurityErrorResponse(SecurityErrorResponse.NOT_SECURE, false);
}
- else if (response instanceof InsufficientPrivilegesResponse)
+ else if (response instanceof org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse)
{
return new SecurityErrorResponse(SecurityErrorResponse.NOT_AUTHORIZED, false);
}
- else if (response instanceof SignOutResponse)
+ else if (response instanceof org.jboss.portal.core.controller.portlet.SignOutResponse)
{
- return new org.jboss.portal.core.controller.command.response.SignOutResponse();
+ return new SignOutResponse();
}
- else if (response instanceof ErrorResponse)
+ else if (response instanceof org.jboss.portal.portlet.invocation.response.ErrorResponse)
{
- return new org.jboss.portal.core.controller.command.response.ErrorResponse(((ErrorResponse)response).getCause(), false);
+ return new ErrorResponse(((org.jboss.portal.portlet.invocation.response.ErrorResponse)response).getCause(), false);
}
+ else if (response instanceof org.jboss.portal.portlet.invocation.response.SecurityErrorResponse)
+ {
+ org.jboss.portal.portlet.invocation.response.SecurityErrorResponse ser = (org.jboss.portal.portlet.invocation.response.SecurityErrorResponse)response;
+ return new SecurityErrorResponse(ser.getThrowable(), SecurityErrorResponse.NOT_AUTHORIZED, false);
+ }
else
{
- throw new FixMe();
+ throw new FixMe("Undefined response mapping for " + response);
}
}
-
}
18 years, 10 months
JBoss Portal SVN: r7561 - trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-06-26 14:43:48 -0400 (Tue, 26 Jun 2007)
New Revision: 7561
Modified:
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error/page.jsp
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error/portal.jsp
Log:
Display the stacktrace on errors.
Bit prettier.
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error/page.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error/page.jsp 2007-06-26 17:46:46 UTC (rev 7560)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error/page.jsp 2007-06-26 18:43:48 UTC (rev 7561)
@@ -1,3 +1,14 @@
-Error type: <%= request.getAttribute("org.jboss.portal.control.ERROR_TYPE") %><br/>
-Cause: <%= request.getAttribute("org.jboss.portal.control.CAUSE") %><br/>
-Message: <%= request.getAttribute("org.jboss.portal.control.MESSAGE") %><br/>
+<%@page import="java.lang.Throwable"%>
+<%@page import="org.jboss.portal.common.util.Exceptions"%>
+
+<h2 class="portlet-msg-error"><%= request.getAttribute("org.jboss.portal.control.ERROR_TYPE") %></h2>
+<div class="portlet-font">Cause: <%= request.getAttribute("org.jboss.portal.control.CAUSE") %></div>
+<%
+ if (request.getAttribute("org.jboss.portal.control.MESSAGE") != null)
+ {
+%>
+<div class="portlet-font">Message: <%= request.getAttribute("org.jboss.portal.control.MESSAGE") %></div>
+<%
+ }
+%>
+<div class="portlet-font">StackTrace: <%= Exceptions.toHTML((Throwable)request.getAttribute("org.jboss.portal.control.CAUSE")) %></div>
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error/portal.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error/portal.jsp 2007-06-26 17:46:46 UTC (rev 7560)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/error/portal.jsp 2007-06-26 18:43:48 UTC (rev 7561)
@@ -1,3 +1,14 @@
-Error type: <%= request.getAttribute("org.jboss.portal.control.ERROR_TYPE") %><br/>
-Cause: <%= request.getAttribute("org.jboss.portal.control.CAUSE") %><br/>
-Message: <%= request.getAttribute("org.jboss.portal.control.MESSAGE") %><br/>
+<%@page import="java.lang.Throwable"%>
+<%@page import="org.jboss.portal.common.util.Exceptions"%>
+
+<h2 class="portlet-msg-error"><%= request.getAttribute("org.jboss.portal.control.ERROR_TYPE") %></h2>
+<div class="portlet-font">Cause: <%= request.getAttribute("org.jboss.portal.control.CAUSE") %></div>
+<%
+ if (request.getAttribute("org.jboss.portal.control.MESSAGE") != null)
+ {
+%>
+<div class="portlet-font">Message: <%= request.getAttribute("org.jboss.portal.control.MESSAGE") %></div>
+<%
+ }
+%>
+<div class="portlet-font">StackTrace: <%= Exceptions.toHTML((Throwable)request.getAttribute("org.jboss.portal.control.CAUSE")) %></div>
\ No newline at end of file
18 years, 10 months
JBoss Portal SVN: r7560 - in trunk/core-cms/src: resources/portal-cms-war/WEB-INF/jsp/cms/editor and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-26 13:46:46 -0400 (Tue, 26 Jun 2007)
New Revision: 7560
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSContentEditorPortlet.java
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp
Log:
update cms integration content selector workflow
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSContentEditorPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSContentEditorPortlet.java 2007-06-26 16:47:03 UTC (rev 7559)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSContentEditorPortlet.java 2007-06-26 17:46:46 UTC (rev 7560)
@@ -25,6 +25,9 @@
import java.io.IOException;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
@@ -61,12 +64,26 @@
public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (req.getPortletMode().equals(EDIT_CONTENT))
+ if (req.getPortletMode().equals(EDIT_CONTENT) && req.getParameter("content.action.select") != null)
{
- String path = req.getParameter("path");
- if (path != null)
+ String contentURI = req.getParameter("content.uri");
+ if (contentURI != null)
{
- resp.setRenderParameter("path", path);
+ // Will contain the next render params
+ Map params = new HashMap();
+
+ //
+ params.put("content.uri", new String[]{contentURI});
+
+ //
+ String catParam = req.getParameter("path");
+ if (catParam != null)
+ {
+ params.put("path", new String[]{catParam});
+ }
+
+ //
+ resp.setRenderParameters(params);
}
}
}
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp 2007-06-26 16:47:03 UTC (rev 7559)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp 2007-06-26 17:46:46 UTC (rev 7560)
@@ -90,7 +90,8 @@
{
File file = (File)files.get(j);
- PortletURL metaURL = renderResponse.createRenderURL();
+ PortletURL metaURL = renderResponse.createActionURL();
+ metaURL.setParameter("content.action.select", "select");
metaURL.setParameter("content.uri", file.getBasePath());
metaURL.setParameter("path", sCurrPath);
@@ -103,6 +104,7 @@
out.println("<tr onmouseover=\"this.className='portlet-section-alternate';\" onmouseout=\"this.className='portlet-section-body';\">");
}
%>
+<tr>
<td><img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/file.gif"
alt="${n:i18n("CMS_FILE")}"
border="0"> <a href="<%= metaURL %>"><%=
@@ -134,12 +136,6 @@
%>
</p>
<%
- PortletURL submitURL = renderResponse.createActionURL();
- submitURL.setParameter("content.uri", uri);
- submitURL.setParameter("content.action.select", "select");
-%>
-<a href="<%= submitURL.toString() %>">Confirm</a>
-<%
}
}
-%>
+%>
\ No newline at end of file
18 years, 10 months
JBoss Portal SVN: r7559 - in trunk: samples/src/main/org/jboss/samples/portlet and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-26 12:47:03 -0400 (Tue, 26 Jun 2007)
New Revision: 7559
Removed:
trunk/samples/src/main/org/jboss/samples/portlet/event/
trunk/samples/src/main/org/jboss/samples/portlet/jsp/
trunk/samples/src/main/org/jboss/samples/portlet/news/
trunk/samples/src/main/org/jboss/samples/portlet/weather/
Modified:
trunk/build/build.xml
trunk/build/distrib.xml
Log:
update distrib.xml with right samples
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2007-06-26 16:46:07 UTC (rev 7558)
+++ trunk/build/build.xml 2007-06-26 16:47:03 UTC (rev 7559)
@@ -127,7 +127,6 @@
<module name="bridge"/>
<module name="cms"/>
<module name="format"/>
- <module name="samples"/>
<module name="core"/>
<module name="core-cms"/>
<module name="core-management"/>
@@ -144,7 +143,7 @@
<group name="portal">
<include
- modules="common, test, api, web, jems, server, security, identity, search, format, portlet, portlet-server, bridge, faces, portlet-federation, theme, workflow, cms, samples, registration, core, wsrp, core-admin, core-cms, core-management, core-samples, widget"/>
+ modules="common, test, api, web, jems, server, security, identity, search, format, portlet, portlet-server, bridge, faces, portlet-federation, theme, workflow, cms, registration, core, wsrp, core-admin, core-cms, core-management, core-samples, widget"/>
</group>
<group name="cms">
Modified: trunk/build/distrib.xml
===================================================================
--- trunk/build/distrib.xml 2007-06-26 16:46:07 UTC (rev 7558)
+++ trunk/build/distrib.xml 2007-06-26 16:47:03 UTC (rev 7559)
@@ -227,10 +227,14 @@
</copy>
<copy todir="${portal.build.normal.bin}/jboss-portal.sar">
<fileset dir="${source.dir}/widget/output/resources" includes="widget.war/**"/>
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-samples.sar/**"/>
<fileset dir="${source.dir}/core-management/output/resources" includes="portal-management.sar/**"/>
<fileset dir="${source.dir}/core-admin/output/resources" includes="portal-admin.sar/**"/>
</copy>
+ <copy todir="${portal.build.normal.bin}/jboss-portal.sar/samples">
+ <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-jsp-samples.war/**"/>
+ <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-news-samples.war/**"/>
+ <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-weather-samples.war/**"/>
+ </copy>
<mkdir dir="${portal.build.normal.bin}/jboss-portal.sar/portal-wsrp.sar"/>
<copy todir="${portal.build.normal.bin}/jboss-portal.sar/portal-wsrp.sar">
<fileset dir="${source.dir}/wsrp/output/lib/portal-wsrp-exploded.sar"/>
@@ -253,10 +257,14 @@
</copy>
<copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar">
<fileset dir="${source.dir}/widget/output/resources" includes="widget.war/**"/>
- <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-samples.sar/**"/>
<fileset dir="${source.dir}/core-management/output/resources" includes="portal-management.sar/**"/>
<fileset dir="${source.dir}/core-admin/output/resources" includes="portal-admin.sar/**"/>
</copy>
+ <copy todir="${portal.build.normal.bin}/jboss-portal-ha.sar/samples">
+ <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-jsp-samples.war/**"/>
+ <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-news-samples.war/**"/>
+ <fileset dir="${source.dir}/core-samples/output/resources" includes="portal-weather-samples.war/**"/>
+ </copy>
<mkdir dir="${portal.build.ha.bin}/jboss-portal-ha.sar/portal-wsrp.sar"/>
<copy todir="${portal.build.ha.bin}/jboss-portal-ha.sar/portal-wsrp.sar">
<fileset dir="${source.dir}/wsrp/output/lib/portal-wsrp-exploded.sar"/>
18 years, 10 months
JBoss Portal SVN: r7558 - trunk/portlet/src/main/org/jboss/portal/portlet/impl/container.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-26 12:46:07 -0400 (Tue, 26 Jun 2007)
New Revision: 7558
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
Log:
on portlet app deployment put the key that is a duplicate or absent during add/remove operations
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java 2007-06-26 16:30:55 UTC (rev 7557)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/container/PortletApplicationRegistryImpl.java 2007-06-26 16:46:07 UTC (rev 7558)
@@ -61,13 +61,14 @@
}
synchronized (this)
{
- if (portletApplications.containsKey(portletApplication.getId()))
+ String key = portletApplication.getId();
+ if (portletApplications.containsKey(key))
{
- throw new IllegalArgumentException("This portlet app is already registered");
+ throw new IllegalArgumentException("This portlet app is already registered: " + key);
}
PortletApplicationRegistrationContext ctx = new PortletApplicationRegistrationContextImpl(portletApplication);
Map webAppsCopy = new HashMap(portletApplications);
- webAppsCopy.put(portletApplication.getId(), portletApplication);
+ webAppsCopy.put(key, portletApplication);
portletApplications = webAppsCopy;
return ctx;
}
@@ -81,12 +82,13 @@
}
synchronized (this)
{
- if (!portletApplications.containsKey(portletApplication.getId()))
+ String key = portletApplication.getId();
+ if (!portletApplications.containsKey(key))
{
- throw new IllegalArgumentException("This portlet app does not exist here");
+ throw new IllegalArgumentException("This portlet app does not exist here: " + key);
}
Map webAppsCopy = new HashMap(portletApplications);
- webAppsCopy.remove(portletApplication.getId());
+ webAppsCopy.remove(key);
portletApplications = webAppsCopy;
}
}
18 years, 10 months
JBoss Portal SVN: r7557 - trunk/core/src/main/org/jboss/portal/core/impl/model/portal.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-06-26 12:30:55 -0400 (Tue, 26 Jun 2007)
New Revision: 7557
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
Log:
JBPORTAL-1504: Child inherited properties were not updated
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-06-26 16:04:53 UTC (rev 7556)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-06-26 16:30:55 UTC (rev 7557)
@@ -405,24 +405,52 @@
{
declaredPropertyMap.remove(name);
- // If aggregated properties is loaded then we udpate it
- if (properties != null)
- {
- properties.remove(name);
- }
+ removeProperty(name);
}
else
{
declaredPropertyMap.put(name, value);
- // If aggregated properties is loaded then we udpate it
- if (properties != null)
+ setProperty(name, value);
+ }
+ }
+
+ private void removeProperty(String name)
+ {
+ if (properties != null)
+ {
+ properties.remove(name);
+ }
+
+ Iterator it = this.getChildren().iterator();
+ while (it.hasNext())
+ {
+ PortalObject object = (PortalObject) it.next();
+ if (object instanceof PortalObjectImpl)
{
- properties.put(name, value);
+ ((PortalObjectImpl)object).removeProperty(name);
}
}
}
+ private void setProperty(String name, String value)
+ {
+ if (properties != null)
+ {
+ properties.put(name, value);
+ }
+
+ Iterator it = this.getChildren().iterator();
+ while (it.hasNext())
+ {
+ PortalObject object = (PortalObject) it.next();
+ if (object instanceof PortalObjectImpl)
+ {
+ ((PortalObjectImpl)object).setProperty(name, value);
+ }
+ }
+ }
+
public String getProperty(String name)
{
if (name == null)
18 years, 10 months
JBoss Portal SVN: r7554 - in trunk/core-samples: src/main/org/jboss/portal/core and 13 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-26 11:59:38 -0400 (Tue, 26 Jun 2007)
New Revision: 7554
Added:
trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/
trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/jsp/
trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/jsp/view.jsp
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/default-object.xml
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/Rss1.xsl
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/Rss2.xsl
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/default-object.xml
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/xsl/
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/xsl/weather/
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/xsl/weather/Rss.xsl
Removed:
trunk/core-samples/src/main/org/jboss/portal/core/portlet/
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/info/view.jsp
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/xsl/news/Rss1.xsl
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/xsl/news/Rss2.xsl
Modified:
trunk/core-samples/build.xml
trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet.xml
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet.xml
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet.xml
Log:
consolidate new samples structure
Modified: trunk/core-samples/build.xml
===================================================================
--- trunk/core-samples/build.xml 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/build.xml 2007-06-26 15:59:38 UTC (rev 7554)
@@ -193,28 +193,19 @@
<!-- portal-basic-samples-lib.jar -->
<jar jarfile="${build.lib}/portal-basic-samples-lib.jar">
- <fileset dir="${build.classes}" includes="org/jboss/portal/core/portlet/basic/**">
+ <fileset dir="${build.classes}" includes="org/jboss/portal/core/samples/basic/**">
</fileset>
</jar>
- <copy todir="${build.resources}/portal-basic-samples">
+ <copy todir="${build.resources}/portal-basic-samples.sar">
<fileset dir="${build.resources}/portal-basic-samples-sar"/>
</copy>
- <copy todir="${build.resources}/portal-samples/portal-basic-samples.war">
+ <copy todir="${build.resources}/portal-basic-samples.sar/portal-basic-samples.war">
<fileset dir="${source.bin}/portal-basic-samples-war"/>
<fileset dir="${build.resources}/portal-basic-samples-war"/>
</copy>
- <copy todir="${build.resources}/portal-basic-samples/lib">
+ <copy todir="${build.resources}/portal-basic-samples.sar/lib">
<fileset dir="${build.lib}" includes="portal-basic-samples-lib.jar"/>
</copy>
- <copy todir="${build.resources}/portal-basic-samples.sar">
- <fileset dir="${build.resources}/portal-basic-samples" excludes="**/*.xml"/>
- </copy>
- <copy todir="${build.resources}/portal-basic-samples.sar">
- <filterset>
- <filtersfile file="../build/etc/single.properties"/>
- </filterset>
- <fileset dir="${build.resources}/portal-basic-samples" includes="**/*.xml"/>
- </copy>
<!-- portal-jsp-samples.war -->
<copy todir="${build.resources}/portal-jsp-samples.war">
Modified: trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java 2007-06-26 15:59:38 UTC (rev 7554)
@@ -33,7 +33,7 @@
*/
public class JSPPortlet extends GenericPortlet
{
- private static final String JSP_PATH = "/WEB-INF/jsp/info";
+ private static final String JSP_PATH = "/WEB-INF/jsp/jsp";
protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
{
Modified: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2007-06-26 15:59:38 UTC (rev 7554)
@@ -31,37 +31,6 @@
<parent-ref>default</parent-ref>
<if-exists>keep</if-exists>
<page>
- <page-name>News</page-name>
- <properties>
- <property>
- <name>order</name>
- <value>3</value>
- </property>
- </properties>
- <window>
- <window-name>WeatherPortletWindow</window-name>
- <instance-ref>WeatherPortletInstance</instance-ref>
- <region>left</region>
- <height>0</height>
- </window>
- <window>
- <window-name>NewsPortletWindow</window-name>
- <instance-ref>NewsPortletInstance</instance-ref>
- <region>center</region>
- <height>0</height>
- </window>
- <window>
- <window-name>NewsPortletWindow2</window-name>
- <instance-ref>NewsPortletInstance2</instance-ref>
- <region>center</region>
- <height>1</height>
- </window>
- </page>
- </deployment>
- <deployment>
- <parent-ref>default</parent-ref>
- <if-exists>keep</if-exists>
- <page>
<page-name>Test</page-name>
<properties>
<property>
Deleted: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/info/view.jsp
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/info/view.jsp 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/info/view.jsp 2007-06-26 15:59:38 UTC (rev 7554)
@@ -1,63 +0,0 @@
-<%@ page import="org.jboss.portal.server.PortalConstants" %>
-<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-~ 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. ~
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
-
-<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
-<%@ page isELIgnored="false" %>
-
-<portlet:defineObjects/>
-
-<table border="0" cellspacing="2" cellpadding="2">
- <tr>
- <td align="center"><a href="http://portal.demo.jboss.com" target="_blank"><img
- src="<%= renderRequest.getContextPath() %>/images/dodemo.gif" border="0"
- alt="Try the latest release of JBoss Portal, live and online."></a>
- <a href="http://labs.jboss.com/portal/jbossportal/download/index.html" target="_blank"><img
- src="<%= renderRequest.getContextPath() %>/images/getcode.gif" border="0"
- alt="Download JBoss Portal and have it up and running in minutes."></a>
- <a href="http://www.portletswap.com" target="_blank"><img
- src="<%= renderRequest.getContextPath() %>/images/accessorize.gif" border="0"
- alt="Download portlets and layouts for your new JBoss Portal installation."></a></td>
- </tr>
- <tr>
- <td></td>
- </tr>
- <tr>
- <td class="portlet-section-alternate">
- <font class="portlet-font">This is a basic installation of <b><%= PortalConstants.VERSION %></b>. You may
- log in at any time, using the <i>Login</i> link at the top-right of this page, with the following
- credentials:</font>
- </td>
- </tr>
- <tr>
- <td class="portlet-section-alternate" align="center">
- <b>user/user</b> or <b>admin/admin</b>
- </td>
- </tr>
- <tr>
- <td align="center">
- If you are in need of guidance with regards to navigating, configuring, or operating the portal, please view
- our <a href="http://labs.jboss.com/portal/jbossportal/docs/index.html" target="_blank">online documentation</a>.
- </td>
- </tr>
-</table>
Deleted: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/xsl/news/Rss1.xsl
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/xsl/news/Rss1.xsl 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/xsl/news/Rss1.xsl 2007-06-26 15:59:38 UTC (rev 7554)
@@ -1,54 +0,0 @@
-<?xml version="1.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. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-
- <xsl:output method="html"/>
-
- <xsl:template match="/">
- <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
- <xsl:apply-templates/>
- </TABLE>
- </xsl:template>
-
- <xsl:template match="item">
- <TR>
- <TD>
- -
- <A TARGET="_popup" STYLE="text-decoration: none;">
- <xsl:attribute name="HREF">
- <xsl:value-of select="link"/>
- </xsl:attribute>
- <xsl:value-of select="title"/>
- </A>
- </TD>
- </TR>
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="text()"/>
-</xsl:stylesheet>
\ No newline at end of file
Deleted: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/xsl/news/Rss2.xsl
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/xsl/news/Rss2.xsl 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/xsl/news/Rss2.xsl 2007-06-26 15:59:38 UTC (rev 7554)
@@ -1,46 +0,0 @@
-<?xml version="1.0" ?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
-
- <xsl:variable name="link-path">
- <xsl:value-of select="rss/channel/link"/>
- </xsl:variable>
-
- <xsl:template match="/">
- <div style="font-size: 1.5em;" class="portlet-section-header">
- <a href="{$link-path}" target="_blank">
- <xsl:value-of select="rss/channel/title"/> - <xsl:value-of select="rss/channel/description"/>
- </a>
- </div>
- <ul>
- <xsl:for-each select="rss/channel/item">
- <xsl:variable name="this-link">
- <xsl:value-of select="link"/>
- </xsl:variable>
- <li>
- <div class="portlet-section-subheader">
- <a href="{$this-link}" target="_blank">
- <xsl:value-of select="title"/>
- </a>
- </div>
- <div class="portlet-font-dim">
- <xsl:if test="string(author)">
- <xsl:value-of select="author"/>
- </xsl:if>
- <xsl:if test="string(author) and string(pubDate)">
-  - 
- </xsl:if>
- <xsl:if test="string(pubDate)">
- <xsl:value-of select="pubDate"/>
- </xsl:if>
- </div>
- </li>
- <!-- <xsl:value-of select="description" disable-output-escaping="yes"/>
- <br/>-->
- </xsl:for-each>
- </ul>
- <br/>
- <br/>
- <xsl:value-of select="rss/channel/copyright"/>
- </xsl:template>
-</xsl:stylesheet>
Added: trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/jsp/view.jsp
===================================================================
--- trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/jsp/view.jsp (rev 0)
+++ trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jsp/jsp/view.jsp 2007-06-26 15:59:38 UTC (rev 7554)
@@ -0,0 +1,63 @@
+<%@ page import="org.jboss.portal.server.PortalConstants" %>
+<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~ 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. ~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
+
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ page isELIgnored="false" %>
+
+<portlet:defineObjects/>
+
+<table border="0" cellspacing="2" cellpadding="2">
+ <tr>
+ <td align="center"><a href="http://portal.demo.jboss.com" target="_blank"><img
+ src="<%= renderRequest.getContextPath() %>/images/dodemo.gif" border="0"
+ alt="Try the latest release of JBoss Portal, live and online."></a>
+ <a href="http://labs.jboss.com/portal/jbossportal/download/index.html" target="_blank"><img
+ src="<%= renderRequest.getContextPath() %>/images/getcode.gif" border="0"
+ alt="Download JBoss Portal and have it up and running in minutes."></a>
+ <a href="http://www.portletswap.com" target="_blank"><img
+ src="<%= renderRequest.getContextPath() %>/images/accessorize.gif" border="0"
+ alt="Download portlets and layouts for your new JBoss Portal installation."></a></td>
+ </tr>
+ <tr>
+ <td></td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate">
+ <font class="portlet-font">This is a basic installation of <b><%= PortalConstants.VERSION %></b>. You may
+ log in at any time, using the <i>Login</i> link at the top-right of this page, with the following
+ credentials:</font>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center">
+ <b>user/user</b> or <b>admin/admin</b>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ If you are in need of guidance with regards to navigating, configuring, or operating the portal, please view
+ our <a href="http://labs.jboss.com/portal/jbossportal/docs/index.html" target="_blank">online documentation</a>.
+ </td>
+ </tr>
+</table>
Modified: trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet.xml 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet.xml 2007-06-26 15:59:38 UTC (rev 7554)
@@ -31,7 +31,7 @@
<description>Simple JSP portlet</description>
<portlet-name>JSPPortlet</portlet-name>
<display-name>JSP Portlet</display-name>
- <portlet-class>org.jboss.samples.portlet.jsp.JSPPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.samples.jsp.JSPPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Added: trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/default-object.xml (rev 0)
+++ trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/default-object.xml 2007-06-26 15:59:38 UTC (rev 7554)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portal Object 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
+
+<deployments>
+ <deployment>
+ <parent-ref>default</parent-ref>
+ <if-exists>keep</if-exists>
+ <page>
+ <page-name>News</page-name>
+ <properties>
+ <property>
+ <name>order</name>
+ <value>3</value>
+ </property>
+ </properties>
+ <window>
+ <window-name>NewsPortletWindow</window-name>
+ <instance-ref>NewsPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ <window>
+ <window-name>NewsPortletWindow2</window-name>
+ <instance-ref>NewsPortletInstance2</instance-ref>
+ <region>center</region>
+ <height>2</height>
+ </window>
+ </page>
+ </deployment>
+</deployments>
Modified: trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet.xml 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet.xml 2007-06-26 15:59:38 UTC (rev 7554)
@@ -31,7 +31,7 @@
<description>Portlet aggregating news from different feeds</description>
<portlet-name>NewsPortlet</portlet-name>
<display-name>News Portlet</display-name>
- <portlet-class>org.jboss.samples.portlet.news.NewsPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.samples.news.NewsPortlet</portlet-class>
<init-param>
<name>RSS1_XSL</name>
<value>/WEB-INF/Rss1.xsl</value>
Added: trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/Rss1.xsl
===================================================================
--- trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/Rss1.xsl (rev 0)
+++ trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/Rss1.xsl 2007-06-26 15:59:38 UTC (rev 7554)
@@ -0,0 +1,54 @@
+<?xml version="1.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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+ <xsl:output method="html"/>
+
+ <xsl:template match="/">
+ <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
+ <xsl:apply-templates/>
+ </TABLE>
+ </xsl:template>
+
+ <xsl:template match="item">
+ <TR>
+ <TD>
+ -
+ <A TARGET="_popup" STYLE="text-decoration: none;">
+ <xsl:attribute name="HREF">
+ <xsl:value-of select="link"/>
+ </xsl:attribute>
+ <xsl:value-of select="title"/>
+ </A>
+ </TD>
+ </TR>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="text()"/>
+</xsl:stylesheet>
\ No newline at end of file
Added: trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/Rss2.xsl
===================================================================
--- trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/Rss2.xsl (rev 0)
+++ trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/xsl/news/Rss2.xsl 2007-06-26 15:59:38 UTC (rev 7554)
@@ -0,0 +1,46 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
+
+ <xsl:variable name="link-path">
+ <xsl:value-of select="rss/channel/link"/>
+ </xsl:variable>
+
+ <xsl:template match="/">
+ <div style="font-size: 1.5em;" class="portlet-section-header">
+ <a href="{$link-path}" target="_blank">
+ <xsl:value-of select="rss/channel/title"/> - <xsl:value-of select="rss/channel/description"/>
+ </a>
+ </div>
+ <ul>
+ <xsl:for-each select="rss/channel/item">
+ <xsl:variable name="this-link">
+ <xsl:value-of select="link"/>
+ </xsl:variable>
+ <li>
+ <div class="portlet-section-subheader">
+ <a href="{$this-link}" target="_blank">
+ <xsl:value-of select="title"/>
+ </a>
+ </div>
+ <div class="portlet-font-dim">
+ <xsl:if test="string(author)">
+ <xsl:value-of select="author"/>
+ </xsl:if>
+ <xsl:if test="string(author) and string(pubDate)">
+  - 
+ </xsl:if>
+ <xsl:if test="string(pubDate)">
+ <xsl:value-of select="pubDate"/>
+ </xsl:if>
+ </div>
+ </li>
+ <!-- <xsl:value-of select="description" disable-output-escaping="yes"/>
+ <br/>-->
+ </xsl:for-each>
+ </ul>
+ <br/>
+ <br/>
+ <xsl:value-of select="rss/channel/copyright"/>
+ </xsl:template>
+</xsl:stylesheet>
Added: trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/default-object.xml (rev 0)
+++ trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/default-object.xml 2007-06-26 15:59:38 UTC (rev 7554)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portal Object 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
+
+<deployments>
+ <deployment>
+ <parent-ref>default</parent-ref>
+ <if-exists>keep</if-exists>
+ <page>
+ <page-name>Weather</page-name>
+ <properties>
+ <property>
+ <name>order</name>
+ <value>3</value>
+ </property>
+ </properties>
+ <window>
+ <window-name>WeatherPortletWindow</window-name>
+ <instance-ref>WeatherPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </deployment>
+</deployments>
Modified: trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet.xml 2007-06-26 15:28:42 UTC (rev 7553)
+++ trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet.xml 2007-06-26 15:59:38 UTC (rev 7554)
@@ -31,7 +31,7 @@
<description>Portlet providing weather forecast</description>
<portlet-name>WeatherPortlet</portlet-name>
<display-name>Weather Portlet</display-name>
- <portlet-class>org.jboss.samples.portlet.weather.WeatherPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.samples.weather.WeatherPortlet</portlet-class>
<init-param>
<name>default_zipcode</name>
<value>33145</value>
Added: trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/xsl/weather/Rss.xsl
===================================================================
--- trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/xsl/weather/Rss.xsl (rev 0)
+++ trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/xsl/weather/Rss.xsl 2007-06-26 15:59:38 UTC (rev 7554)
@@ -0,0 +1,100 @@
+<?xml version="1.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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
+ <xsl:variable name="image-path">http://us.i1.yimg.com/us.yimg.com/i/us/we/52/</xsl:variable>
+ <xsl:variable name="link-path">
+ <xsl:value-of select="rss/channel/link"/>
+ </xsl:variable>
+ <xsl:template match="/">
+ <br/>
+ <div align="center">
+ <font>
+ <b>
+ <xsl:for-each select="rss/channel/location">
+ <xsl:value-of select="@city"/>, <xsl:value-of select="@region"/>, <xsl:value-of
+ select="@country"/>
+ </xsl:for-each>
+ </b>
+ </font>
+ <br/>
+ <br/>
+ <table width="130" border="0">
+ <tr>
+ <xsl:for-each select="rss/channel/item/condition">
+ <td>
+ <table border="0" height="130">
+ <tr>
+ <td class="portlet-section-header" align="center">Currently</td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center" valign="top">
+ <img src="{$image-path}/{(a)code}.gif"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center" valign="top">
+ <xsl:value-of select="@text"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center" valign="top">
+ <xsl:value-of select="@temp"/>F</td>
+ </tr>
+ </table>
+ </td>
+ </xsl:for-each>
+ <xsl:for-each select="rss/channel/item/forecast">
+ <td>
+ <table border="0" height="130">
+ <tr>
+ <td class="portlet-section-header" align="center" valign="top">
+ <xsl:value-of select="@day"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center" valign="top">
+ <img src="{$image-path}/{(a)code}.gif"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center" valign="top">
+ <xsl:value-of select="@text"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="portlet-section-alternate" align="center" valign="top">
+ <xsl:value-of select="@low"/>F/<xsl:value-of select="@high"/>F</td>
+ </tr>
+ </table>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </table>
+ <br/>
+ <a href="{$link-path}" target="_blank">Complete Forecast</a>
+ </div>
+ </xsl:template>
+</xsl:stylesheet>
18 years, 10 months
JBoss Portal SVN: r7553 - in trunk/core-samples/src: main/org/jboss/portal/core/samples and 4 other directories.
by portal-commits@lists.jboss.org
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>
18 years, 10 months