Author: chris.laprun(a)jboss.com
Date: 2008-02-06 16:56:20 -0500 (Wed, 06 Feb 2008)
New Revision: 9810
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/test/src/test/build.xml
Log:
- Resource serving portlet supposed to act as a remote control... doesn't really work
right now.
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java 2008-02-06
21:56:20 UTC (rev 9810)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2008, Your Corporation. All Rights Reserved.
+ */
+
+package org.jboss.portal.simple.samples;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class RemoteControlResourcePortlet extends GenericPortlet
+{
+ private static final String ZIPCODE = "zipcode";
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ PrintWriter printWriter = renderResponse.getWriter();
+ printWriter.print("<p><a href=\"");
+ String url = "javascript:window.open('";
+ ResourceURL resource = renderResponse.createResourceURL();
+ url += resource + "','Remote
Control','width=400,height=200')";
+ printWriter.print(url);
+ printWriter.print("\">Open remote
control!</a></p>");
+ }
+
+ @Override
+ public void serveResource(ResourceRequest resourceRequest, ResourceResponse
resourceResponse) throws PortletException, IOException
+ {
+ resourceResponse.setContentType("text/html");
+ PrintWriter writer = resourceResponse.getWriter();
+ PortletURL url = resourceResponse.createRenderURL();
+ url.setWindowState(WindowState.MINIMIZED);
+ writer.print("<ul><li><a target='_parent'
href='" + url + "'>minimize</a></li>");
+ url.setWindowState(WindowState.MAXIMIZED);
+ writer.print("<li><a href='" + url +
"'>maximize</a></li>");
+ url.setWindowState(WindowState.NORMAL);
+ writer.print("<li><a href='" + url +
"'>normal</a></li></ul>");
+ writer.print("<p><b>'zipcode'</b> public render
parameter value: " + resourceRequest.getParameter(ZIPCODE) +
"<br/>");
+ writer.print("<p>Set value of <b>'zipcode'</b>
public render parameter to:");
+ url.setParameter(ZIPCODE, "80201");
+ writer.print("<li><a href='" + url +
"'>Denver</a>");
+ url.setParameter(ZIPCODE, "94102");
+ writer.print("<li><a href='" + url + "'>San
Francisco</a>");
+ url.setParameter(ZIPCODE, "20001");
+ writer.print("<li><a href='" + url +
"'>Washington, DC</a>");
+ writer.print("</ul></p>");
+ }
+}
Property changes on:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/simple/samples/RemoteControlResourcePortlet.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-06 20:39:58 UTC (rev 9809)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-06 21:56:20 UTC (rev 9810)
@@ -759,6 +759,15 @@
<jar jarfile="${target}/google-weather-portlet.war">
<fileset dir="${test.temp.dir}/google-weather-portlet-war"/>
</jar>
+
+ <copy todir="${test.temp.dir}/remotecontrol-portlet-war">
+ <fileset dir="src/test/resources/remotecontrol-portlet-war"/>
+ <fileset dir="${target}/classes"
+
includes="org/jboss/portal/simple/samples/RemoteControlResourcePortlet.class"/>
+ </copy>
+ <jar jarfile="${target}/remotecontrol-portlet.war">
+ <fileset dir="${test.temp.dir}/remotecontrol-portlet-war"/>
+ </jar>
</target>
</project>
\ No newline at end of file
Copied:
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/portlet.xml
(from rev 9803,
modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml)
===================================================================
---
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/portlet.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/portlet.xml 2008-02-06
21:56:20 UTC (rev 9810)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2008, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+ <portlet>
+ <description>Portlet controlling display of other
portlets</description>
+ <portlet-name>RemoteControl</portlet-name>
+ <display-name>Remote Control Resource Portlet</display-name>
+
<portlet-class>org.jboss.portal.simple.samples.RemoteControlResourcePortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Remote Control Resource Portlet</title>
+ <keywords>sample,resource,remotecontrol</keywords>
+ </portlet-info>
+
<supported-public-render-parameter>zipcode</supported-public-render-parameter>
+ </portlet>
+
+ <public-render-parameter>
+ <identifier>zipcode</identifier>
+ <qname
xmlns:g='urn:jboss:portal:simple:google'>g:zipcode</qname>
+ </public-render-parameter>
+</portlet-app>
+
Copied:
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/web.xml
(from rev 9803,
modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/web.xml)
===================================================================
---
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/web.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/remotecontrol-portlet-war/WEB-INF/web.xml 2008-02-06
21:56:20 UTC (rev 9810)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2008, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app/>
+