Author: ate Date: Thu Jun 14 01:55:54 2007 New Revision: 547182 URL: http://svn.apache.org/viewvc?view=rev&rev=547182 Log: JS2-732: A GroovyPortlet demo using the new Portals Bridges GroovyPortlet
Based on the new Portals Bridges GroovyPortlet contributed by Woonsan Ko. See: https://issues.apache.org/jira/browse/JS2-732 and: https://issues.apache.org/jira/browse/PB-69 Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/HelloGroovy.groovy portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-edit.jsp (with props) portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-help.jsp (with props) portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-view.jsp (with props) portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml (with props) Modified: portals/jetspeed-2/trunk/applications/demo/pom.xml portals/jetspeed-2/trunk/applications/demo/project.xml portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml portals/jetspeed-2/trunk/pom.xml portals/jetspeed-2/trunk/project.properties Modified: portals/jetspeed-2/trunk/applications/demo/pom.xml URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/pom.xml?view=diff&rev=547182&r1=547181&r2=547182 ============================================================================== --- portals/jetspeed-2/trunk/applications/demo/pom.xml (original) +++ portals/jetspeed-2/trunk/applications/demo/pom.xml Thu Jun 14 01:55:54 2007 @@ -87,6 +87,10 @@ <artifactId>portals-bridges-velocity</artifactId> </dependency> <dependency> + <groupId>org.apache.portals.bridges</groupId> + <artifactId>portals-bridges-groovy</artifactId> + </dependency> + <dependency> <groupId>velocity-tools</groupId> <artifactId>velocity-tools</artifactId> <scope>runtime</scope> @@ -121,6 +125,26 @@ <artifactId>log4j</artifactId> <scope>runtime</scope> </dependency> + <!-- for groovy --> + <dependency> + <groupId>groovy</groupId> + <artifactId>groovy</artifactId> + <version>1.0</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm</artifactId> + <version>2.2.2</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>antlr</groupId> + <artifactId>antlr</artifactId> + <version>2.7.5</version> + <scope>runtime</scope> + </dependency> + </dependencies> Modified: portals/jetspeed-2/trunk/applications/demo/project.xml URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/project.xml?view=diff&rev=547182&r1=547181&r2=547182 ============================================================================== --- portals/jetspeed-2/trunk/applications/demo/project.xml (original) +++ portals/jetspeed-2/trunk/applications/demo/project.xml Thu Jun 14 01:55:54 2007 @@ -173,6 +173,15 @@ </properties> </dependency> <dependency> + <groupId>org.apache.portals.bridges</groupId> + <artifactId>portals-bridges-groovy</artifactId> + <version>${portals.bridges.groovy.version}</version> + <type>jar</type> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> <id>velocity</id> <version>1.5</version> <properties> @@ -306,6 +315,30 @@ <war.bundle>true</war.bundle> </properties> </dependency> + + <!-- for groovy --> + <dependency> + <id>groovy</id> + <version>1.0</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <id>antlr</id> + <version>2.7.5</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <id>asm</id> + <version>2.2.2</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + </dependencies> Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/HelloGroovy.groovy URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/HelloGroovy.groovy?view=auto&rev=547182 ============================================================================== --- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/HelloGroovy.groovy (added) +++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/HelloGroovy.groovy Thu Jun 14 01:55:54 2007 @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import javax.portlet.GenericPortlet; +import javax.portlet.PortletContext; +import javax.portlet.PortletRequestDispatcher; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; +import javax.portlet.PortletPreferences; +import javax.portlet.PortletMode; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Woonsan Ko</a> + * @version $Id$ + */ +public class HelloGroovy extends GenericPortlet +{ + public void doView(RenderRequest request, RenderResponse response) + { + PortletContext context = getPortletContext(); + PortletRequestDispatcher rd = + context.getRequestDispatcher("/WEB-INF/demo/groovy/hello-groovy-view.jsp"); + rd.include(request, response); + } + + public void doEdit(RenderRequest request, RenderResponse response) + { + PortletContext context = getPortletContext(); + PortletRequestDispatcher rd = + context.getRequestDispatcher("/WEB-INF/demo/groovy/hello-groovy-edit.jsp"); + rd.include(request, response); + } + + public void doHelp(RenderRequest request, RenderResponse response) + { + PortletContext context = getPortletContext(); + PortletRequestDispatcher rd = + context.getRequestDispatcher("/WEB-INF/demo/groovy/hello-groovy-help.jsp"); + rd.include(request,response); + } + + public void processAction(ActionRequest request, ActionResponse response) + { + String message = request.getParameter("message"); + + if (null != message && !"".equals(message)) { + PortletPreferences prefs = request.getPreferences(); + prefs.setValue("message", message); + prefs.store(); + response.setPortletMode(PortletMode.VIEW); + } + } +} \ No newline at end of file Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-edit.jsp URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-edit.jsp?view=auto&rev=547182 ============================================================================== --- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-edit.jsp (added) +++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-edit.jsp Thu Jun 14 01:55:54 2007 @@ -0,0 +1,25 @@ +<%-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--%> +<%@ page session="false" %> +<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<portlet:defineObjects/> + +<form method="post" action="<portlet:actionURL/>"> + Message: <input type="text" name="message" value="<c:out value="${renderRequest.preferences.map.message[0]}"/>"> + <input type="submit" value="Submit"> +</form> \ No newline at end of file Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-edit.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-edit.jsp ------------------------------------------------------------------------------ svn:keywords = Id Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-help.jsp URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-help.jsp?view=auto&rev=547182 ============================================================================== --- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-help.jsp (added) +++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-help.jsp Thu Jun 14 01:55:54 2007 @@ -0,0 +1,19 @@ +<%-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--%> +<h1>Hello Groovy Help</h1> +<hr> +<p>Groovy Portlet support rapid portlet application development.</p> Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-help.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-help.jsp ------------------------------------------------------------------------------ svn:keywords = Id Added: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-view.jsp URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-view.jsp?view=auto&rev=547182 ============================================================================== --- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-view.jsp (added) +++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-view.jsp Thu Jun 14 01:55:54 2007 @@ -0,0 +1,24 @@ +<%-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--%> +<%@ page session="false" %> +<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> +<portlet:defineObjects/> + +<h1> + <c:out value="${renderRequest.preferences.map.message[0]}"/> +</h1> \ No newline at end of file Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-view.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/demo/groovy/hello-groovy-view.jsp ------------------------------------------------------------------------------ svn:keywords = Id Modified: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml?view=diff&rev=547182&r1=547181&r2=547182 ============================================================================== --- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml (original) +++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml Thu Jun 14 01:55:54 2007 @@ -1102,6 +1102,48 @@ </portlet-preferences> </portlet> + <portlet id="HelloGroovy"> + <portlet-name>HelloGroovy</portlet-name> + <display-name>Hello Groovy</display-name> + <portlet-class>org.apache.portals.bridges.groovy.GroovyPortlet</portlet-class> + <init-param> + <name>script-source</name> + <!-- Note: You can set script source in three ways. + The first is to use relative path uri, + the second is to use file: url, + and the last is to classpath: uri --> + <!-- + <value>/WEB-INF/groovy/HelloGroovy.groovy</value> + <value>file:/C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/demo/WEB-INF/groovy/HelloGroovy.groovy</value> + <value>classpath:HelloGroovy.groovy</value> + --> + <value>/WEB-INF/demo/groovy/HelloGroovy.groovy</value> + </init-param> + <!-- If auto-refresh is true, then a modification of script source applies instantly. --> + <init-param> + <name>auto-refresh</name> + <value>true</value> + </init-param> + <supports> + <mime-type>text/html</mime-type> + <portlet-mode>VIEW</portlet-mode> + <portlet-mode>EDIT</portlet-mode> + <portlet-mode>HELP</portlet-mode> + </supports> + <supported-locale>en</supported-locale> + <portlet-info> + <title>Hello Groovy</title> + <short-title>Hello Groovy</short-title> + <keywords>demo, Groovy</keywords> + </portlet-info> + <portlet-preferences> + <preference> + <name>message</name> + <value>Hello, Groovy!</value> + </preference> + </portlet-preferences> + </portlet> + <custom-portlet-mode> <description>a Custom Print Mode</description> <portlet-mode>print</portlet-mode> Modified: portals/jetspeed-2/trunk/pom.xml URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/pom.xml?view=diff&rev=547182&r1=547181&r2=547182 ============================================================================== --- portals/jetspeed-2/trunk/pom.xml (original) +++ portals/jetspeed-2/trunk/pom.xml Thu Jun 14 01:55:54 2007 @@ -189,6 +189,7 @@ <org.apache.portals.bridges.jsf-demo.version>1.0.2-dev</org.apache.portals.bridges.jsf-demo.version> <org.apache.portals.bridges.jsf.version>1.0.2-dev</org.apache.portals.bridges.jsf.version> <org.apache.portals.bridges.velocity.version>1.0.2-dev</org.apache.portals.bridges.velocity.version> + <org.apache.portals.bridges.groovy.version>1.0.2-dev</org.apache.portals.bridges.groovy.version> <org.apache.portals.bridges.portletfilter.version>1.0.2-dev</org.apache.portals.bridges.portletfilter.version> <oro.version>2.0.8</oro.version> <portlet-api.version>1.0</portlet-api.version> @@ -885,6 +886,11 @@ <groupId>org.apache.portals.bridges</groupId> <artifactId>portals-bridges-jsf</artifactId> <version>${org.apache.portals.bridges.jsf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.portals.bridges</groupId> + <artifactId>portals-bridges-groovy</artifactId> + <version>${org.apache.portals.bridges.groovy.version}</version> </dependency> <dependency> <groupId>org.apache.portals.bridges</groupId> Modified: portals/jetspeed-2/trunk/project.properties URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/project.properties?view=diff&rev=547182&r1=547181&r2=547182 ============================================================================== --- portals/jetspeed-2/trunk/project.properties (original) +++ portals/jetspeed-2/trunk/project.properties Thu Jun 14 01:55:54 2007 @@ -30,6 +30,7 @@ portals.bridges.struts.version=1.2.7-1.0.2-dev portals.bridges.jpetstore.version=1.0.2-dev portals.bridges.velocity.version=1.0.2-dev +portals.bridges.groovy.version=1.0.2-dev portals.bridges.portletfilter.version=1.0.2-dev commons.logging.version=1.1 spring.version=2.0.5 Added: portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml?view=auto&rev=547182 ============================================================================== --- portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml (added) +++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml Thu Jun 14 01:55:54 2007 @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<page id="groovy" + xmlns="http://portals.apache.org/jetspeed" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.1/schemas/psml.xsd"> + <defaults + skin="blue" + layout-decorator="tigris" + portlet-decorator="blue-gradient" + /> + <title>Groovy</title> + <fragment id="groovy-1" type="layout" name="jetspeed-layouts::VelocityTwoColumns"> + <fragment id="groovy-2" type="portlet" name="demo::HelloGroovy" > + <property layout="TwoColumns" name="row" value="0" /> + <property layout="TwoColumns" name="column" value="0" /> + </fragment> + </fragment> + + <security-constraints> + <security-constraints-ref>users</security-constraints-ref> + </security-constraints> +</page> + Propchange: portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/groovy.psml ------------------------------------------------------------------------------ svn:keywords = Id --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
