You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ni...@apache.org on 2007/11/05 11:06:33 UTC
svn commit: r591942 - in /struts/struts2/trunk/apps/portlet: ./
src/main/java/org/apache/struts2/portlet/example/ src/main/resources/
src/main/resources/org/apache/struts2/portlet/example/
src/main/webapp/WEB-INF/ src/main/webapp/WEB-INF/view/ src/test...
Author: nilsga
Date: Mon Nov 5 02:06:31 2007
New Revision: 591942
URL: http://svn.apache.org/viewvc?rev=591942&view=rev
Log:
WW-2296 Added jetty-pluto embedded to the sample application. Also added some new samples and a new integration test.
Added:
struts/struts2/trunk/apps/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml
struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInputPrg.jsp
struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleSubmitToSelfWithValidation.jsp
struts/struts2/trunk/apps/portlet/src/test/
struts/struts2/trunk/apps/portlet/src/test/java/
struts/struts2/trunk/apps/portlet/src/test/java/JettyPlutoLauncher.java
struts/struts2/trunk/apps/portlet/src/test/java/org/
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/Struts2PortletTest.java
Modified:
struts/struts2/trunk/apps/portlet/ (props changed)
struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java
struts/struts2/trunk/apps/portlet/src/main/resources/struts-view.xml
struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/index.jsp
Propchange: struts/struts2/trunk/apps/portlet/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Nov 5 02:06:31 2007
@@ -2,3 +2,6 @@
*.ipr
*.iml
target
+.settings
+.classpath
+.project
Modified: struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java?rev=591942&r1=591941&r2=591942&view=diff
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java (original)
+++ struts/struts2/trunk/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java Mon Nov 5 02:06:31 2007
@@ -20,18 +20,17 @@
*/
package org.apache.struts2.portlet.example;
+import org.apache.struts2.dispatcher.DefaultActionSupport;
+
import com.opensymphony.xwork2.ActionSupport;
/**
*/
-public class FormExample extends ActionSupport {
+public class FormExample extends DefaultActionSupport {
String firstName = null;
String lastName = null;
- public String execute() throws Exception {
- // TODO Auto-generated method stub
- return super.execute();
- }
+
public String getFirstName() {
return firstName;
}
@@ -43,5 +42,9 @@
}
public void setLastName(String lastName) {
this.lastName = lastName;
+ }
+
+ public String displayResult() {
+ return "displayResult";
}
}
Added: struts/struts2/trunk/apps/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml?rev=591942&view=auto
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml (added)
+++ struts/struts2/trunk/apps/portlet/src/main/resources/org/apache/struts2/portlet/example/FormExample-formExamplePrg-validation.xml Mon Nov 5 02:06:31 2007
@@ -0,0 +1,13 @@
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<validators>
+ <field name="firstName">
+ <field-validator type="requiredstring">
+ <message>You must enter a first name</message>
+ </field-validator>
+ </field>
+ <field name="lastName">
+ <field-validator type="requiredstring">
+ <message>You must enter a last name</message>
+ </field-validator>
+ </field>
+</validators>
Modified: struts/struts2/trunk/apps/portlet/src/main/resources/struts-view.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/resources/struts-view.xml?rev=591942&r1=591941&r2=591942&view=diff
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/resources/struts-view.xml (original)
+++ struts/struts2/trunk/apps/portlet/src/main/resources/struts-view.xml Mon Nov 5 02:06:31 2007
@@ -28,6 +28,21 @@
</result>
</action>
+ <action name="formExamplePrg" class="org.apache.struts2.portlet.example.FormExample">
+ <result name="input">
+ /WEB-INF/view/formExampleInputPrg.jsp
+ </result>
+ <result name="success" type="redirectAction">
+ <param name="actionName">formExamplePrg</param>
+ <param name="method">displayResult</param>
+ <param name="firstName">${firstName}</param>
+ <param name="lastName">${lastName}</param>
+ </result>
+ <result name="displayResult">
+ /WEB-INF/view/formExample.jsp
+ </result>
+ </action>
+
<action name="formExampleModelDriven"
class="org.apache.struts2.portlet.example.FormExampleModelDriven">
<result name="input">
Added: struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml?rev=591942&view=auto
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml (added)
+++ struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/jetty-pluto-web-default.xml Mon Nov 5 02:06:31 2007
@@ -0,0 +1,384 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!-- ===================================================================== -->
+<!-- This file contains the default descriptor for web applications. -->
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+<!-- The intent of this descriptor is to include jetty specific or common -->
+<!-- configuration for all webapps. If a context has a webdefault.xml -->
+<!-- descriptor, it is applied before the contexts own web.xml file -->
+<!-- -->
+<!-- A context may be assigned a default descriptor by: -->
+<!-- + Calling WebApplicationContext.setDefaultsDescriptor -->
+<!-- + Passed an arg to addWebApplications -->
+<!-- -->
+<!-- This file is used both as the resource within the jetty.jar (which is -->
+<!-- used as the default if no explicit defaults descriptor is set) and it -->
+<!-- is copied to the etc directory of the Jetty distro and explicitly -->
+<!-- by the jetty.xml file. -->
+<!-- -->
+<!-- ===================================================================== -->
+<web-app
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ metadata-complete="true"
+ version="2.5">
+
+ <description>
+ Default web.xml file.
+ This file is applied to a Web application before it's own WEB_INF/web.xml file
+ </description>
+
+ <!-- ==================================================================== -->
+ <!-- Context params to control Session Cookies -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- UNCOMMENT TO ACTIVATE
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name>
+ <param-value>127.0.0.1</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.SessionPath</param-name>
+ <param-value>/</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.mortbay.jetty.servlet.MaxAge</param-name>
+ <param-value>-1</param-value>
+ </context-param>
+ -->
+
+ <context-param>
+ <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>
+
+ <listener>
+ <listener-class>
+ com.bekk.boss.pluto.embedded.jetty.util.OverrideContextLoaderListener
+ </listener-class>
+ </listener>
+ <listener>
+ <listener-class>
+ 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>com.bekk.boss.pluto.embedded.util.PlutoPortalDriverFilter</filter-class>
+ </filter>
+
+ <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>/pluto/index.jsp</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>plutoPortalDriver</filter-name>
+ <url-pattern>/pluto/index.jsp/*</url-pattern>
+ </filter-mapping>
+
+ <!-- ==================================================================== -->
+ <!-- The default servlet. -->
+ <!-- This servlet, normally mapped to /, provides the handling for static -->
+ <!-- content, OPTIONS and TRACE methods for the context. -->
+ <!-- The following initParameters are supported: -->
+ <!-- -->
+ <!-- acceptRanges If true, range requests and responses are -->
+ <!-- supported -->
+ <!-- -->
+ <!-- dirAllowed If true, directory listings are returned if no -->
+ <!-- welcome file is found. Else 403 Forbidden. -->
+ <!-- -->
+ <!-- redirectWelcome If true, redirect welcome file requests -->
+ <!-- else use request dispatcher forwards -->
+ <!-- -->
+ <!-- gzip If set to true, then static content will be served-->
+ <!-- as gzip content encoded if a matching resource is -->
+ <!-- found ending with ".gz" -->
+ <!-- -->
+ <!-- resoureBase Can be set to replace the context resource base -->
+ <!-- -->
+ <!-- relativeResourceBase -->
+ <!-- Set with a pathname relative to the base of the -->
+ <!-- servlet context root. Useful for only serving -->
+ <!-- static content from only specific subdirectories. -->
+ <!-- -->
+ <!-- useFileMappedBuffer -->
+ <!-- If set to true (the default), a memory mapped -->
+ <!-- file buffer will be used to serve static content -->
+ <!-- when using an NIO connector. Setting this value -->
+ <!-- to false means that a direct buffer will be used -->
+ <!-- instead. If you are having trouble with Windows -->
+ <!-- file locking, set this to false. -->
+ <!-- -->
+ <!-- cacheControl If set, all static content will have this value -->
+ <!-- set as the cache-control header. -->
+ <!-- -->
+ <!-- maxCacheSize Maximum size of the static resource cache -->
+ <!-- -->
+ <!-- maxCachedFileSize Maximum size of any single file in the cache -->
+ <!-- -->
+ <!-- maxCachedFiles Maximum number of files in the cache -->
+ <!-- -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <servlet>
+ <servlet-name>default</servlet-name>
+ <servlet-class>org.mortbay.jetty.servlet.DefaultServlet</servlet-class>
+ <init-param>
+ <param-name>acceptRanges</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>dirAllowed</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>redirectWelcome</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>maxCacheSize</param-name>
+ <param-value>4000000</param-value>
+ </init-param>
+ <init-param>
+ <param-name>maxCachedFileSize</param-name>
+ <param-value>254000</param-value>
+ </init-param>
+ <init-param>
+ <param-name>maxCachedFiles</param-name>
+ <param-value>1000</param-value>
+ </init-param>
+ <init-param>
+ <param-name>gzip</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>useFileMappedBuffer</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <!--
+ <init-param>
+ <param-name>cacheControl</param-name>
+ <param-value>max-age=3600,public</param-value>
+ </init-param>
+ -->
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
+
+
+ <!-- ==================================================================== -->
+ <!-- JSP Servlet -->
+ <!-- This is the jasper JSP servlet from the jakarta project -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- The JSP page compiler and execution servlet, which is the mechanism -->
+ <!-- used by Glassfish to support JSP pages. Traditionally, this servlet -->
+ <!-- is mapped to URL patterh "*.jsp". This servlet supports the -->
+ <!-- following initialization parameters (default values are in square -->
+ <!-- brackets): -->
+ <!-- -->
+ <!-- checkInterval If development is false and reloading is true, -->
+ <!-- background compiles are enabled. checkInterval -->
+ <!-- is the time in seconds between checks to see -->
+ <!-- if a JSP page needs to be recompiled. [300] -->
+ <!-- -->
+ <!-- compiler Which compiler Ant should use to compile JSP -->
+ <!-- pages. See the Ant documenation for more -->
+ <!-- information. [javac] -->
+ <!-- -->
+ <!-- classdebuginfo Should the class file be compiled with -->
+ <!-- debugging information? [true] -->
+ <!-- -->
+ <!-- classpath What class path should I use while compiling -->
+ <!-- generated servlets? [Created dynamically -->
+ <!-- based on the current web application] -->
+ <!-- Set to ? to make the container explicitly set -->
+ <!-- this parameter. -->
+ <!-- -->
+ <!-- development Is Jasper used in development mode (will check -->
+ <!-- for JSP modification on every access)? [true] -->
+ <!-- -->
+ <!-- enablePooling Determines whether tag handler pooling is -->
+ <!-- enabled [true] -->
+ <!-- -->
+ <!-- fork Tell Ant to fork compiles of JSP pages so that -->
+ <!-- a separate JVM is used for JSP page compiles -->
+ <!-- from the one Tomcat is running in. [true] -->
+ <!-- -->
+ <!-- ieClassId The class-id value to be sent to Internet -->
+ <!-- Explorer when using <jsp:plugin> tags. -->
+ <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
+ <!-- -->
+ <!-- javaEncoding Java file encoding to use for generating java -->
+ <!-- source files. [UTF-8] -->
+ <!-- -->
+ <!-- keepgenerated Should we keep the generated Java source code -->
+ <!-- for each page instead of deleting it? [true] -->
+ <!-- -->
+ <!-- logVerbosityLevel The level of detailed messages to be produced -->
+ <!-- by this servlet. Increasing levels cause the -->
+ <!-- generation of more messages. Valid values are -->
+ <!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. -->
+ <!-- [WARNING] -->
+ <!-- -->
+ <!-- mappedfile Should we generate static content with one -->
+ <!-- print statement per input line, to ease -->
+ <!-- debugging? [false] -->
+ <!-- -->
+ <!-- -->
+ <!-- reloading Should Jasper check for modified JSPs? [true] -->
+ <!-- -->
+ <!-- suppressSmap Should the generation of SMAP info for JSR45 -->
+ <!-- debugging be suppressed? [false] -->
+ <!-- -->
+ <!-- dumpSmap Should the SMAP info for JSR45 debugging be -->
+ <!-- dumped to a file? [false] -->
+ <!-- False if suppressSmap is true -->
+ <!-- -->
+ <!-- scratchdir What scratch directory should we use when -->
+ <!-- compiling JSP pages? [default work directory -->
+ <!-- for the current web application] -->
+ <!-- -->
+ <!-- tagpoolMaxSize The maximum tag handler pool size [5] -->
+ <!-- -->
+ <!-- xpoweredBy Determines whether X-Powered-By response -->
+ <!-- header is added by generated servlet [false] -->
+ <!-- -->
+ <!-- If you wish to use Jikes to compile JSP pages: -->
+ <!-- Set the init parameter "compiler" to "jikes". Define -->
+ <!-- the property "-Dbuild.compiler.emacs=true" when starting Jetty -->
+ <!-- to cause Jikes to emit error messages in a format compatible with -->
+ <!-- Jasper. -->
+ <!-- If you get an error reporting that jikes can't use UTF-8 encoding, -->
+ <!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <servlet id="jsp">
+ <servlet-name>jsp</servlet-name>
+ <servlet-class>com.bekk.boss.pluto.embedded.util.PortletJspServlet</servlet-class>
+ <init-param>
+ <param-name>logVerbosityLevel</param-name>
+ <param-value>DEBUG</param-value>
+ </init-param>
+ <init-param>
+ <param-name>fork</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>xpoweredBy</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <!--
+ <init-param>
+ <param-name>classpath</param-name>
+ <param-value>?</param-value>
+ </init-param>
+ -->
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>jsp</servlet-name>
+ <url-pattern>*.jsp</url-pattern>
+ <url-pattern>*.jspf</url-pattern>
+ <url-pattern>*.jspx</url-pattern>
+ <url-pattern>*.xsp</url-pattern>
+ <url-pattern>*.JSP</url-pattern>
+ <url-pattern>*.JSPF</url-pattern>
+ <url-pattern>*.JSPX</url-pattern>
+ <url-pattern>*.XSP</url-pattern>
+ </servlet-mapping>
+
+
+
+ <!-- ==================================================================== -->
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+
+ <!-- ==================================================================== -->
+ <!-- Default MIME mappings -->
+ <!-- The default MIME mappings are provided by the mime.properties -->
+ <!-- resource in the org.mortbay.jetty.jar file. Additional or modified -->
+ <!-- mappings may be specified here -->
+ <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- UNCOMMENT TO ACTIVATE
+ <mime-mapping>
+ <extension>mysuffix</extension>
+ <mime-type>mymime/type</mime-type>
+ </mime-mapping>
+ -->
+
+ <!-- ==================================================================== -->
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+ <!-- ==================================================================== -->
+ <locale-encoding-mapping-list>
+ <locale-encoding-mapping><locale>ar</locale><encoding>ISO-8859-6</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>be</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>bg</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ca</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>cs</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>da</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>de</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>el</locale><encoding>ISO-8859-7</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>en</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>es</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>et</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>fi</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>fr</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>hr</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>hu</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>is</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>it</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>iw</locale><encoding>ISO-8859-8</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ja</locale><encoding>Shift_JIS</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ko</locale><encoding>EUC-KR</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>lt</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>lv</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>mk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>nl</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>no</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>pl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>pt</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ro</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>ru</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sh</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sk</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sq</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sr</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>sv</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>tr</locale><encoding>ISO-8859-9</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>uk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>zh</locale><encoding>GB2312</encoding></locale-encoding-mapping>
+ <locale-encoding-mapping><locale>zh_TW</locale><encoding>Big5</encoding></locale-encoding-mapping>
+ </locale-encoding-mapping-list>
+
+</web-app>
+
Added: struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInputPrg.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInputPrg.jsp?rev=591942&view=auto
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInputPrg.jsp (added)
+++ struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleInputPrg.jsp Mon Nov 5 02:06:31 2007
@@ -0,0 +1,8 @@
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<H2>Input your name</H2>
+<s:form action="formExamplePrg" method="POST">
+ <s:textfield label="First name" name="firstName" value="%{firstName}"/>
+ <s:textfield label="Last name" name="lastName" value="%{lastName}"/>
+ <s:submit value="Submit the form"/>
+</s:form>
Added: struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleSubmitToSelfWithValidation.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleSubmitToSelfWithValidation.jsp?rev=591942&view=auto
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleSubmitToSelfWithValidation.jsp (added)
+++ struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/formExampleSubmitToSelfWithValidation.jsp Mon Nov 5 02:06:31 2007
@@ -0,0 +1,6 @@
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<H2>Hello <s:property value="firstName"/> <s:property value="lastName"/></H2>
+<p/>
+<a href="<s:url action="index"/>">Back to front page</a>
+
Modified: struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/index.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/index.jsp?rev=591942&r1=591941&r2=591942&view=diff
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/index.jsp (original)
+++ struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/view/index.jsp Mon Nov 5 02:06:31 2007
@@ -4,6 +4,7 @@
Here you'll find examples of what is possible with the Struts Portlet integration framework.
<ul>
<li><a href="<s:url action="formExample"/>">A simple form</a></li>
+<li><a href="<s:url action="formExamplePrg" method="input"/>">Form example with proper PRG</a></li>
<li><a href="<s:url action="formExampleModelDriven" method="input"/>">Model driven example</li>
<li><a href="<s:url action="validationExample"/>">Validation</a></li>
<li><a href="<s:url action="tokenExample"/>">Token</a></li>
Added: struts/struts2/trunk/apps/portlet/src/test/java/JettyPlutoLauncher.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/test/java/JettyPlutoLauncher.java?rev=591942&view=auto
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/test/java/JettyPlutoLauncher.java (added)
+++ struts/struts2/trunk/apps/portlet/src/test/java/JettyPlutoLauncher.java Mon Nov 5 02:06:31 2007
@@ -0,0 +1,19 @@
+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", "StrutsPortlet");
+ Server server = new Server(8080);
+ WebAppContext webapp = new WebAppContext("src/main/webapp", "/test");
+ webapp.setDefaultsDescriptor("/WEB-INF/jetty-pluto-web-default.xml");
+ ServletHolder portletServlet = new ServletHolder(new PortletServlet());
+ portletServlet.setInitParameter("portlet-name", "StrutsPortlet");
+ portletServlet.setInitOrder(1);
+ webapp.addServlet(portletServlet, "/PlutoInvoker/StrutsPortlet");
+ server.addHandler(webapp);
+ server.start();
+ }
+}
Added: struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java?rev=591942&view=auto
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java (added)
+++ struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java Mon Nov 5 02:06:31 2007
@@ -0,0 +1,75 @@
+package org.apache.struts2.portlet.test;
+
+import net.sourceforge.jwebunit.junit.WebTestCase;
+
+import org.apache.pluto.core.PortletServlet;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+public abstract class BasePortletTest extends WebTestCase {
+
+ protected Server server;
+
+ private int port = 8080;
+
+ private String contextPath = "/test";
+
+ public void setUp() throws Exception {
+ System.setProperty("org.apache.pluto.embedded.portletId", getPortletName());
+ server = new Server(port);
+ WebAppContext webapp = new WebAppContext("src/main/webapp", contextPath);
+ webapp.setDefaultsDescriptor("/WEB-INF/jetty-pluto-web-default.xml");
+ ServletHolder portletServlet = new ServletHolder(new PortletServlet());
+ portletServlet.setInitParameter("portlet-name", getPortletName());
+ portletServlet.setInitOrder(1);
+ webapp.addServlet(portletServlet, "/PlutoInvoker/" + getPortletName());
+ server.addHandler(webapp);
+ server.start();
+ getTestContext().setBaseUrl("http://localhost:" + port + contextPath);
+ }
+
+
+ public void tearDown() throws Exception {
+ server.stop();
+ }
+
+ public void minimizeWindow() {
+ clickElementByXPath("//span[@class='minimized']/..");
+ }
+
+ public void maximizeWindow() {
+ clickElementByXPath("//span[@class='minimized']/..");
+ }
+
+ public void restoreWindow() {
+ clickElementByXPath("//span[@class='normal']/..");
+ }
+
+ public void switchEdit() {
+ clickElementByXPath("//span[@class='edit']/..");
+ }
+
+ public void switchView() {
+ clickElementByXPath("//span[@class='view']/..");
+ }
+
+ public void switchHelp() {
+ clickElementByXPath("//span[@class='help']/..");
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setContextPath(String contextPath) {
+ if(!contextPath.startsWith("/")) {
+ this.contextPath = "/" + contextPath;
+ }
+ else {
+ this.contextPath = contextPath;
+ }
+ }
+
+ public abstract String getPortletName();
+}
Added: struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/Struts2PortletTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/Struts2PortletTest.java?rev=591942&view=auto
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/Struts2PortletTest.java (added)
+++ struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/Struts2PortletTest.java Mon Nov 5 02:06:31 2007
@@ -0,0 +1,83 @@
+package org.apache.struts2.portlet.test;
+
+public class Struts2PortletTest extends BasePortletTest {
+
+ private final static String PORTLET_NAME = "StrutsPortlet";
+
+ public void testIndexPage() throws Exception {
+ beginAt("pluto/index.jsp");
+ assertTextPresent("Welcome to the Struts example portlet");
+ assertLinkPresentWithExactText("A simple form");
+ assertLinkPresentWithExactText("Validation");
+ }
+
+ public void testFormExample() throws Exception {
+ beginAt("pluto/index.jsp");
+ clickLinkWithExactText("A simple form");
+ assertFormPresent("processFormExample");
+ assertTextPresent("Input your name");
+ setWorkingForm("processFormExample");
+ setTextField("firstName", "Nils-Helge");
+ setTextField("lastName", "Garli");
+ submit();
+ assertTextPresent("Hello Nils-Helge Garli");
+ }
+
+ public void testValidationExample() throws Exception {
+ beginAt("pluto/index.jsp");
+ clickLinkWithExactText("Validation");
+ assertFormPresent("processValidationExample");
+ assertTextPresent("Input your name");
+ setWorkingForm("processValidationExample");
+ setTextField("firstName", "Nils-Helge");
+ submit();
+ assertTextFieldEquals("firstName", "Nils-Helge");
+ assertTextPresent("You must enter a last name");
+ setTextField("lastName", "Garli");
+ submit();
+ assertTextPresent("Hello Nils-Helge Garli");
+ }
+
+ public void testValidationErrorMessagesStickBetweenWindowStateChanges() throws Exception {
+ beginAt("pluto/index.jsp");
+ clickLinkWithExactText("Validation");
+ assertFormPresent("processValidationExample");
+ assertTextPresent("Input your name");
+ setWorkingForm("processValidationExample");
+ setTextField("firstName", "Nils-Helge");
+ submit();
+ assertTextFieldEquals("firstName", "Nils-Helge");
+ assertTextPresent("You must enter a last name");
+ minimizeWindow();
+ assertTextNotPresent("Input your name");
+ restoreWindow();
+ assertTextPresent("Input your name");
+ assertTextPresent("You must enter a last name");
+ }
+
+ public void testTokenExample() throws Exception {
+ beginAt("pluto/index.jsp");
+ clickLinkWithText("Token");
+ setWorkingForm(0);
+ setTextField("theValue", "something");
+ submit();
+ assertTextPresent("ERROR");
+ setWorkingForm(1);
+ setTextField("theValue", "somethingElse");
+ submit();
+ assertTextPresent("The form was successfully submitted with a valid token");
+ }
+
+ public void testSwitchFromViewToEditShouldGoToDefaultEditPage() throws Exception {
+ beginAt("pluto/index.jsp");
+ assertTextPresent("Welcome to the Struts example portlet");
+ switchEdit();
+ assertTextPresent("Back to view mode");
+ }
+
+ @Override
+ public String getPortletName() {
+ return PORTLET_NAME;
+ }
+
+}