Author: nilsga Date: Thu Oct 4 23:32:29 2007 New Revision: 582094 URL: http://svn.apache.org/viewvc?rev=582094&view=rev Log: WW-1726 Refactored and updated portlet archetype. Now includes the jetty-pluto integration.
Added: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/HelloAction.java struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/UpdateNameAction.java struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/edit/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/edit/index.jsp struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/view/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/view/index.jsp struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/test/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/test/java/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/test/java/JettyPlutoLauncher.java Removed: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/edit/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/view/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/edit/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/help/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/pluto-portal-driver-config.xml struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/tld/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/view/ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/index.jsp struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/test-portal/ Modified: struts/maven/trunk/struts2-archetype-portlet/pom.xml struts/maven/trunk/struts2-archetype-portlet/src/main/resources/META-INF/archetype.xml struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/resources/struts.xml struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml Modified: struts/maven/trunk/struts2-archetype-portlet/pom.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/pom.xml?rev=582094&r1=582093&r2=582094&view=diff ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/pom.xml (original) +++ struts/maven/trunk/struts2-archetype-portlet/pom.xml Thu Oct 4 23:32:29 2007 @@ -1,6 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> - -<project> +<!-- +/* + * $Id: $ + * + * 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. + */ +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupId>org.apache.struts</groupId> <artifactId>struts-master</artifactId> @@ -9,7 +31,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>struts2-archetype-portlet</artifactId> - <version>2.0.9-SNAPSHOT</version> + <version>2.1.0-SNAPSHOT</version> <packaging>maven-plugin</packaging> <name>Struts 2 Archetypes - Portlet</name> Modified: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/META-INF/archetype.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/META-INF/archetype.xml?rev=582094&r1=582093&r2=582094&view=diff ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/META-INF/archetype.xml (original) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/META-INF/archetype.xml Thu Oct 4 23:32:29 2007 @@ -1,20 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <archetype> - <id>struts2-archetype-blank</id> + <id>struts2-archetype-portlet</id> <sources> - <source>src/main/java/view/IndexAction.java</source> - <source>src/main/java/edit/IndexAction.java</source> + <source>src/main/java/HelloAction.java</source> + <source>src/main/java/UpdateNameAction.java</source> </sources> + <testSources> + <source>src/test/java/JettyPlutoLauncher.java</source> + </testSources> <resources> <resource>src/main/resources/struts.xml</resource> - <resource>src/main/webapp/index.jsp</resource> + <resource>src/main/webapp/WEB-INF/jsp/view/index.jsp</resource> + <resource>src/main/webapp/WEB-INF/jsp/edit/index.jsp</resource> <resource>src/main/webapp/WEB-INF/web.xml</resource> <resource>src/main/webapp/WEB-INF/portlet.xml</resource> - <resource>src/main/webapp/WEB-INF/view/index.jsp</resource> - <resource>src/main/webapp/WEB-INF/help/index.jsp</resource> - <resource>src/main/webapp/WEB-INF/edit/index-input.jsp</resource> - <resource>src/main/webapp/WEB-INF/edit/index-success.jsp</resource> + <resource>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</resource> </resources> </archetype> Modified: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml?rev=582094&r1=582093&r2=582094&view=diff ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml (original) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml Thu Oct 4 23:32:29 2007 @@ -1,137 +1,131 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> - <modelVersion>4.0.0</modelVersion> - <groupId>${groupId}</groupId> - <artifactId>${artifactId}</artifactId> - <packaging>war</packaging> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>${groupId}</groupId> + <artifactId>${artifactId}</artifactId> + <packaging>war</packaging> + <name>My Portlet Application</name> <version>${version}</version> - <name>Struts 2 Portlet</name> - <url>http://www.myComp.com</url> - <description>Struts 2 Portlet</description> <dependencies> - <!-- Junit --> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - - <!-- Struts 2 --> - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-core</artifactId> - <version>2.0.9</version> - </dependency> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-codebehind-plugin</artifactId> - <version>2.0.9</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.1</version> - </dependency> - - <!-- Servlet, Jsp, and Portlet API's --> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + <version>1.0</version> <scope>provided</scope> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.0</version> - <scope>provided</scope> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-portlet-plugin</artifactId> + <version>2.1.0-SNAPSHOT</version> </dependency> - <dependency> - <groupId>portlet-api</groupId> - <artifactId>portlet-api</artifactId> - <version>1.0</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <finalName>${artifactId}</finalName> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - <!-- Plugin to generate the wrapper servlets in the web.xml --> - <!-- - <plugin> - <groupId>org.apache.pluto</groupId> - <artifactId>maven-pluto-plugin</artifactId> - <version>1.1.4</version> - <executions> - <execution> - <phase>generate-resources</phase> - <goals> - <goal>assemble</goal> - </goals> - </execution> - </executions> - </plugin> - --> - <plugin> - <groupId>org.mortbay.jetty</groupId> - <artifactId>maven-jetty-plugin</artifactId> - <version>6.1.1</version> - <configuration> - <scanIntervalSeconds>10</scanIntervalSeconds> - <!-- Experimental pluto embedded configuration settings --> - <!-- - <webXml>${project.build.directory}/pluto-resources/web.xml</webXml> - <webDefaultXml>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml> - --> - </configuration> - <dependencies> - <dependency> - <groupId>portlet-api</groupId> - <artifactId>portlet-api</artifactId> - <version>1.0</version> - </dependency> - <!-- Experimental pluto embedded dependencies --> - <!-- - <dependency> - <groupId>org.apache.pluto</groupId> - <artifactId>pluto-portal-driver</artifactId> - <version>1.1.4</version> - </dependency> - <dependency> - <groupId>org.apache.pluto</groupId> - <artifactId>pluto-portal-driver-impl</artifactId> - <version>1.1.4</version> - </dependency> - <dependency> - <groupId>org.apache.pluto</groupId> - <artifactId>pluto-container</artifactId> - <version>1.1.4</version> - </dependency> - <dependency> - <groupId>org.apache.pluto</groupId> - <artifactId>pluto-taglib</artifactId> - <version>1.1.4</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>2.0.2</version> - </dependency> - --> - </dependencies> - </plugin> - </plugins> - </build> + </dependencies> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <excludes> + <exclude>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>pluto-embedded</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.pluto</groupId> + <artifactId>maven-pluto-plugin</artifactId> + <version>1.1.3</version> + <executions> + <execution> + <phase>generate-resources</phase> + <goals> + <goal>assemble</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>maven-jetty-plugin</artifactId> + <configuration> + <webXml>${project.build.directory}/pluto-resources/web.xml</webXml> + <webDefaultXml>src/main/webapp/WEB-INF/jetty-pluto-web-default.xml</webDefaultXml> + <systemProperties> + <systemProperty> + <name>org.apache.pluto.embedded.portletId</name> + <value>HelloPortlet</value> + </systemProperty> + </systemProperties> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>com.bekk.boss</groupId> + <artifactId>maven-jetty-pluto-embedded</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>javax.portlet</groupId> + <artifactId>portlet-api</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty</artifactId> + <version>6.1.5</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jsp-2.1</artifactId> + <version>6.1.5</version> + <scope>provided</scope> + </dependency> + </dependencies> + </profile> + </profiles> + + <repositories> + <repository> + <id>apache.snapshots</id> + <name>Apache Maven Repository (Snapshots and Test Builds)</name> + <url>http://people.apache.org/repo/m2-snapshot-repository</url> + <releases><enabled>false</enabled></releases> + <snapshots><enabled>true</enabled></snapshots> + </repository> + <repository> + <id>opensymphony</id> + <name>opensymphony</name> + <layout>legacy</layout> + <snapshots> + <enabled>true</enabled> + <updatePolicy>always</updatePolicy> + <checksumPolicy>ignore</checksumPolicy> + </snapshots> + <releases> + <enabled>true</enabled> + </releases> + <url>http://maven.opensymphony.com</url> + </repository> + </repositories> + </project> Added: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/HelloAction.java URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/HelloAction.java?rev=582094&view=auto ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/HelloAction.java (added) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/HelloAction.java Thu Oct 4 23:32:29 2007 @@ -0,0 +1,38 @@ +package ${packageName}; + +import javax.portlet.PortletPreferences; + +import org.apache.struts2.dispatcher.DefaultActionSupport; +import org.apache.struts2.portlet.interceptor.PortletPreferencesAware; + +import com.opensymphony.xwork2.Preparable; + +public class HelloAction extends DefaultActionSupport implements PortletPreferencesAware { + + private static final long serialVersionUID = 1L; + + private String firstName; + + private String lastName; + + private PortletPreferences preferences; + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + public void setPortletPreferences(PortletPreferences preferences) { + this.preferences = preferences; + } + + @Override + public String execute() throws Exception { + firstName = preferences.getValue("firstName", ""); + lastName = preferences.getValue("lastName", ""); + return SUCCESS; + } +} Added: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/UpdateNameAction.java URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/UpdateNameAction.java?rev=582094&view=auto ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/UpdateNameAction.java (added) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/java/UpdateNameAction.java Thu Oct 4 23:32:29 2007 @@ -0,0 +1,54 @@ +package ${packageName}; + +import javax.portlet.PortletPreferences; + +import org.apache.struts2.dispatcher.DefaultActionSupport; +import org.apache.struts2.portlet.interceptor.PortletPreferencesAware; + +public class UpdateNameAction extends DefaultActionSupport implements PortletPreferencesAware { + + private static final long serialVersionUID = 1L; + + private String firstName; + + private String lastName; + + private PortletPreferences preferences; + + @Override + public String execute() throws Exception { + preferences.setValue("firstName", firstName); + preferences.setValue("lastName", lastName); + preferences.store(); + getActionMessages().add("Name updated"); + return SUCCESS; + } + + @Override + public String input() throws Exception { + firstName = preferences.getValue("firstName", ""); + lastName = preferences.getValue("lastName", ""); + return INPUT; + } + + public void setPortletPreferences(PortletPreferences preferences) { + this.preferences = preferences; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getFirstName() { + return firstName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getLastName() { + return lastName; + } + +} Modified: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/resources/struts.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/resources/struts.xml?rev=582094&r1=582093&r2=582094&view=diff ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/resources/struts.xml (original) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/resources/struts.xml Thu Oct 4 23:32:29 2007 @@ -1,13 +1,23 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> - +<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> - -<struts> - <constant name="struts.codebehind.defaultPackage" value="struts-portlet-default" /> - <constant name="struts.codebehind.pathPrefix" value="/WEB-INF/" /> - <constant name="struts.devMode" value="true" /> - <include file="struts-portlet-default.xml" /> -</struts> +<struts> + <package name="default" extends="struts-portlet-default" namespace="/view"> + <action name="index" class="${packageName}.HelloAction"> + <result>/WEB-INF/jsp/view/index.jsp</result> + </action> + </package> + + <package name="edit" extends="struts-portlet-default" namespace="/edit"> + + <action name="index" class="${packageName}.UpdateNameAction"> + <result type="redirectAction"> + <param name="actionName">index</param> + <param name="portletMode">view</param> + </result> + <result name="input">/WEB-INF/jsp/edit/index.jsp</result> + </action> + </package> +</struts> \ No newline at end of file Modified: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml?rev=582094&r1=582093&r2=582094&view=diff ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml (original) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml Thu Oct 4 23:32:29 2007 @@ -53,35 +53,49 @@ <param-name>org.mortbay.jetty.webapp.NoTLDJarPattern</param-name> <param-value>start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar</param-value> </context-param> - - <context-param> - <param-name>contextConfigLocation</param-name> - <param-value> - /WEB-INF/pluto-portal-driver-services-config.xml - </param-value> - </context-param> <listener> - <listener-class> org.springframework.web.context.ContextLoaderListener - </listener-class> + <listener-class> + com.bekk.boss.pluto.embedded.jetty.util.OverrideContextLoaderListener + </listener-class> </listener> <listener> <listener-class> - org.apache.pluto.driver.PortalStartupListener + com.bekk.boss.pluto.embedded.util.PortalStartupListener </listener-class> </listener> <filter> + <filter-name>plutoResourceFilter</filter-name> + <filter-class>com.bekk.boss.pluto.embedded.util.PlutResourcesFilter</filter-class> + </filter> + <filter> <filter-name>plutoPortalDriver</filter-name> - <filter-class>org.apache.pluto.driver.PortalDriverFilter</filter-class> + <filter-class>com.bekk.boss.pluto.embedded.util.PlutoPortalDriverFilter</filter-class> </filter> - <filter-mapping> + <filter-mapping> + <filter-name>plutoResourceFilter</filter-name> + <url-pattern>*.css</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>plutoResourceFilter</filter-name> + <url-pattern>*.gif</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>plutoResourceFilter</filter-name> + <url-pattern>*.png</url-pattern> + </filter-mapping> + <filter-mapping> + <filter-name>plutoResourceFilter</filter-name> + <url-pattern>*.js</url-pattern> + </filter-mapping> + <filter-mapping> <filter-name>plutoPortalDriver</filter-name> - <url-pattern>/test-portal/index.jsp</url-pattern> + <url-pattern>/pluto/index.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>plutoPortalDriver</filter-name> - <url-pattern>/test-portal/index.jsp/*</url-pattern> + <url-pattern>/pluto/index.jsp/*</url-pattern> </filter-mapping> <!-- ==================================================================== --> @@ -262,7 +276,7 @@ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <servlet id="jsp"> <servlet-name>jsp</servlet-name> - <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> + <servlet-class>com.bekk.boss.pluto.embedded.util.PortletJspServlet</servlet-class> <init-param> <param-name>logVerbosityLevel</param-name> <param-value>DEBUG</param-value> @@ -322,18 +336,6 @@ <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> - - <jsp-config> - <taglib> - <taglib-uri>http://portals.apache.org/pluto</taglib-uri> - <taglib-location>/WEB-INF/tld/pluto.tld</taglib-location> - </taglib> - <taglib> - <taglib-uri>http://java.sun.com/portlet</taglib-uri> - <taglib-location>/WEB-INF/tld/portlet.tld</taglib-location> - </taglib> - </jsp-config> - <!-- ==================================================================== --> <locale-encoding-mapping-list> Added: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/edit/index.jsp URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/edit/index.jsp?rev=582094&view=auto ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/edit/index.jsp (added) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/edit/index.jsp Thu Oct 4 23:32:29 2007 @@ -0,0 +1,13 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> + +<h2>Your name:</h2> + +<s:form action="index"> + <table> + <s:textfield name="firstName" label="First name"/> + <s:textfield name="lastName" label="Last name"/> + <s:submit value="Update"/> + </table> +</s:form> + +<s:actionmessage/> \ No newline at end of file Added: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/view/index.jsp URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/view/index.jsp?rev=582094&view=auto ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/view/index.jsp (added) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jsp/view/index.jsp Thu Oct 4 23:32:29 2007 @@ -0,0 +1,9 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> + +<s:if test='%{firstName != "" || lastName != ""}'> + <h2>Hello, <s:property value="firstName"/> <s:property value="lastName"/> +</s:if> +<s:else> + <b>No name set. Go to <a href="<s:url action="index" method="input" portletMode="edit"/>">edit mode</a> to set your name</b> +</s:else> + Modified: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml?rev=582094&r1=582093&r2=582094&view=diff ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml (original) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml Thu Oct 4 23:32:29 2007 @@ -1,63 +1,58 @@ -<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" id="struts-portlet"> - <portlet id="StrutsPortlet"> - <description xml:lang="EN">Blank Struts Portlet</description> - <portlet-name>StrutsPortlet</portlet-name> - <display-name xml:lang="EN">Blank Struts Portlet</display-name> - - <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class> - - <init-param> - <name>actionPackages</name> - <value>${package}</value> - </init-param> - <init-param> - <!-- The view mode namespace. Maps to a namespace in the xwork config file --> - <name>viewNamespace</name> - <value>/view</value> - </init-param> - <init-param> - <!-- The default action to invoke in view mode --> - <name>defaultViewAction</name> - <value>index</value> - </init-param> - <init-param> - <!-- The view mode namespace. Maps to a namespace in the xwork config file --> - <name>editNamespace</name> - <value>/edit</value> - </init-param> - <init-param> - <!-- The default action to invoke in view mode --> - <name>defaultEditAction</name> - <value>index</value> - </init-param> - <init-param> - <!-- The view mode namespace. Maps to a namespace in the xwork config file --> - <name>helpNamespace</name> - <value>/help</value> - </init-param> - <init-param> - <!-- The default action to invoke in view mode --> - <name>defaultHelpAction</name> - <value>index</value> - </init-param> - - <expiration-cache>0</expiration-cache> - - <supports> - <mime-type>text/html</mime-type> - <portlet-mode>edit</portlet-mode> - <portlet-mode>help</portlet-mode> - </supports> - - <supported-locale>en</supported-locale> - - <portlet-info> - <title>Struts Blank Porlet</title> - <short-title>SB</short-title> - <keywords>struts,portlet</keywords> - </portlet-info> - </portlet> - -</portlet-app> +<?xml version="1.0" encoding="UTF-8"?> + +<portlet-app + version="1.0" + xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" + id="${artifactId}"> + + <portlet id="HelloPortlet"> + <description xml:lang="EN">Simple hello world portlet</description> + <portlet-name>HelloPortlet</portlet-name> + <display-name xml:lang="EN">${artifactId}</display-name> + + <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class> + + <!-- The namespace for the actions configured for view mode --> + <init-param> + <name>viewNamespace</name> + <value>/view</value> + </init-param> + + <!-- The default action to invoke in view mode. --> + <init-param> + <name>defaultViewAction</name> + <value>index</value> + </init-param> + + <!-- The namespace for the actions configured for edit mode --> + <init-param> + <name>editNamespace</name> + <value>/edit</value> + </init-param> + + <!-- The default action to invoke in edit mode. --> + <init-param> + <name>defaultEditAction</name> + <value>index!input</value> + </init-param> + + <expiration-cache>0</expiration-cache> + + <supports> + <mime-type>text/html</mime-type> + <portlet-mode>view</portlet-mode> + <portlet-mode>edit</portlet-mode> + </supports> + + <supported-locale>en</supported-locale> + + <portlet-info> + <title>HelloPortlet</title> + <short-title>HelloPortlet</short-title> + <keywords>struts 2,portlet,hello,world</keywords> + </portlet-info> + </portlet> + +</portlet-app> Modified: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml?rev=582094&r1=582093&r2=582094&view=diff ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml (original) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml Thu Oct 4 23:32:29 2007 @@ -1,33 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!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> - - <filter id="filterdispatcher"> - <filter-name>struts</filter-name> - <filter-class> - org.apache.struts2.dispatcher.FilterDispatcher - </filter-class> - <init-param> - <param-name>actionPackages</param-name> - <param-value>${package}</param-value> - </init-param> - </filter> - - <filter-mapping> - <filter-name>struts</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - - <listener> - <listener-class> - org.apache.struts2.portlet.context.ServletContextHolderListener - </listener-class> - </listener> - - <servlet id="preparator"> - <servlet-name>preparator</servlet-name> - <servlet-class> - org.apache.struts2.portlet.context.PreparatorServlet - </servlet-class> - </servlet> -</web-app> +<?xml version="1.0" encoding="UTF-8"?> +<!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 id="${artifactId}"> + <!-- Empty --> +</web-app> Added: struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/test/java/JettyPlutoLauncher.java URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/test/java/JettyPlutoLauncher.java?rev=582094&view=auto ============================================================================== --- struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/test/java/JettyPlutoLauncher.java (added) +++ struts/maven/trunk/struts2-archetype-portlet/src/main/resources/archetype-resources/src/test/java/JettyPlutoLauncher.java Thu Oct 4 23:32:29 2007 @@ -0,0 +1,21 @@ +package ${packageName}; + +import org.apache.pluto.core.PortletServlet; +import org.mortbay.jetty.Server; +import org.mortbay.jetty.servlet.ServletHolder; +import org.mortbay.jetty.webapp.WebAppContext; + +public class JettyPlutoLauncher { + public static void main(String[] args) throws Exception { + System.setProperty("org.apache.pluto.embedded.portletId", "HelloPortlet"); + Server server = new Server(8080); + WebAppContext webapp = new WebAppContext("src/main/webapp", "/${artifactId}"); + webapp.setDefaultsDescriptor("/WEB-INF/jetty-pluto-web-default.xml"); + ServletHolder portletServlet = new ServletHolder(new PortletServlet()); + portletServlet.setInitParameter("portlet-name", "HelloPortlet"); + portletServlet.setInitOrder(1); + webapp.addServlet(portletServlet, "/PlutoInvoker/HelloPortlet"); + server.addHandler(webapp); + server.start(); + } +}