mirror of
https://github.com/apache/struts.git
synced 2026-08-08 08:07:17 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 591347a498 |
+118
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-all</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Combined Struts 2 Jar</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>dependency-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unjar-deps</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-api</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-config-browser-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-jasperreports-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-jfreechart-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-jsf-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-pell-multipart-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-plexus-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-sitegraph-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-sitemesh-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-struts1-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>
|
||||
struts2-tiles-plugin
|
||||
</artifactId>
|
||||
<version>${version}</version>
|
||||
</artifactItem>
|
||||
|
||||
</artifactItems>
|
||||
<outputDirectory>${project.build.directory}/classes</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Struts 2 API</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/api/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/api/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/api/</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
<!-- has to be compile for StrutsTestCase, which is part of the base package so others can write unit tests -->
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<showPackage>false</showPackage>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.apache.struts2;
|
||||
|
||||
/**
|
||||
* Default action interface. Provided purely for user convenience. Struts does not require actions to implement any
|
||||
* interfaces. Actions need only implement a public, no argument method which returns {@code String}. If a user does
|
||||
* not specify a method name, Struts defaults to {@code execute()}.
|
||||
*
|
||||
* <p>For example:
|
||||
*
|
||||
* <pre>
|
||||
* static import ResultNames.*;
|
||||
*
|
||||
* public class MyAction <b>implements Action</b> {
|
||||
*
|
||||
* public String execute() {
|
||||
* return SUCCESS;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>is equivalent to:
|
||||
*
|
||||
* <pre>
|
||||
* static import ResultNames.*;
|
||||
*
|
||||
* public class MyAction {
|
||||
*
|
||||
* public String execute() {
|
||||
* return SUCCESS;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Action {
|
||||
|
||||
/**
|
||||
* Executes this action.
|
||||
*
|
||||
* @return result name which matches a result name from the action mapping in the configuration file. See {@link
|
||||
* ResultNames} for common suggestions.
|
||||
*/
|
||||
String execute();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.apache.struts2;
|
||||
|
||||
/**
|
||||
* Implemented by actions which may need to record errors or messages.
|
||||
*
|
||||
* <pre>
|
||||
* static import ResultNames.*;
|
||||
*
|
||||
* public class SetName implements MessageAware {
|
||||
*
|
||||
* Messages messages;
|
||||
* String name;
|
||||
*
|
||||
* public String execute() {
|
||||
* return SUCCESS;
|
||||
* }
|
||||
*
|
||||
* public void setName(String name) {
|
||||
* if ("".equals(name))
|
||||
* messages.forField("name").addError("name.required");
|
||||
*
|
||||
* this.name = name;
|
||||
* }
|
||||
*
|
||||
* public void setMessages(Messages messages) {
|
||||
* this.messages = messages;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface MessageAware {
|
||||
|
||||
/**
|
||||
* Sets messages.
|
||||
*
|
||||
* @param messages messages
|
||||
*/
|
||||
void setMessages(Messages messages);
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package org.apache.struts2;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Collection of messages. Supports nesting messages by field name.
|
||||
*
|
||||
* <p>Uses keys when adding instead of actual messages to decouple code from messages.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Messages {
|
||||
|
||||
// TODO: Use Object[] for args instead of String[].
|
||||
|
||||
/**
|
||||
* Message severity.
|
||||
*/
|
||||
public enum Severity {
|
||||
|
||||
/**
|
||||
* Informational messages.
|
||||
*/
|
||||
INFO,
|
||||
|
||||
/**
|
||||
* Warning messages.
|
||||
*/
|
||||
WARN,
|
||||
|
||||
/**
|
||||
* Error messages.
|
||||
*/
|
||||
ERROR,
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets nested messages for the given field.
|
||||
*
|
||||
* <p>Supports dot notation to represent nesting. For example:
|
||||
*
|
||||
* <pre>
|
||||
* messages.forField("foo").forField("bar") == messages.forField("foo.bar")
|
||||
* </pre>
|
||||
*
|
||||
* @param fieldName name of the field
|
||||
* @return nested {@code Messages} for given field name
|
||||
*/
|
||||
Messages forField(String fieldName);
|
||||
|
||||
/**
|
||||
* Gets map of field name to messages for that field.
|
||||
*
|
||||
* @return map of field name to {@code Messages}
|
||||
*/
|
||||
Map<String, Messages> forFields();
|
||||
|
||||
/**
|
||||
* Adds informational message.
|
||||
*
|
||||
* @param key message key
|
||||
* @see Severity.INFO
|
||||
*/
|
||||
void addInformation(String key);
|
||||
|
||||
/**
|
||||
* Adds informational message.
|
||||
*
|
||||
* @param key message key
|
||||
* @param arguments message arguments
|
||||
* @see Severity.INFO
|
||||
*/
|
||||
void addInformation(String key, String... arguments);
|
||||
|
||||
/**
|
||||
* Adds warning message.
|
||||
*
|
||||
* @param key message key
|
||||
* @see Severity.WARN
|
||||
*/
|
||||
void addWarning(String key);
|
||||
|
||||
/**
|
||||
* Adds warning message.
|
||||
*
|
||||
* @param key message key
|
||||
* @param arguments message arguments
|
||||
* @see Severity.WARN
|
||||
*/
|
||||
void addWarning(String key, String... arguments);
|
||||
|
||||
/**
|
||||
* Adds error message.
|
||||
*
|
||||
* @param key message key
|
||||
* @see Severity.ERROR
|
||||
*/
|
||||
void addError(String key);
|
||||
|
||||
/**
|
||||
* Adds error message.
|
||||
*
|
||||
* @param key message key
|
||||
* @param arguments message arguments
|
||||
* @see Severity.ERROR
|
||||
*/
|
||||
void addError(String key, String... arguments);
|
||||
|
||||
/**
|
||||
* Adds message.
|
||||
*
|
||||
* @param severity message severity
|
||||
* @param key message key
|
||||
*/
|
||||
void add(Severity severity, String key);
|
||||
|
||||
/**
|
||||
* Adds request-scoped message.
|
||||
*
|
||||
* @param severity message severity
|
||||
* @param key message key
|
||||
* @param arguments message arguments
|
||||
*/
|
||||
void add(Severity severity, String key, String... arguments);
|
||||
|
||||
/**
|
||||
* Gets set of severities for which this {@code Messages} instance has messages. Not recursive.
|
||||
*
|
||||
* @return unmodifiable set of {@link Severity} sorted from least to most severe
|
||||
*/
|
||||
Set<Severity> getSeverities();
|
||||
|
||||
/**
|
||||
* Gets message strings for the given severity. Not recursive.
|
||||
*
|
||||
* @param severity message severity
|
||||
* @return unmodifiable list of messages
|
||||
*/
|
||||
List<String> forSeverity(Severity severity);
|
||||
|
||||
/**
|
||||
* Gets error message strings for this {@code Messages} instance. Not recursive.
|
||||
*
|
||||
* @return unmodifiable list of messages
|
||||
*/
|
||||
List<String> getErrors();
|
||||
|
||||
/**
|
||||
* Gets error message strings for this {@code Messages} instance. Not recursive.
|
||||
*
|
||||
* @return unmodifiable list of messages
|
||||
*/
|
||||
List<String> getWarnings();
|
||||
|
||||
/**
|
||||
* Gets informational message strings for this {@code Messages} instance. Not recursive.
|
||||
*
|
||||
* @return unmodifiable list of messages
|
||||
*/
|
||||
List<String> getInformation();
|
||||
|
||||
/**
|
||||
* Returns true if this or a nested {@code Messages} instance has error messages.
|
||||
*
|
||||
* @see Severity.ERROR
|
||||
*/
|
||||
boolean hasErrors();
|
||||
|
||||
/**
|
||||
* Returns true if this or a nested {@code Messages} instance has warning messages.
|
||||
*
|
||||
* @see Severity.WARN
|
||||
*/
|
||||
boolean hasWarnings();
|
||||
|
||||
/**
|
||||
* Returns true if this or a nested {@code Messages} instance has informational messages.
|
||||
*
|
||||
* @see Severity.INFO
|
||||
*/
|
||||
boolean hasInformation();
|
||||
|
||||
/**
|
||||
* Returns true if this and all nested {@code Messages} instances have no messages.
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns true if this and all nested {@code Messages} instances have no messages for the given severity.
|
||||
*
|
||||
* @param severity message severity
|
||||
*/
|
||||
boolean isEmpty(Severity severity);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.apache.struts2;
|
||||
|
||||
/**
|
||||
* Commonly used result names returned by action methods.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public final class ResultNames {
|
||||
|
||||
private ResultNames() {}
|
||||
|
||||
/**
|
||||
* The action executed successfully.
|
||||
*/
|
||||
public static final String SUCCESS = "success";
|
||||
|
||||
/**
|
||||
* The action requires more input, i.e. a validation error occurred.
|
||||
*/
|
||||
public static final String INPUT = "input";
|
||||
|
||||
/**
|
||||
* The action requires the user to log in before executing.
|
||||
*/
|
||||
public static final String LOGIN = "login";
|
||||
|
||||
/**
|
||||
* The action execution failed irrecoverably.
|
||||
*/
|
||||
public static final String ERROR = "error";
|
||||
|
||||
/**
|
||||
* The action executed successfully, but do not execute a result.
|
||||
*/
|
||||
public static final String NONE = "none";
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.apache.struts2;
|
||||
|
||||
import org.apache.struts2.MessageAware;
|
||||
|
||||
/**
|
||||
* Implemented by actions which wish to execute some validation logic before their action method. Useful for
|
||||
* cross-field validations.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Validatable extends MessageAware {
|
||||
|
||||
/**
|
||||
* Validates input. Executes before action method.
|
||||
*/
|
||||
public void validate();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.apache.struts2.servlet;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Implemented by actions which need direct access to the request parameters.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface ParameterAware {
|
||||
|
||||
/**
|
||||
* Sets parameters.
|
||||
*
|
||||
* @param parameters map of parameter name to parameter values
|
||||
*/
|
||||
void setParameters(Map<String, String[]> parameters);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.apache.struts2.servlet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Implemented by actions which need direct access to the servlet request.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface ServletRequestAware {
|
||||
|
||||
/**
|
||||
* Sets the servlet request.
|
||||
*
|
||||
* @param request servlet request.
|
||||
*/
|
||||
void setServletRequest(HttpServletRequest request);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.apache.struts2.servlet;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Implemented by actions which need direct access to the servlet response.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface ServletResponseAware {
|
||||
|
||||
/**
|
||||
* Sets the servlet response.
|
||||
*
|
||||
* @param response servlet response
|
||||
*/
|
||||
void setServletResponse(HttpServletResponse response);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Context of an action execution.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface ActionContext {
|
||||
|
||||
/**
|
||||
* Gets action instance.
|
||||
*/
|
||||
Object getAction();
|
||||
|
||||
/**
|
||||
* Gets action method.
|
||||
*/
|
||||
Method getMethod();
|
||||
|
||||
/**
|
||||
* Gets action name.
|
||||
*/
|
||||
String getActionName();
|
||||
|
||||
/**
|
||||
* Gets the path for the action's namespace.
|
||||
*/
|
||||
String getNamespacePath();
|
||||
|
||||
/**
|
||||
* Gets the {@link Result} instance for the action.
|
||||
*
|
||||
* @return {@link Result} instance or {@code null} if we don't have a result yet.
|
||||
*/
|
||||
Result getResult();
|
||||
|
||||
/**
|
||||
* Adds a result interceptor for the action. Enables executing code before and after a result, executing an
|
||||
* alternate result, etc.
|
||||
*/
|
||||
void addResultInterceptor(Result interceptor);
|
||||
|
||||
/**
|
||||
* Gets context of action which chained to us.
|
||||
*
|
||||
* @return context of previous action or {@code null} if this is the first action in the chain
|
||||
*/
|
||||
ActionContext getPrevious();
|
||||
|
||||
/**
|
||||
* Gets context of action which this action chained to.
|
||||
*
|
||||
* @return context of next action or {@code null} if we haven't chained to another action yet or this is the last
|
||||
* action in the chain.
|
||||
*/
|
||||
ActionContext getNext();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
/**
|
||||
* Intercepts an action request.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Interceptor {
|
||||
|
||||
/**
|
||||
* Intercepts an action request.
|
||||
*
|
||||
* @param requestContext current request context
|
||||
*/
|
||||
String intercept(RequestContext requestContext) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
import org.apache.struts2.Messages;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Request context. A single request may span multiple actions with action chaining.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface RequestContext {
|
||||
|
||||
/**
|
||||
* Gets context of the currently executing action.
|
||||
*
|
||||
* @return current action context
|
||||
*/
|
||||
ActionContext getActionContext();
|
||||
|
||||
/**
|
||||
* Convenience method. Equivalent to {@code getActionContext().getAction()}.
|
||||
*
|
||||
* @return currently executing action
|
||||
*/
|
||||
Object getAction();
|
||||
|
||||
/**
|
||||
* Gets map of request parameters.
|
||||
*/
|
||||
Map<String, String[]> getParameterMap();
|
||||
|
||||
/**
|
||||
* Gets map of request attributes.
|
||||
*/
|
||||
Map<String, Object> getAttributeMap();
|
||||
|
||||
/**
|
||||
* Gets map of session attributes.
|
||||
*/
|
||||
Map<String, Object> getSessionMap();
|
||||
|
||||
/**
|
||||
* Gets map of application (servlet context) attributes.
|
||||
*/
|
||||
Map<String, Object> getApplicationMap();
|
||||
|
||||
/**
|
||||
* Finds cookies with the given name,
|
||||
*/
|
||||
List<Cookie> findCookiesForName(String name);
|
||||
|
||||
/**
|
||||
* Gets locale.
|
||||
*/
|
||||
Locale getLocale();
|
||||
|
||||
/**
|
||||
* Sets locale. Stores the locale in the session for future requests.
|
||||
*/
|
||||
void setLocale(Locale locale);
|
||||
|
||||
/**
|
||||
* Gets messages.
|
||||
*/
|
||||
Messages getMessages();
|
||||
|
||||
/**
|
||||
* Gets the servlet request.
|
||||
*/
|
||||
HttpServletRequest getServletRequest();
|
||||
|
||||
/**
|
||||
* Gets the servlet response.
|
||||
*/
|
||||
HttpServletResponse getServletResponse();
|
||||
|
||||
/**
|
||||
* Gets the servlet context.
|
||||
*/
|
||||
ServletContext getServletContext();
|
||||
|
||||
/**
|
||||
* Gets the value stack.
|
||||
*/
|
||||
ValueStack getValueStack();
|
||||
|
||||
/**
|
||||
* Invokes the next interceptor or the action method if no more interceptors remain.
|
||||
*
|
||||
* @return result name
|
||||
* @throws IllegalStateException if already invoked or called from the action
|
||||
*/
|
||||
String proceed() throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
import org.apache.struts2.spi.RequestContext;
|
||||
|
||||
/**
|
||||
* Implemented by actions that need access to the current {@link org.apache.struts2.spi.RequestContext}. Use
|
||||
* judiciously.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface RequestContextAware {
|
||||
|
||||
/**
|
||||
* Sets {@link org.apache.struts2.spi.RequestContext}.
|
||||
*
|
||||
* @param requestContext
|
||||
*/
|
||||
void setRequestContext(RequestContext requestContext);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
import org.apache.struts2.spi.RequestContext;
|
||||
|
||||
/**
|
||||
* The result of an action request. Struts creates a new {@code Result} instance for each request.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface Result {
|
||||
|
||||
/**
|
||||
* Executes result.
|
||||
*
|
||||
* @param requestContext
|
||||
*/
|
||||
void execute(RequestContext requestContext) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package org.apache.struts2.spi;
|
||||
|
||||
/**
|
||||
* A central fixture of the Struts framework, the {@code ValueStack} is a stack which contains the actions
|
||||
* which have executed in addition to other objects. Users can get and set values on the stack using expressions. The
|
||||
* {@code ValueStack} will search down the stack starting with the most recent objects until it finds an object to
|
||||
* which the expression can apply.
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
public interface ValueStack extends Iterable<Object> {
|
||||
|
||||
/**
|
||||
* Gets the top, most recent object from the stack without changing the stack.
|
||||
*
|
||||
* @return the top object
|
||||
*/
|
||||
Object peek();
|
||||
|
||||
/**
|
||||
* Removes the top, most recent object from the stack.
|
||||
*
|
||||
* @return the top object
|
||||
*/
|
||||
Object pop();
|
||||
|
||||
/**
|
||||
* Pushes an object onto the stack.
|
||||
*
|
||||
* @param o
|
||||
*/
|
||||
void push(Object o);
|
||||
|
||||
/**
|
||||
* Creates a shallow copy of this stack.
|
||||
*
|
||||
* @return a new stack which contains the same objects as this one
|
||||
*/
|
||||
ValueStack clone();
|
||||
|
||||
/**
|
||||
* Queries the stack. Starts with the top, most recent object. If the expression can apply to the object, this
|
||||
* method returns the result of evaluating the expression. If the expression does not apply, this method moves
|
||||
* down the stack to the next object and repeats. Returns {@code null} if the expression doesn't apply to any
|
||||
* objects.
|
||||
*
|
||||
* @param expression
|
||||
* @return the evaluation of the expression against the first applicable object in the stack
|
||||
*/
|
||||
Object get(String expression);
|
||||
|
||||
/**
|
||||
* Queries the stack and converts the result to the specified type. Starts with the top, most recent object. If
|
||||
* the expression can apply to the object, this method returns the result of evaluating the expression converted
|
||||
* to the specified type. If the expression does not apply, this method moves down the stack to the next object
|
||||
* and repeats. Returns {@code null} if the expression doesn't apply to any objects.
|
||||
*
|
||||
* @param expression
|
||||
* @param asType the type to convert the result to
|
||||
* @return the evaluation of the expression against the first applicable object in the stack converted to the
|
||||
* specified type
|
||||
*/
|
||||
<T> T get(String expression, Class<T> asType);
|
||||
|
||||
/**
|
||||
* Queries the stack and converts the result to a {@code String}. Starts with the top, most recent object. If the
|
||||
* expression can apply to the object, this method returns the result of evaluating the expression converted to a
|
||||
* {@code String}. If the expression does not apply, this method moves down the stack to the next object and
|
||||
* repeats. Returns {@code null} if the expression doesn't apply to any objects.
|
||||
*
|
||||
* @param expression
|
||||
* @return the evaluation of the expression against the first applicable object in the stack converted to a {@code
|
||||
* String}
|
||||
*/
|
||||
String getString(String expression);
|
||||
|
||||
/**
|
||||
* Sets a value on an object from the stack. This method starts at the top, most recent object. If the expression
|
||||
* applies to that object, this methods sets the given value on that object using the expression and converting
|
||||
* the type as necessary. If the expression does not apply, this method moves to the next object and repeats.
|
||||
*
|
||||
* @param expression
|
||||
* @param value
|
||||
*/
|
||||
void set(String expression, Object value);
|
||||
|
||||
/**
|
||||
* Returns the number of object on the stack.
|
||||
*
|
||||
* @return size of stack
|
||||
*/
|
||||
int size();
|
||||
}
|
||||
@@ -1,174 +1,174 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
@@ -0,0 +1,6 @@
|
||||
Apache Struts
|
||||
|
||||
Copyright 2006 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/
|
||||
@@ -1,10 +1,10 @@
|
||||
README.txt - blank
|
||||
|
||||
This is an "empty" application that you can deploy as the basis of your own
|
||||
application.
|
||||
|
||||
For more on getting started with Struts, see
|
||||
|
||||
* http://cwiki.apache.org/WW/home.html
|
||||
|
||||
README.txt - blank
|
||||
|
||||
This is an "empty" application that you can deploy as the basis of your own
|
||||
application.
|
||||
|
||||
For more on getting started with Struts, see
|
||||
|
||||
* http://cwiki.apache.org/WW/home.html
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
+20
-32
@@ -1,32 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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">
|
||||
<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>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.0.2</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-blank</artifactId>
|
||||
@@ -34,9 +13,9 @@
|
||||
<name>Blank Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps/blank</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps/blank</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_2/apps/blank</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/blank/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/blank/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/blank/</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
@@ -54,23 +33,32 @@
|
||||
<version>2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>struts2-junit-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.0.1</version>
|
||||
<artifactId>maven-jetty6-plugin</artifactId>
|
||||
<configuration>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee_1.4_spec</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
set CLASSPATH=..\..\..\lib\xwork-2.0-beta-1.jar
|
||||
javac *.java -d ..\..\..\classes
|
||||
@@ -1,5 +0,0 @@
|
||||
Apache Struts
|
||||
Copyright 2000-2007 The Apache Software Foundation
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
@@ -1,25 +1,25 @@
|
||||
<?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>
|
||||
|
||||
<package name="example" namespace="/example" extends="struts-default">
|
||||
|
||||
<action name="HelloWorld" class="example.HelloWorld">
|
||||
<result>/example/HelloWorld.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="Login_*" method="{1}" class="example.Login">
|
||||
<result name="input">/example/Login.jsp</result>
|
||||
<result type="redirectAction">Menu</result>
|
||||
</action>
|
||||
|
||||
<action name="*" class="example.ExampleSupport">
|
||||
<result>/example/{1}.jsp</result>
|
||||
</action>
|
||||
|
||||
<!-- Add actions here -->
|
||||
</package>
|
||||
</struts>
|
||||
<?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>
|
||||
|
||||
<package name="example" namespace="/example" extends="struts-default">
|
||||
|
||||
<action name="HelloWorld" class="example.HelloWorld">
|
||||
<result>/example/HelloWorld.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="Login_*" method="{1}" class="example.Login">
|
||||
<result name="input">/example/Login.jsp</result>
|
||||
<result type="redirect-action">Menu</result>
|
||||
</action>
|
||||
|
||||
<action name="*" class="example.ExampleSupport">
|
||||
<result>/example/{1}.jsp</result>
|
||||
</action>
|
||||
|
||||
<!-- Add actions here -->
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<!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="username">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="requiredstring"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="password">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="requiredstring"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
<!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="username">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="requiredstring"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="password">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="requiredstring"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<struts>
|
||||
|
||||
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
|
||||
<constant name="struts.devMode" value="false" />
|
||||
<constant name="struts.devMode" value="true" />
|
||||
|
||||
<include file="example.xml"/>
|
||||
|
||||
|
||||
@@ -21,12 +21,10 @@
|
||||
|
||||
package example;
|
||||
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class HelloWorldTest extends StrutsTestCase {
|
||||
public class HelloWorldTest extends TestCase {
|
||||
|
||||
public void testHelloWorld() throws Exception {
|
||||
HelloWorld hello_world = new HelloWorld();
|
||||
|
||||
+17
-17
@@ -1,18 +1,18 @@
|
||||
README.txt - mailreader
|
||||
|
||||
The MailReader demonstrates a localized application with a master/child
|
||||
CRUD workflow.
|
||||
|
||||
This rendition also demonstrates using wildcards to "normalize" an
|
||||
application.
|
||||
|
||||
See the Sandbox for other MailReader examples using other architectures.
|
||||
|
||||
* http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2/apps/
|
||||
|
||||
For more about the MailReader applicaton genneraly, visit Struts University.
|
||||
|
||||
* http://www.StrutsUniversity.org/
|
||||
|
||||
|
||||
README.txt - mailreader
|
||||
|
||||
The MailReader demonstrates a localized application with a master/child
|
||||
CRUD workflow.
|
||||
|
||||
This rendition also demonstrates using wildcards to "normalize" an
|
||||
application.
|
||||
|
||||
See the Sandbox for other MailReader examples using other architectures.
|
||||
|
||||
* http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2/apps/
|
||||
|
||||
For more about the MailReader applicaton genneraly, visit Struts University.
|
||||
|
||||
* http://www.StrutsUniversity.org/
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
+14
-29
@@ -1,32 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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">
|
||||
<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>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.0.2</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-mailreader</artifactId>
|
||||
@@ -34,13 +13,13 @@
|
||||
<name>Starter Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps/mailreader</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps/mailreader</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_2/apps/mailreader</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/mailreader/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/mailreader/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/mailreader/</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
@@ -52,8 +31,14 @@
|
||||
<artifactId>struts-mailreader-dao</artifactId>
|
||||
<version>1.3.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-spring-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
|
||||
<beans default-autowire="autodetect">
|
||||
<!-- add your spring beans here -->
|
||||
</beans>
|
||||
@@ -1,47 +1,47 @@
|
||||
<?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>
|
||||
|
||||
<package name="mailreader-default" namespace="/" extends="struts-default">
|
||||
|
||||
<interceptors>
|
||||
|
||||
<interceptor name="authentication"
|
||||
class="mailreader2.AuthenticationInterceptor"/>
|
||||
|
||||
<interceptor-stack name="user" >
|
||||
<interceptor-ref name="authentication" />
|
||||
<interceptor-ref name="defaultStack"/>
|
||||
</interceptor-stack>
|
||||
|
||||
<interceptor-stack name="user-submit" >
|
||||
<interceptor-ref name="tokenSession" />
|
||||
<interceptor-ref name="user"/>
|
||||
</interceptor-stack>
|
||||
|
||||
<interceptor-stack name="guest" >
|
||||
<interceptor-ref name="defaultStack"/>
|
||||
</interceptor-stack>
|
||||
|
||||
</interceptors>
|
||||
|
||||
<default-interceptor-ref name="user"/>
|
||||
|
||||
<global-results>
|
||||
<result name="error">/pages/Error.jsp</result>
|
||||
<result name="invalid.token">/pages/Error.jsp</result>
|
||||
<result name="login" type="redirectAction">Login_input</result>
|
||||
</global-results>
|
||||
|
||||
<global-exception-mappings>
|
||||
<exception-mapping
|
||||
result="error"
|
||||
exception="java.lang.Throwable"/>
|
||||
</global-exception-mappings>
|
||||
|
||||
</package>
|
||||
|
||||
</struts>
|
||||
<?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>
|
||||
|
||||
<package name="mailreader-default" namespace="/" extends="struts-default">
|
||||
|
||||
<interceptors>
|
||||
|
||||
<interceptor name="authentication"
|
||||
class="mailreader2.AuthenticationInterceptor"/>
|
||||
|
||||
<interceptor-stack name="user" >
|
||||
<interceptor-ref name="authentication" />
|
||||
<interceptor-ref name="defaultStack"/>
|
||||
</interceptor-stack>
|
||||
|
||||
<interceptor-stack name="user-submit" >
|
||||
<interceptor-ref name="token-session" />
|
||||
<interceptor-ref name="user"/>
|
||||
</interceptor-stack>
|
||||
|
||||
<interceptor-stack name="guest" >
|
||||
<interceptor-ref name="defaultStack"/>
|
||||
</interceptor-stack>
|
||||
|
||||
</interceptors>
|
||||
|
||||
<default-interceptor-ref name="user"/>
|
||||
|
||||
<global-results>
|
||||
<result name="error">/pages/Error.jsp</result>
|
||||
<result name="invalid.token">/pages/Error.jsp</result>
|
||||
<result name="login" type="redirect-action">Login_input</result>
|
||||
</global-results>
|
||||
|
||||
<global-exception-mappings>
|
||||
<exception-mapping
|
||||
result="error"
|
||||
exception="java.lang.Throwable"/>
|
||||
</global-exception-mappings>
|
||||
|
||||
</package>
|
||||
|
||||
</struts>
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
<?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>
|
||||
<package name="mailreader-support" namespace="/" extends="mailreader-default">
|
||||
|
||||
<action name="Tour">
|
||||
<result>/tour.html</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="Welcome" class="mailreader2.Welcome">
|
||||
<result>/Welcome.jsp</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="Logout" class="mailreader2.Logout">
|
||||
<result type="redirectAction">Welcome</result>
|
||||
</action>
|
||||
|
||||
<action name="Login_*" method="{1}" class="mailreader2.Login">
|
||||
<result name="input">/Login.jsp</result>
|
||||
<result name="cancel" type="redirectAction">Welcome</result>
|
||||
<result type="redirectAction">MainMenu</result>
|
||||
<result name="expired" type="chain">ChangePassword</result>
|
||||
<exception-mapping
|
||||
exception="org.apache.struts.apps.mailreader.dao.ExpiredPasswordException"
|
||||
result="expired"/>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="Registration_*" method="{1}" class="mailreader2.Registration">
|
||||
<result name="input">/Registration.jsp</result>
|
||||
<result type="redirectAction">MainMenu</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="subscription" namespace="/" extends="mailreader-support">
|
||||
|
||||
<global-results>
|
||||
<result name="input">/Subscription.jsp</result>
|
||||
<result type="redirectAction">Registration_input</result>
|
||||
</global-results>
|
||||
|
||||
<action name="Subscription_save" method="save" class="mailreader2.Subscription">
|
||||
<interceptor-ref name="user-submit" />
|
||||
</action>
|
||||
|
||||
<action name="Subscription_*" method="{1}" class="mailreader2.Subscription" />
|
||||
|
||||
</package>
|
||||
|
||||
<package name="wildcard" namespace="/" extends="mailreader-support">
|
||||
|
||||
<action name="*" class="mailreader2.MailreaderSupport">
|
||||
<result>/{1}.jsp</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
<?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>
|
||||
<package name="mailreader-support" namespace="/" extends="mailreader-default">
|
||||
|
||||
<action name="Tour">
|
||||
<result>/tour.html</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="Welcome" class="mailreader2.Welcome">
|
||||
<result>/Welcome.jsp</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="Logout" class="mailreader2.Logout">
|
||||
<result type="redirect-action">Welcome</result>
|
||||
</action>
|
||||
|
||||
<action name="Login_*" method="{1}" class="mailreader2.Login">
|
||||
<result name="input">/Login.jsp</result>
|
||||
<result name="cancel" type="redirect-action">Welcome</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<result name="expired" type="chain">ChangePassword</result>
|
||||
<exception-mapping
|
||||
exception="org.apache.struts.apps.mailreader.dao.ExpiredPasswordException"
|
||||
result="expired"/>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
|
||||
<action name="Registration_*" method="{1}" class="mailreader2.Registration">
|
||||
<result name="input">/Registration.jsp</result>
|
||||
<result type="redirect-action">MainMenu</result>
|
||||
<interceptor-ref name="guest"/>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="subscription" namespace="/" extends="mailreader-support">
|
||||
|
||||
<global-results>
|
||||
<result name="input">/Subscription.jsp</result>
|
||||
<result type="redirect-action">Registration_input</result>
|
||||
</global-results>
|
||||
|
||||
<action name="Subscription_save" method="save" class="mailreader2.Subscription">
|
||||
<interceptor-ref name="user-submit" />
|
||||
</action>
|
||||
|
||||
<action name="Subscription_*" method="{1}" class="mailreader2.Subscription" />
|
||||
|
||||
</package>
|
||||
|
||||
<package name="wildcard" namespace="/" extends="mailreader-support">
|
||||
|
||||
<action name="*" class="mailreader2.MailreaderSupport">
|
||||
<result>/{1}.jsp</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
@@ -21,20 +21,14 @@
|
||||
|
||||
package mailreader2;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUserDatabase;
|
||||
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* <p><code>ServletContextListener</code> that initializes and finalizes the
|
||||
@@ -100,7 +94,7 @@ public final class ApplicationListener implements ServletContextListener {
|
||||
/**
|
||||
* <p>Logging output for this plug in instance.</p>
|
||||
*/
|
||||
private Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
private Log log = LogFactory.getLog(this.getClass());
|
||||
|
||||
// ------------------------------------------------------------- Properties
|
||||
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
package mailreader2;
|
||||
|
||||
import com.opensymphony.xwork2.interceptor.Interceptor;
|
||||
|
||||
+14
-14
@@ -1,14 +1,14 @@
|
||||
<!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="username">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.username.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="password">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.password.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
<!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="username">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.username.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="password">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.password.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
@@ -21,20 +21,20 @@
|
||||
|
||||
package mailreader2;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.interceptor.ApplicationAware;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.struts.apps.mailreader.dao.ExpiredPasswordException;
|
||||
import org.apache.struts.apps.mailreader.dao.Subscription;
|
||||
import org.apache.struts.apps.mailreader.dao.User;
|
||||
import org.apache.struts.apps.mailreader.dao.UserDatabase;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemorySubscription;
|
||||
import org.apache.struts.apps.mailreader.dao.impl.memory.MemoryUser;
|
||||
import org.apache.struts2.interceptor.ApplicationAware;
|
||||
import org.apache.struts2.interceptor.SessionAware;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p> Base Action for MailreaderSupport application. </p>
|
||||
@@ -63,28 +63,6 @@ public class MailreaderSupport extends ActionSupport
|
||||
return Constants.CANCEL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to copy User properties.
|
||||
**/
|
||||
protected void copyUser(User source, User target) {
|
||||
if ((source==null) || (target==null)) return;
|
||||
target.setFromAddress(source.getFromAddress());
|
||||
target.setFullName(source.getFullName());
|
||||
target.setPassword(source.getPassword());
|
||||
target.setReplyToAddress(source.getReplyToAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to copy Subscription properties.
|
||||
**/
|
||||
protected void copySubscription(Subscription source, Subscription target) {
|
||||
if ((source==null) || (target==null)) return;
|
||||
target.setAutoConnect(source.getAutoConnect());
|
||||
target.setPassword(source.getPassword());
|
||||
target.setType(source.getType());
|
||||
target.setUsername(source.getUsername());
|
||||
}
|
||||
|
||||
|
||||
// ---- ApplicationAware ----
|
||||
|
||||
@@ -388,7 +366,7 @@ public class MailreaderSupport extends ActionSupport
|
||||
/**
|
||||
* <p><code>Log</code> instance for this application. </p>
|
||||
*/
|
||||
protected Logger log = LoggerFactory.getLogger(Constants.PACKAGE);
|
||||
protected Log log = LogFactory.getLog(Constants.PACKAGE);
|
||||
|
||||
/**
|
||||
* <p> Persist the User object, including subscriptions, to the database.
|
||||
@@ -457,7 +435,7 @@ public class MailreaderSupport extends ActionSupport
|
||||
input.setPassword(_password);
|
||||
User user = createUser(_username, _password);
|
||||
if (null != user) {
|
||||
copyUser(input,user);
|
||||
BeanUtils.copyProperties(input,user);
|
||||
setUser(user);
|
||||
}
|
||||
}
|
||||
@@ -554,7 +532,7 @@ public class MailreaderSupport extends ActionSupport
|
||||
Subscription input = getSubscription();
|
||||
Subscription sub = createSubscription(host);
|
||||
if (null != sub) {
|
||||
copySubscription(input, sub);
|
||||
BeanUtils.copyProperties(input, sub);
|
||||
setSubscription(sub);
|
||||
setHost(sub.getHost());
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ button.doReset=DO_RESULT
|
||||
button.doCancel=org.apache.struts.taglib.html.CANCEL
|
||||
button.reset=Reset
|
||||
button.save=Save
|
||||
button.logon=Log on
|
||||
change.message=Your password has expired. Please ask the system administrator to change it.
|
||||
change.try=Try Again
|
||||
change.title=Password Has Expired
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
<!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="username">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.username.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="user.fullName">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.fullName.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="user.fromAddress">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.fromAddress.required"/>
|
||||
</field-validator>
|
||||
<field-validator type="email">
|
||||
<message key="errors.email"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="user.replyToAddress">
|
||||
<field-validator type="email">
|
||||
<message key="errors.email"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
</validators>
|
||||
<!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="username">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.username.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="user.fullName">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.fullName.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="user.fromAddress">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.fromAddress.required"/>
|
||||
</field-validator>
|
||||
<field-validator type="email">
|
||||
<message key="errors.email"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="user.replyToAddress">
|
||||
<field-validator type="email">
|
||||
<message key="errors.email"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
</validators>
|
||||
|
||||
+23
-23
@@ -1,23 +1,23 @@
|
||||
<!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="subscription.username">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.username.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="subscription.password">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.password.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="subscription.type">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.type.invalid"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
</validators>
|
||||
<!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="subscription.username">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.username.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="subscription.password">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.password.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
<field name="subscription.type">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.type.invalid"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
</validators>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!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="host">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.host.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
</validators>
|
||||
<!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="host">
|
||||
<field-validator type="requiredstring">
|
||||
<message key="error.host.required"/>
|
||||
</field-validator>
|
||||
</field>
|
||||
|
||||
</validators>
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<?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.action.extension" value="do" />
|
||||
<constant name="struts.devMode" value="false" />
|
||||
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
|
||||
|
||||
<include file="mailreader-default.xml"/>
|
||||
|
||||
<include file="mailreader-support.xml"/>
|
||||
|
||||
<?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.action.extension" value="do" />
|
||||
<constant name="struts.devMode" value="false" />
|
||||
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
|
||||
<constant name="struts.objectFactory" value="spring" />
|
||||
|
||||
<include file="mailreader-default.xml"/>
|
||||
|
||||
<include file="mailreader-support.xml"/>
|
||||
|
||||
</struts>
|
||||
@@ -1,174 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
@@ -1,5 +0,0 @@
|
||||
Apache Struts
|
||||
Copyright 2000-2007 The Apache Software Foundation
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
@@ -2,5 +2,5 @@
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
<a href="<s:url action="Welcome" includeParams="none"/>"><s:text name="index.title"/></a>
|
||||
<a href="<s:url action="Welcome" />"><s:text name="index.title"/></a>
|
||||
</p>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<s:password key="password" showPassword="true"/>
|
||||
|
||||
<s:submit key="button.logon"/>
|
||||
<s:submit key="button.save"/>
|
||||
|
||||
<s:reset key="button.reset"/>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<s:hidden name="username"/>
|
||||
</s:else>
|
||||
|
||||
<s:password key="password" showPassword="true"/>
|
||||
<s:password key="password"/>
|
||||
<s:password key="password2"/>
|
||||
<s:textfield key="user.fullName"/>
|
||||
<s:textfield key="user.fromAddress"/>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<s:if test="task=='Delete'">
|
||||
<title><s:text name="subscription.title.delete"/></title>
|
||||
</s:if>
|
||||
<link href="<s:url value="/css/mailreader.css" includeParams="none"/>" rel="stylesheet"
|
||||
<link href="<s:url value="/css/mailreader.css"/>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version='1.0'?>
|
||||
<database>
|
||||
<user username="user" fromAddress="John.User@somewhere.com"
|
||||
fullName="John Q. User" password="pass">
|
||||
<subscription host="mail.hotmail.com" autoConnect="false"
|
||||
password="bar" type="pop3" username="user1234">
|
||||
</subscription>
|
||||
<subscription host="mail.yahoo.com" autoConnect="false" password="foo"
|
||||
type="imap" username="jquser">
|
||||
</subscription>
|
||||
</user>
|
||||
</database>
|
||||
<?xml version='1.0'?>
|
||||
<database>
|
||||
<user username="user" fromAddress="John.User@somewhere.com"
|
||||
fullName="John Q. User" password="pass">
|
||||
<subscription host="mail.hotmail.com" autoConnect="false"
|
||||
password="bar" type="pop3" username="user1234">
|
||||
</subscription>
|
||||
<subscription host="mail.yahoo.com" autoConnect="false" password="foo"
|
||||
type="imap" username="jquser">
|
||||
</subscription>
|
||||
</user>
|
||||
</database>
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
|
||||
<display-name>Struts 2 Mailreader</display-name>
|
||||
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath*:applicationContext*.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
<filter-name>Struts2</filter-name>
|
||||
<filter-class>
|
||||
@@ -13,16 +18,22 @@
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Struts2</filter-name>
|
||||
<url-pattern>*.do</url-pattern>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.springframework.web.context.ContextLoaderListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Application Listener for Mailreader database -->
|
||||
<listener>
|
||||
<listener-class>
|
||||
mailreader2.ApplicationListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
@@ -44,12 +44,13 @@
|
||||
|
||||
<hr/>
|
||||
|
||||
<p><s:i18n name="alternate"><a href="http://struts.apache.org/">
|
||||
<p><s:i18n name="alternate">
|
||||
<img src="<s:text name="struts.logo.path"/>"
|
||||
alt="<s:text name="struts.logo.alt"/>" border="0px"/>
|
||||
</a>
|
||||
alt="<s:text name="struts.logo.alt"/>"/>
|
||||
</s:i18n></p>
|
||||
|
||||
<p><a href="<s:url action="Tour" />"><s:text name="index.tour"/></a></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
|
||||
<p>
|
||||
<i>
|
||||
This article is meant to introduce a new user to Apache Struts 2 by
|
||||
This article is meant to introduce a new user to Apache Struts 2 by
|
||||
"walking through" a simple, but functional, application.
|
||||
The article includes code snippets, but for the best result, you might
|
||||
want to install the MailReader application on your own development
|
||||
The article includes code snippets, but for the best result, you might
|
||||
want to install the MailReader application on your own development
|
||||
workstation and follow along.
|
||||
Of course, the full source code to the MailReader is included in the
|
||||
Of course, the full source code to the MailReader is included in the
|
||||
distribution.
|
||||
</i>
|
||||
</p>
|
||||
@@ -28,7 +28,7 @@
|
||||
<p>
|
||||
<i>
|
||||
The tour assumes the reader has a basic understanding of the Java
|
||||
language, JavaBeans, web applications, and JavaServer Pages. For
|
||||
language, JavaBeans, web applications, and JavaServer Pages. For
|
||||
background on these technologies, see the
|
||||
<a href="http://struts.apache.org/primer.html">
|
||||
Key Technologies Primer</a>.
|
||||
@@ -215,7 +215,7 @@
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
You might note that the web.xml configuration does not specify which file extension
|
||||
You might note taht the web.xml configuration does not specify which file extension
|
||||
to use with actions.
|
||||
The default extension for Struts 2 is ".action",
|
||||
but the extension can be changed in the struts.properties file.
|
||||
@@ -255,10 +255,10 @@
|
||||
<p>
|
||||
The actions are listed in one or more XML configuration files,
|
||||
the default configuration file being named "struts.xml".
|
||||
When the application loads, the struts.xml, and any other files
|
||||
it includes, are parsed, and the framework creates a set of
|
||||
configuration objects.
|
||||
Among other things, the configuration maps a request for a certain
|
||||
When the application loads, the struts.xml, and any other files
|
||||
it includes, are parsed, and the framework creates a set of
|
||||
configuration objects.
|
||||
Among other things, the configuration maps a request for a certain
|
||||
page to a certain action mapping.
|
||||
</p>
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
<p>
|
||||
When the client requests "Welcome.do", the request is passed to the "struts2"
|
||||
FilterDispatcher (that we registered in the web.xml file).
|
||||
The FilterDispatcher retrieves the appropriate action mapping from the
|
||||
The FilterDispatcher retrieves the appropriate action mapping from the
|
||||
configuration.
|
||||
If we just wanted to forward to the Welcome page, we could use a simple
|
||||
configuration element.
|
||||
@@ -367,8 +367,8 @@
|
||||
<blockquote>
|
||||
<p>
|
||||
The Struts configuration lets us separate concerns and "say it once".
|
||||
The configuration helps us "normalize" an application,
|
||||
in much the same way we normalize a database schema.
|
||||
The configuration helps us "normalize" an application,
|
||||
in much the same way we normalize a database schema.
|
||||
</p>
|
||||
</blockquote>
|
||||
<hr/>
|
||||
@@ -429,7 +429,7 @@ public class Welcome extends MailreaderSupport {
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
Several common result names are predefined,
|
||||
Several common result names are predefined,
|
||||
including ERROR, SUCCESS, LOGIN, NONE, and INPUT,
|
||||
so that these tokens can be used consistently across Struts 2 applications.
|
||||
</p>
|
||||
@@ -541,7 +541,7 @@ public class Welcome extends MailreaderSupport {
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
If you change a message in the resource, and then rebuild and reload the
|
||||
If you change a message in the resource, and then rebuild and reload the
|
||||
application, the change will appear throughout the application.
|
||||
If you provide message resources for additional locales, you can
|
||||
localize your application.
|
||||
@@ -820,7 +820,7 @@ public class Welcome extends MailreaderSupport {
|
||||
</p>
|
||||
|
||||
<hr/>
|
||||
<pre><code><#if (actionErrors?exists && actionErrors?size > 0)>
|
||||
<pre><code><#if (actionErrors?exists && actionErrors?size > 0)>
|
||||
<ul>
|
||||
<#list actionErrors as error>
|
||||
<li><span class="errorMessage">${error}</span></li>
|
||||
@@ -837,7 +837,7 @@ public class Welcome extends MailreaderSupport {
|
||||
</p>
|
||||
|
||||
<hr/>
|
||||
<pre><code><#if (actionErrors?exists && actionErrors?size > 0)>
|
||||
<pre><code><#if (actionErrors?exists && actionErrors?size > 0)>
|
||||
<strong><table></strong>
|
||||
<#list actionErrors as error>
|
||||
<strong><tr><td></strong><span class="errorMessage">${error}</span><strong></td></tr></strong>
|
||||
@@ -944,12 +944,12 @@ public class Welcome extends MailreaderSupport {
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
You may note that the DTD refers to "XWork".
|
||||
You may note that the DTD refers to "XWork".
|
||||
<a href="http://www.opensymphony.com/xwork/">
|
||||
Open Symphony XWork
|
||||
</a> is a generic command-pattern framework that can be used outside of a
|
||||
web environment. Essentially, Struts 2 is a web-based extension of the
|
||||
XWork framework.
|
||||
</a> is a generic command-pattern framework that can be used outside of a
|
||||
web environment. In practice, Struts 2 is a web-based extension of the
|
||||
XWork framework.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -959,7 +959,7 @@ public class Welcome extends MailreaderSupport {
|
||||
If the username is blank or absent, validation will fail and an error
|
||||
message is generated.
|
||||
The messages would be based on the "error.username.required" or
|
||||
"error.password.required" message templates from the resource bundle.
|
||||
"error.password.required" message templates, from the resource bundle.
|
||||
</p>
|
||||
|
||||
<!--
|
||||
@@ -1014,7 +1014,7 @@ public String <strong>execute()</strong> throws ExpiredPasswordException {
|
||||
|
||||
<p>
|
||||
Let's look at the relevant properties and methods from MailreaderSupport
|
||||
and another base class, <strong>ActionSupport</strong>, namely
|
||||
and another base class, <strong>ActionSupport</strong>, namely
|
||||
"getUsername", "getPassword", "findUser", "setUser", and "hasErrors".
|
||||
</p>
|
||||
|
||||
@@ -1064,7 +1064,7 @@ public void setPassword(String password) {
|
||||
<pre><code>public User <strong>findUser</strong>(String username, String password)
|
||||
throws <strong>ExpiredPasswordException</strong> {
|
||||
User user = <strong>getDatabase().findUser(username)</strong>;
|
||||
if ((user != null) && !user.getPassword().equals(password)) {
|
||||
if ((user != null) && !user.getPassword().equals(password)) {
|
||||
user = null;
|
||||
}
|
||||
if (user == null) {
|
||||
@@ -1101,7 +1101,7 @@ public void setPassword(String password) {
|
||||
When "findUser" returns,
|
||||
the Login Action looks to see if a valid (non-null) User object is returned.
|
||||
A valid User is passed to the <strong>User property</strong>.
|
||||
Although it is still a JavaBean property,
|
||||
Although it is still a JavaBean property,
|
||||
the User property is not implemented in quite the same way as Username and Password.
|
||||
</p>
|
||||
|
||||
@@ -1310,7 +1310,7 @@ public void <strong>setSession(Map value)</strong> {
|
||||
<p>
|
||||
Within the Login action element, the first result element is named "input".
|
||||
If validation or authentification fail,
|
||||
the Action class will return "input" and the framework will transfer control to the
|
||||
the Action class will return "input" and the framework will transfer control to the
|
||||
"Login.jsp" page.
|
||||
</p>
|
||||
|
||||
@@ -1427,7 +1427,7 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
||||
public String <strong>intercept</strong>(ActionInvocation actionInvocation) throws Exception {
|
||||
Map session = actionInvocation.getInvocationContext().getSession();
|
||||
User user = (User) session.get(Constants.USER_KEY);
|
||||
boolean isAuthenticated = (null!=user) && (null!=user.getDatabase());
|
||||
boolean isAuthenticated = (null!=user) && (null!=user.getDatabase());
|
||||
if (<strong>isAuthenticated</strong>) {
|
||||
return actionInvocation.invoke();
|
||||
}
|
||||
@@ -1462,7 +1462,7 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
||||
<interceptor-ref name="defaultStack"/>
|
||||
</interceptor-stack>
|
||||
<interceptor-stack name="<strong>user-submit</strong>" >
|
||||
<interceptor-ref name="tokenSession" />
|
||||
<interceptor-ref name="token-session" />
|
||||
<interceptor-ref name="user"/>
|
||||
</interceptor-stack>
|
||||
<interceptor-stack name="<strong>guest</strong>" >
|
||||
@@ -1473,7 +1473,7 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
The <strong>user</strong> stacks require that the client be authenticated.
|
||||
The <strong>user</strong> stacks require that the client be authenticated.
|
||||
In other words, that a User object is present in the session.
|
||||
The actions using a <strong>guest</strong> stack can be accessed by any client.
|
||||
The <strong>-submit</strong> versions of each can be used with actions
|
||||
@@ -1483,7 +1483,7 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
||||
<h5>Double Submits</h5>
|
||||
|
||||
<p>
|
||||
A common problem with designing web applications is that users are impatient
|
||||
A common problem with designing web applications is that users are impatient
|
||||
and response times can vary.
|
||||
Sometimes, people will press a submit button a second time.
|
||||
When this happens, the browser submits the request again,
|
||||
@@ -1518,11 +1518,11 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
||||
|
||||
<p>
|
||||
Because the default interceptor stack will now authenticate the client,
|
||||
we need to specify the standard "defaultStack" for the three
|
||||
we need to specify the standard "defaultStack" for the three
|
||||
"guest actions", Welcome, Login, and Register.
|
||||
Requiring authentification by default is the better practice, since it
|
||||
means that we won't forget to enable it when creating new actions.
|
||||
Meanwhile, those pesky users will ensure that we don't forget to disable
|
||||
Requiring authentification by default is the better practice, since it
|
||||
means that we won't forget to enable it when creating new actions.
|
||||
Meanwhile, those pesky users will ensure that we don't forget to disable
|
||||
authentification for "guest" services.
|
||||
</p>
|
||||
|
||||
@@ -1654,7 +1654,7 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
||||
The "test" tag is a convenient way to express presentation
|
||||
logic within your pages.
|
||||
Customized pages help to prevent user error,
|
||||
and dynamic customization reduces the number of server pages your
|
||||
and dynamic customization reduces the number of server pages your
|
||||
application needs to maintain, among other benefits.
|
||||
</font></p>
|
||||
</blockquote>
|
||||
@@ -1892,7 +1892,7 @@ public class <strong>AuthenticationInterceptor</strong> implements Interceptor {
|
||||
the value for the field is pushed onto the value stack.
|
||||
As a result, if the client enters text into an Integer field,
|
||||
the framework can still redisplay whatever was entered.
|
||||
An invalid input value is not stored in the field (even if it could be).
|
||||
An invalid input value is not stored in the field (even if it could be).
|
||||
The invalid input is pushed onto the stack for the scope of the request.
|
||||
</p>
|
||||
|
||||
@@ -2076,7 +2076,7 @@ public Subscription findSubscription(String host) {
|
||||
|
||||
<p>
|
||||
By keeping routine safety precautions out of the Action class,
|
||||
the all-important Action becomes smaller and easier to maintain.
|
||||
the all-important Actions becomes smaller and easier to maintain.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
+44
-97
@@ -1,32 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
/*
|
||||
* Copyright 2005-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*
|
||||
* $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">
|
||||
|
||||
<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>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.0.2</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
@@ -37,13 +36,12 @@
|
||||
<module>mailreader</module>
|
||||
<module>portlet</module>
|
||||
<module>showcase</module>
|
||||
<module>rest-showcase</module>
|
||||
</modules>
|
||||
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_2/apps</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/</url>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -52,7 +50,7 @@
|
||||
<url>scp://people.apache.org/www/struts.apache.org/struts2/apps</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>hostedqa</id>
|
||||
@@ -60,7 +58,7 @@
|
||||
<dependency>
|
||||
<groupId>com.hostedqa</groupId>
|
||||
<artifactId>hostedqa-remote-ant</artifactId>
|
||||
<version>1.7</version>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -107,10 +105,14 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<taskdef resource="hostedqatasks" classpathref="maven.plugin.classpath" />
|
||||
<upload file="${project.build.directory}/${project.build.finalName}.war" account="struts" email="${email}" password="${password}" resourceId="${resourceId}" />
|
||||
<taskdef resource="hostedqatasks" classpathref="maven.plugin.classpath"/>
|
||||
<upload file="${project.build.directory}/${project.build.finalName}.war"
|
||||
account="struts" email="${email}"
|
||||
password="${password}" resourceId="${resourceId}"/>
|
||||
|
||||
<playsuite suiteId="${suiteId}" clientConfigs="${clientConfigs}" appConfigs="${appConfigs}" account="struts" email="${email}" password="${password}" />
|
||||
<playsuite suiteId="${suiteId}" clientConfigs="${clientConfigs}" appConfigs="${appConfigs}" account="struts"
|
||||
email="${email}"
|
||||
password="${password}"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
@@ -119,52 +121,13 @@
|
||||
<dependency>
|
||||
<groupId>com.hostedqa</groupId>
|
||||
<artifactId>hostedqa-remote-ant</artifactId>
|
||||
<version>1.7</version>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>release</name>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<inherited>true</inherited>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>rat-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<addDefaultLicenseMatchers>false</addDefaultLicenseMatchers>
|
||||
<licenseMatchers>
|
||||
<classNames>
|
||||
<className>rat.analysis.license.ApacheSoftwareLicense20</className>
|
||||
</classNames>
|
||||
</licenseMatchers>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>src/**</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
@@ -172,7 +135,6 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
<version>0.3.1</version>
|
||||
<configuration>
|
||||
<container>
|
||||
<containerId>tomcat5x</containerId>
|
||||
@@ -194,11 +156,13 @@
|
||||
<phase>process-sources</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java" failonerror="false">
|
||||
<fileset dir="${basedir}/src/main/java" />
|
||||
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java"
|
||||
failonerror="false">
|
||||
<fileset dir="${basedir}/src/main/java"/>
|
||||
</copy>
|
||||
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java" failonerror="false">
|
||||
<fileset dir="${basedir}/src/main/resources" />
|
||||
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java"
|
||||
failonerror="false">
|
||||
<fileset dir="${basedir}/src/main/resources"/>
|
||||
</copy>
|
||||
</tasks>
|
||||
</configuration>
|
||||
@@ -208,27 +172,10 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<webResources>
|
||||
<resource>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<targetPath>META-INF</targetPath>
|
||||
<includes>
|
||||
<include>LICENSE.txt</include>
|
||||
<include>NOTICE.txt</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</webResources>
|
||||
<warSourceExcludes>WEB-INF/classes/LICENSE.txt,WEB-INF/classes/NOTICE.txt</warSourceExcludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
|
||||
<finalName>${pom.artifactId}</finalName>
|
||||
|
||||
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
@@ -242,9 +189,9 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-mock</artifactId>
|
||||
<version>2.0.7</version>
|
||||
<version>2.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
</project>
|
||||
|
||||
+16
-16
@@ -1,17 +1,17 @@
|
||||
README.txt - portlet
|
||||
|
||||
This is a simple example of using the portlet API with Struts applications.
|
||||
|
||||
For more on getting started with Struts, see
|
||||
|
||||
* http://cwiki.apache.org/WW/home.html
|
||||
|
||||
WARNING - Additional configuration required for deployment
|
||||
|
||||
Due to difference in portlet container implementations, the portlet
|
||||
WAR is not ready-to-run. Extract the portlet WAR, and then copy the
|
||||
contents of apps/portlet/src/main/etc/<your_portal_server>/ into the
|
||||
WAR's WEB-INF directory.
|
||||
|
||||
|
||||
README.txt - portlet
|
||||
|
||||
This is a simple example of using the portlet API with Struts applications.
|
||||
|
||||
For more on getting started with Struts, see
|
||||
|
||||
* http://cwiki.apache.org/WW/home.html
|
||||
|
||||
WARNING - Additional configuration required for deployment
|
||||
|
||||
Due to difference in portlet contrainer implementations, the porlet
|
||||
WAR is not ready-to-run. Extract the porlet WAR, and then copy the
|
||||
contents of apps/portlet/src/main/etc/<your_portal_server>/ into the
|
||||
WAR's WEB-INF directory.
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
+18
-200
@@ -1,32 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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">
|
||||
<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>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.0.2</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet</artifactId>
|
||||
@@ -34,63 +13,11 @@
|
||||
<name>Portlet Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps/portlet</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps/portlet</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_2/apps/portlet</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/portlet/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/portlet/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/portlet/</url>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>pluto</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- configure maven-war-plugin to use updated web.xml -->
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- bind 'pluto:assemble' goal to 'process-resources' lifecycle -->
|
||||
<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>StrutsPortlet</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>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>portlet-api</groupId>
|
||||
@@ -98,136 +25,27 @@
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-spring-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-dwr-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
<version>1.5</version>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-tools</artifactId>
|
||||
<version>1.3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>struts</groupId>
|
||||
<artifactId>struts</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-digester</groupId>
|
||||
<artifactId>commons-digester</artifactId>
|
||||
<version>1.8</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty</artifactId>
|
||||
<version>6.1.4rc0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-htmlunit-plugin</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bekk.boss</groupId>
|
||||
<artifactId>maven-jetty-pluto-embedded</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jsp-2.1</artifactId>
|
||||
<version>6.1.4rc0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>rat-maven-plugin</artifactId>
|
||||
<version>1.0-alpha-2</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
<include>src/**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>src/main/etc/gridsphere/README-gridsphere.txt</exclude>
|
||||
<exclude>src/main/etc/gridsphere/struts-portlet</exclude>
|
||||
<exclude>src/main/etc/jetspeed2/README-jetspeed2.txt</exclude>
|
||||
<exclude>src/main/etc/jetspeed2/struts-portlet.psml</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<page>
|
||||
<defaults
|
||||
skin="orange"
|
||||
layout-decorator="tigris"
|
||||
portlet-decorator="tigris"
|
||||
/>
|
||||
<title>Struts Portlet Example Application</title>
|
||||
<metadata name="title" xml:lang="en">Struts Portlet Example Application</metadata>
|
||||
|
||||
<fragment id="simplest" type="layout" name="jetspeed-layouts::VelocityTwoColumns">
|
||||
<fragment id="struts-portlet-1" type="portlet" name="struts-portlet::StrutsPortlet">
|
||||
<property layout="TwoColumns" name="row" value="0" />
|
||||
<property layout="TwoColumns" name="column" value="0" />
|
||||
</fragment>
|
||||
</fragment>
|
||||
|
||||
<security-constraints>
|
||||
<security-constraints-ref>public-view</security-constraints-ref>
|
||||
</security-constraints>
|
||||
<page>
|
||||
<defaults
|
||||
skin="orange"
|
||||
layout-decorator="tigris"
|
||||
portlet-decorator="tigris"
|
||||
/>
|
||||
<title>Struts Portlet Example Application</title>
|
||||
<metadata name="title" xml:lang="en">Struts Portlet Example Application</metadata>
|
||||
|
||||
<fragment id="simplest" type="layout" name="jetspeed-layouts::VelocityTwoColumns">
|
||||
<fragment id="struts-portlet-1" type="portlet" name="struts-portlet::StrutsPortlet">
|
||||
<property layout="TwoColumns" name="row" value="0" />
|
||||
<property layout="TwoColumns" name="column" value="0" />
|
||||
</fragment>
|
||||
</fragment>
|
||||
|
||||
<security-constraints>
|
||||
<security-constraints-ref>public-view</security-constraints-ref>
|
||||
</security-constraints>
|
||||
</page>
|
||||
@@ -20,17 +20,18 @@
|
||||
*/
|
||||
package org.apache.struts2.portlet.example;
|
||||
|
||||
import org.apache.struts2.dispatcher.DefaultActionSupport;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FormExample extends DefaultActionSupport {
|
||||
public class FormExample extends ActionSupport {
|
||||
|
||||
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,8 +44,4 @@ public class FormExample extends DefaultActionSupport {
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String displayResult() {
|
||||
return "displayResult";
|
||||
}
|
||||
}
|
||||
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
package org.apache.struts2.portlet.example.fileupload;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.struts2.dispatcher.DefaultActionSupport;
|
||||
|
||||
/**
|
||||
* File Upload example's action. <code>FileUploadAction</code>
|
||||
*
|
||||
*/
|
||||
public class FileUploadAction extends DefaultActionSupport {
|
||||
|
||||
private static final long serialVersionUID = 5156288255337069381L;
|
||||
|
||||
private String contentType;
|
||||
private File upload;
|
||||
private String fileName;
|
||||
private String caption;
|
||||
|
||||
// since we are using <s:file name="upload" .../> the file name will be
|
||||
// obtained through getter/setter of <file-tag-name>FileName
|
||||
public String getUploadFileName() {
|
||||
return fileName;
|
||||
}
|
||||
public void setUploadFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
|
||||
// since we are using <s:file name="upload" ... /> the content type will be
|
||||
// obtained through getter/setter of <file-tag-name>ContentType
|
||||
public String getUploadContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setUploadContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
|
||||
// since we are using <s:file name="upload" ... /> the File itself will be
|
||||
// obtained through getter/setter of <file-tag-name>
|
||||
public File getUpload() {
|
||||
return upload;
|
||||
}
|
||||
public void setUpload(File upload) {
|
||||
this.upload = upload;
|
||||
}
|
||||
|
||||
|
||||
public String getCaption() {
|
||||
return caption;
|
||||
}
|
||||
public void setCaption(String caption) {
|
||||
this.caption = caption;
|
||||
}
|
||||
|
||||
public String upload() throws Exception {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package org.apache.struts2.portlet.example.model;
|
||||
|
||||
public class Name {
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
Apache Struts
|
||||
Copyright 2000-2007 The Apache Software Foundation
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
@@ -0,0 +1,2 @@
|
||||
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory
|
||||
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?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>
|
||||
<package name="edit" extends="struts-portlet-default"
|
||||
namespace="/edit">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/index.jsp</result>
|
||||
</action>
|
||||
<action name="test"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/test.jsp</result>
|
||||
</action>
|
||||
<action name="formExampleEdit"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/edit/formExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExampleEdit"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="input">
|
||||
/WEB-INF/edit/formExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/edit/processFormExampleForward.action?firstName=${firstName}&lastName=${lastName}
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExampleForward"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">
|
||||
/WEB-INF/edit/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="editTest" extends="edit" namespace="/edit/dummy/test">
|
||||
<action name="testAction"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/namespaceTest.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?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>
|
||||
<package name="help" extends="struts-portlet-default"
|
||||
namespace="/help">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/help/index.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
@@ -0,0 +1 @@
|
||||
struts.objectFactory = spring
|
||||
@@ -1,10 +0,0 @@
|
||||
<?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>
|
||||
<include file="struts-view.xml"/>
|
||||
<include file="struts-edit.xml"/>
|
||||
<include file="struts-help.xml"/>
|
||||
</struts>
|
||||
@@ -1,7 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator Config 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd">
|
||||
<validators>
|
||||
<validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
|
||||
<validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
|
||||
|
||||
+72
-41
@@ -1,9 +1,10 @@
|
||||
<?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">
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE xwork PUBLIC
|
||||
"-//OpenSymphony Group//XWork 1.1.1//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-1.1.1.dtd">
|
||||
<xwork>
|
||||
<include file="struts-portlet-default.xml" />
|
||||
|
||||
<struts>
|
||||
<package name="view" extends="struts-portlet-default"
|
||||
namespace="/view">
|
||||
<action name="index"
|
||||
@@ -27,31 +28,6 @@
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</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">
|
||||
/WEB-INF/view/formExampleInputModelDriven.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="validationExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
@@ -68,15 +44,7 @@
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputValidation.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="fileUpload" class="org.apache.struts2.portlet.example.fileupload.FileUploadAction">
|
||||
<result name="input">
|
||||
/WEB-INF/view/fileUpload.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/fileUploadSuccess.jsp
|
||||
</result>
|
||||
<interceptor-ref name="validationWorkflowStack" />
|
||||
</action>
|
||||
|
||||
<action name="tokenExample"
|
||||
@@ -97,7 +65,8 @@
|
||||
<result name="success">
|
||||
/WEB-INF/view/tokenExample.jsp
|
||||
</result>
|
||||
<interceptor-ref name="portletDefaultStackWithToken" />
|
||||
<interceptor-ref name="token" />
|
||||
<interceptor-ref name="defaultStack" />
|
||||
</action>
|
||||
|
||||
<action name="springExample" class="springAction">
|
||||
@@ -106,6 +75,18 @@
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="ajaxExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">
|
||||
/WEB-INF/view/ajaxExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="ajaxData"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/view/ajaxData.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="freeMarkerExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport" method="input">
|
||||
<result type="freemarker" name="input">
|
||||
@@ -127,4 +108,54 @@
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
<package name="edit" extends="struts-portlet-default"
|
||||
namespace="/edit">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/index.jsp</result>
|
||||
</action>
|
||||
<action name="test"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/test.jsp</result>
|
||||
</action>
|
||||
<action name="formExampleEdit"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/edit/formExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExampleEdit"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="input">
|
||||
/WEB-INF/edtt/formExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/edit/processFormExampleForward.action?firstName=${firstName}&lastName=${lastName}
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExampleForward"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">
|
||||
/WEB-INF/edit/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="editTest" extends="edit" namespace="/edit/dummy/test">
|
||||
<action name="testAction"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/edit/namespaceTest.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="help" extends="struts-portlet-default"
|
||||
namespace="/help">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/help/index.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
</xwork>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dwr PUBLIC
|
||||
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
|
||||
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">
|
||||
<dwr>
|
||||
<allow>
|
||||
<create creator="new" javascript="validator">
|
||||
<param name="class" value="org.apache.struts2.validators.DWRValidator"/>
|
||||
</create>
|
||||
<convert converter="bean" match="com.opensymphony.xwork2.ValidationAwareSupport"/>
|
||||
</allow>
|
||||
|
||||
<signatures>
|
||||
<![CDATA[
|
||||
import java.util.Map;
|
||||
import org.apache.struts2.validators.DWRValidator;
|
||||
|
||||
DWRValidator.doPost(String, String, Map<String, String>);
|
||||
]]>
|
||||
</signatures>
|
||||
</dwr>
|
||||
@@ -1,384 +0,0 @@
|
||||
<?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>
|
||||
|
||||
@@ -1,131 +1,118 @@
|
||||
<?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="struts-portlet">
|
||||
|
||||
<portlet id="StrutsPortlet">
|
||||
<description xml:lang="EN">Struts Test Portlet</description>
|
||||
<portlet-name>StrutsPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet</display-name>
|
||||
<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">Struts Test Portlet</description>
|
||||
<portlet-name>StrutsPortlet</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<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 edit mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<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</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The help mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>helpNamespace</name>
|
||||
<value>/help</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in help mode. -->
|
||||
<init-param>
|
||||
<name>defaultHelpAction</name>
|
||||
<value>index</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>view</portlet-mode>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
||||
<supported-locale>en</supported-locale>
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet</title>
|
||||
<short-title>SP</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet</title>
|
||||
<short-title>SP</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
|
||||
<portlet id="StrutsPortlet2">
|
||||
<description xml:lang="EN">Struts Test Portlet2</description>
|
||||
<portlet-name>StrutsPortlet2</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet2</display-name>
|
||||
<portlet id="StrutsPortlet2">
|
||||
<description xml:lang="EN">Struts Test Portlet2</description>
|
||||
<portlet-name>StrutsPortlet2</portlet-name>
|
||||
<display-name xml:lang="EN">Struts Test Portlet2</display-name>
|
||||
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
|
||||
|
||||
<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>viewNamespace</name>
|
||||
<value>/view</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>
|
||||
|
||||
|
||||
<!-- The default action to invoke in view mode. -->
|
||||
<init-param>
|
||||
<name>defaultViewAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
||||
<!-- The edit mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>editNamespace</name>
|
||||
<value>/edit</value>
|
||||
</init-param>
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
<portlet-mode>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
</supports>
|
||||
|
||||
<!-- The default action to invoke in edit mode. -->
|
||||
<init-param>
|
||||
<name>defaultEditAction</name>
|
||||
<value>index</value>
|
||||
</init-param>
|
||||
<supported-locale>en</supported-locale>
|
||||
|
||||
<!-- The help mode namespace. Maps to a namespace in the Struts 2 config file. -->
|
||||
<init-param>
|
||||
<name>helpNamespace</name>
|
||||
<value>/help</value>
|
||||
</init-param>
|
||||
|
||||
<!-- The default action to invoke in help mode. -->
|
||||
<init-param>
|
||||
<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>My StrutsPortlet portlet2</title>
|
||||
<short-title>SP2</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
<portlet-info>
|
||||
<title>My StrutsPortlet portlet2</title>
|
||||
<short-title>SP2</short-title>
|
||||
<keywords>struts,portlet</keywords>
|
||||
</portlet-info>
|
||||
</portlet>
|
||||
|
||||
</portlet-app>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<H2>Hello from Ajax!</H2>
|
||||
@@ -0,0 +1 @@
|
||||
This data is fetched via Ajax! The server time is <%= new java.util.Date() %>
|
||||
@@ -0,0 +1,48 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<s:head theme="ajax"/>
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
|
||||
<b>This is a tabbed pane with two panels that fetches data from a remote action via ajax</b>
|
||||
|
||||
<s:tabbedPanel id="test2" theme="simple" >
|
||||
<s:div id="left" label="left" theme="ajax">
|
||||
This is the left pane<br/>
|
||||
<s:form >
|
||||
<s:textfield name="tt" label="Test Text" /> <br/>
|
||||
<s:textfield name="tt2" label="Test Text2" />
|
||||
</s:form>
|
||||
</s:div>
|
||||
<s:div href="/view/ajaxData.action" id="ryh1" theme="ajax" label="remote one" />
|
||||
<s:div id="middle" label="middle" theme="ajax">
|
||||
middle tab<br/>
|
||||
<s:form >
|
||||
<s:textfield name="tt" label="Test Text44" /> <br/>
|
||||
<s:textfield name="tt2" label="Test Text442" />
|
||||
</s:form>
|
||||
</s:div>
|
||||
<s:div href="/view/ajaxData.action" id="ryh21" theme="ajax" label="remote right" />
|
||||
</s:tabbedPanel>
|
||||
|
||||
<p/>
|
||||
A DIV that waits for 5 seconds before loading the contents
|
||||
<s:div
|
||||
id="once"
|
||||
theme="ajax"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="/view/ajaxData.action"
|
||||
delay="5000"
|
||||
loadingText="loading...">
|
||||
Waiting for data</s:div>
|
||||
<p/>
|
||||
A DIV that is updated every 2 seconds
|
||||
<s:div
|
||||
id="twoseconds"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="/view/ajaxData.action"
|
||||
theme="ajax"
|
||||
delay="2000"
|
||||
updateInterval="2000"
|
||||
errorText="There was an error"
|
||||
loadingText="loading...">Initial Content
|
||||
</s:div>
|
||||
<p/>
|
||||
<a href="<s:url action="index"/>">Back to front page</a>
|
||||
@@ -1,13 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<h1>Fileupload sample</h1>
|
||||
|
||||
<s:actionerror />
|
||||
<s:fielderror />
|
||||
<s:form action="fileUpload" method="POST" enctype="multipart/form-data">
|
||||
<s:file name="upload" label="File"/>
|
||||
<s:textfield name="caption" label="Caption"/>
|
||||
<s:submit />
|
||||
</s:form>
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<h1>Fileupload sample</h1>
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li>ContentType: <s:property value="uploadContentType" /></li>
|
||||
<li>FileName: <s:property value="uploadFileName" /></li>
|
||||
<li>File: <s:property value="upload" /></li>
|
||||
<li>Caption:<s:property value="caption" /></li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<H2>Input your name</H2>
|
||||
<s:form action="formExampleModelDriven" 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>
|
||||
@@ -1,8 +0,0 @@
|
||||
<%@ 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>
|
||||
@@ -1,6 +0,0 @@
|
||||
<%@ 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>
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
Hello World from velocity!
|
||||
<p />
|
||||
#surl ("id=url" "action=index")
|
||||
<a href="${url}">Back to the front page</a>
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
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>
|
||||
<li><a href="<s:url action="springExample"/>">Spring integration</a></li>
|
||||
<li><a href="<s:url action="fileUpload" method="input"/>">File upload</li>
|
||||
<li><a href="<s:url action="ajaxExample"/>">Ajax</a></li>
|
||||
<li><a href="<s:url action="freeMarkerExample"/>">FreeMarker</a></li>
|
||||
<li><a href="<s:url action="velocityHelloWorld"/>">Velocity</a></li>
|
||||
<li><a href="<s:url action="index" portletMode="edit"/>">Go to edit mode and see what's there</a></li>
|
||||
|
||||
@@ -4,15 +4,46 @@
|
||||
<!-- Uncomment/comment this if you need/don't need Spring support -->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
/WEB-INF/applicationContext*.xml
|
||||
</param-value>
|
||||
<param-value>/WEB-INF/applicationContext*.xml</param-value>
|
||||
</context-param>
|
||||
<filter id="filterdispatcher">
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.FilterDispatcher
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>action2</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.springframework.web.context.ContextLoaderListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
<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>
|
||||
<servlet id="dwr">
|
||||
<servlet-name>dwr</servlet-name>
|
||||
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>dwr</servlet-name>
|
||||
<url-pattern>/dwr/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Uncomment to use the dispatcher servlet -->
|
||||
<!--<servlet id="Struts2PortletDispatcherServlet">
|
||||
<servlet-name>Struts2PortletDispatcherServlet</servlet-name>
|
||||
<servlet-class>org.apache.struts2.portlet.dispatcher.DispatcherServlet</servlet-class>
|
||||
</servlet>-->
|
||||
|
||||
</web-app>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package org.apache.struts2.portlet.test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
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 String contextPath = "/test";
|
||||
|
||||
private int port;
|
||||
|
||||
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.setTempDirectory(new File("target/work"));
|
||||
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();
|
||||
// Retrieve the actual port that is used, in case a random, free port is
|
||||
// picked
|
||||
int port = server.getConnectors()[0].getLocalPort();
|
||||
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 setContextPath(String contextPath) {
|
||||
if(!contextPath.startsWith("/")) {
|
||||
this.contextPath = "/" + contextPath;
|
||||
}
|
||||
else {
|
||||
this.contextPath = contextPath;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public abstract String getPortletName();
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package org.apache.struts2.portlet.test;
|
||||
|
||||
public class Struts2PortletTest extends BasePortletTest {
|
||||
|
||||
private final static String PORTLET_NAME = "StrutsPortlet";
|
||||
|
||||
public void testNone() {}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.2</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-showcase</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.1.2</version>
|
||||
<name>Struts 2 Rest Showcase Example</name>
|
||||
<description>Struts 2 Rest Showcase Example</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>struts2-rest-showcase</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.0.1</version>
|
||||
<configuration>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,73 +0,0 @@
|
||||
package org.apache.struts2.rest.example;
|
||||
|
||||
public class Order {
|
||||
String id;
|
||||
String clientName;
|
||||
int amount;
|
||||
|
||||
public Order() {}
|
||||
|
||||
public Order(String id, String clientName, int amount) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.clientName = clientName;
|
||||
this.amount = amount;
|
||||
}
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
public String getClientName() {
|
||||
return clientName;
|
||||
}
|
||||
public void setClientName(String clientName) {
|
||||
this.clientName = clientName;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + amount;
|
||||
result = prime * result
|
||||
+ ((clientName == null) ? 0 : clientName.hashCode());
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
final Order other = (Order) obj;
|
||||
if (amount != other.amount)
|
||||
return false;
|
||||
if (clientName == null) {
|
||||
if (other.clientName != null)
|
||||
return false;
|
||||
} else if (!clientName.equals(other.clientName))
|
||||
return false;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
-92
@@ -1,92 +0,0 @@
|
||||
package org.apache.struts2.rest.example;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.struts2.config.Result;
|
||||
import org.apache.struts2.config.Results;
|
||||
import org.apache.struts2.dispatcher.ServletActionRedirectResult;
|
||||
import org.apache.struts2.rest.DefaultHttpHeaders;
|
||||
import org.apache.struts2.rest.HttpHeaders;
|
||||
|
||||
import com.opensymphony.xwork2.ModelDriven;
|
||||
import com.opensymphony.xwork2.Validateable;
|
||||
import com.opensymphony.xwork2.ValidationAwareSupport;
|
||||
|
||||
@Results({
|
||||
@Result(name="success", type=ServletActionRedirectResult.class, value="orders")
|
||||
})
|
||||
public class OrdersController extends ValidationAwareSupport implements ModelDriven<Object>, Validateable{
|
||||
|
||||
private Order model = new Order();
|
||||
private String id;
|
||||
private Collection<Order> list;
|
||||
private OrdersService ordersService = new OrdersService();
|
||||
|
||||
// GET /orders/1
|
||||
public HttpHeaders show() {
|
||||
return new DefaultHttpHeaders("show");
|
||||
}
|
||||
|
||||
// GET /orders
|
||||
public HttpHeaders index() {
|
||||
list = ordersService.getAll();
|
||||
return new DefaultHttpHeaders("index")
|
||||
.disableCaching();
|
||||
}
|
||||
|
||||
// GET /orders/1/edit
|
||||
public String edit() {
|
||||
return "edit";
|
||||
}
|
||||
|
||||
// GET /orders/new
|
||||
public String editNew() {
|
||||
model = new Order();
|
||||
return "editNew";
|
||||
}
|
||||
|
||||
// GET /orders/1/deleteConfirm
|
||||
public String deleteConfirm() {
|
||||
return "deleteConfirm";
|
||||
}
|
||||
|
||||
// DELETE /orders/1
|
||||
public String destroy() {
|
||||
ordersService.remove(id);
|
||||
addActionMessage("Order removed successfully");
|
||||
return "success";
|
||||
}
|
||||
|
||||
// POST /orders
|
||||
public HttpHeaders create() {
|
||||
ordersService.save(model);
|
||||
addActionMessage("New order created successfully");
|
||||
return new DefaultHttpHeaders("success")
|
||||
.setLocationId(model.getId());
|
||||
}
|
||||
|
||||
// PUT /orders/1
|
||||
public String update() {
|
||||
ordersService.save(model);
|
||||
addActionMessage("Order updated successfully");
|
||||
return "success";
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
if (model.getClientName() == null || model.getClientName().length() ==0) {
|
||||
addFieldError("clientName", "The client name is empty");
|
||||
}
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
if (id != null) {
|
||||
this.model = ordersService.get(id);
|
||||
}
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Object getModel() {
|
||||
return (list != null ? list : model);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package org.apache.struts2.rest.example;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class OrdersService {
|
||||
|
||||
private static Map<String,Order> orders = new HashMap<String,Order>();
|
||||
private static int nextId = 6;
|
||||
static {
|
||||
orders.put("3", new Order("3", "Bob", 33));
|
||||
orders.put("4", new Order("4", "Sarah", 44));
|
||||
orders.put("5", new Order("5", "Jim", 66));
|
||||
}
|
||||
|
||||
public Order get(String id) {
|
||||
return orders.get(id);
|
||||
}
|
||||
|
||||
public List<Order> getAll() {
|
||||
return new ArrayList<Order>(orders.values());
|
||||
}
|
||||
|
||||
public void save(Order order) {
|
||||
if (order.getId() == null) {
|
||||
order.setId(String.valueOf(nextId++));
|
||||
}
|
||||
|
||||
orders.put(order.getId(), order);
|
||||
}
|
||||
|
||||
public void remove(String id) {
|
||||
orders.remove(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<web-app id="starter" version="2.4"
|
||||
xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||
|
||||
<display-name>Struts 2 Rest Example</display-name>
|
||||
|
||||
|
||||
<!-- Filters -->
|
||||
<!-- START SNIPPET: filter -->
|
||||
<filter>
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
|
||||
<init-param>
|
||||
<param-name>actionPackages</param-name>
|
||||
<param-value>org.apache.struts2.rest.example</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<!-- END SNIPPET: filter -->
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>action2</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Welcome file lists -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
<% response.sendRedirect("orders"); %>
|
||||
@@ -1,23 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC
|
||||
"-//W3C//DTD XHTML 1.1 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Order ${id}</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action="../${id}?_method=DELETE" method="post">
|
||||
<p>
|
||||
Are you sure you want to delete order ${id}?
|
||||
</p>
|
||||
<div>
|
||||
<input type="submit" value="Delete" />
|
||||
<input type="button" value="Cancel" onclick="window.location.href = '../../orders'" />
|
||||
</div>
|
||||
</form>
|
||||
<br />
|
||||
<a href="../../orders">Back to Orders</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC
|
||||
"-//W3C//DTD XHTML 1.1 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Order <s:property value="id" /></title>
|
||||
</head>
|
||||
<body>
|
||||
<s:form method="post" action="%{#request.contextPath}/orders/%{id}">
|
||||
<s:hidden name="_method" value="put" />
|
||||
<table>
|
||||
<s:textfield name="id" label="ID" disabled="true"/>
|
||||
<s:textfield name="clientName" label="Client"/>
|
||||
<s:textfield name="amount" label="Amount" />
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<s:submit />
|
||||
</td>
|
||||
</table>
|
||||
</s:form>
|
||||
<a href="<%=request.getContextPath() %>/orders">Back to Orders</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC
|
||||
"-//W3C//DTD XHTML 1.1 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>New Order</title>
|
||||
</head>
|
||||
<body>
|
||||
<s:form method="post" action="%{#request.contextPath}/orders">
|
||||
<table>
|
||||
<s:textfield name="clientName" label="Client"/>
|
||||
<s:textfield name="amount" label="Amount" />
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<s:submit />
|
||||
</td>
|
||||
</table>
|
||||
</s:form>
|
||||
<a href="<%=request.getContextPath() %>/orders">Back to Orders</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC
|
||||
"-//W3C//DTD XHTML 1.1 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Orders</title>
|
||||
</head>
|
||||
<body>
|
||||
<s:actionmessage />
|
||||
<table>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Client</th>
|
||||
<th>Amount</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
<s:iterator value="model">
|
||||
<tr>
|
||||
<td>${id}</td>
|
||||
<td>${clientName}</td>
|
||||
<td>${amount}</td>
|
||||
<td><a href="orders/${id}">View</a> |
|
||||
<a href="orders/${id}/edit">Edit</a> |
|
||||
<a href="orders/${id}/deleteConfirm">Delete</a></td>
|
||||
</tr>
|
||||
</s:iterator>
|
||||
</table>
|
||||
<a href="orders/new">Create a new order</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC
|
||||
"-//W3C//DTD XHTML 1.1 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Order ${id}</title>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<td>${id}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Client</th>
|
||||
<td>${clientName}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Amount</th>
|
||||
<td>${amount}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="../orders">Back to Orders</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
README.txt - showcase
|
||||
|
||||
Showcase is a collection of examples with code that you might be adopt and
|
||||
adapt in your own applications.
|
||||
|
||||
For more on getting started with Struts, see
|
||||
|
||||
* http://cwiki.apache.org/WW/home.html
|
||||
|
||||
README.txt - showcase
|
||||
|
||||
Showcase is a collection of examples with code that you might be adopt and
|
||||
adapt in your own applications.
|
||||
|
||||
For more on getting started with Struts, see
|
||||
|
||||
* http://cwiki.apache.org/WW/home.html
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
+20
-64
@@ -1,32 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
/*
|
||||
* $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">
|
||||
<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>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.0.2</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
@@ -34,11 +13,11 @@
|
||||
<name>Showcase Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps/showcase</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_2/apps/showcase</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_2/apps/showcase</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/showcase/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/showcase/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/showcase/</url>
|
||||
</scm>
|
||||
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
@@ -52,19 +31,13 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-struts1-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-dojo-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jsf-plugin</artifactId>
|
||||
@@ -82,7 +55,7 @@
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-tiles-plugin</artifactId>
|
||||
@@ -91,17 +64,10 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-dwr-plugin</artifactId>
|
||||
<artifactId>struts2-continuations-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-jsp</artifactId>
|
||||
<version>2.0.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-codebehind-plugin</artifactId>
|
||||
@@ -113,47 +79,37 @@
|
||||
<artifactId>struts2-spring-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Velocity -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<groupId>velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<groupId>velocity-tools</groupId>
|
||||
<artifactId>velocity-tools</artifactId>
|
||||
<version>1.3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>struts</groupId>
|
||||
<artifactId>struts</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>opensymphony</groupId>
|
||||
<artifactId>sitemesh</artifactId>
|
||||
<version>2.3</version>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.ltd.getahead</groupId>
|
||||
<artifactId>dwr</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.1-beta-3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
@@ -181,9 +137,9 @@
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<configuration>
|
||||
<!--
|
||||
QuickStart can be used to extend other QuickStart configurations.
|
||||
This is great for applications that have multiple "editions" and
|
||||
extend upon a base webapp or evven just a base set of classes.
|
||||
-->
|
||||
<!--<extendsConfig>../path/to/quickstart.xml</extendsConfig>-->
|
||||
|
||||
<!--
|
||||
QuickStart supports reading your IDEA module configuration and
|
||||
using the libraries there. This is especially useful for maven
|
||||
users who don't have a single directory in their project that
|
||||
contains all the libraries they need.
|
||||
-->
|
||||
<ideaConfig>../../../xwork/xwork.iml,../../core/struts2-core.iml,struts2-showcase.iml</ideaConfig>
|
||||
|
||||
<!-- The context in which to deploy the web application -->
|
||||
<context>/showcase</context>
|
||||
|
||||
<!-- The port in which to deploy the web application -->
|
||||
<port>8080</port>
|
||||
|
||||
<!--
|
||||
The libs directories can be a jar, a directory of jars, or even
|
||||
a directory of directories (searched recursively)
|
||||
<libs>
|
||||
<dir>../../lib</dir>
|
||||
</libs>
|
||||
-->
|
||||
|
||||
<!--
|
||||
Optional: the location where your source files are. If this is
|
||||
not included, the auto-recompiling feature of QuickStart will
|
||||
not be enabled. You may wish to do this anyway, as this feature
|
||||
has been known to cause strange side effects. If you don't
|
||||
specify your sources, you must specify where your classes are by
|
||||
using the classDirs and libs elements
|
||||
<sources>
|
||||
<dir>src/main/java</dir>
|
||||
</sources>
|
||||
-->
|
||||
|
||||
<!--
|
||||
The classDirs directories can be a jar or a directory of classes.
|
||||
The WEB-INF/classes directory for each webDir (below) will automatically
|
||||
be added if it exists.
|
||||
-->
|
||||
<classDirs>
|
||||
<dir>src/main/resources</dir>
|
||||
<dir>target/classes</dir>
|
||||
<dir>../../core/target/classes</dir>
|
||||
</classDirs>
|
||||
|
||||
<!--
|
||||
You can specify one or more directories where your webapp files
|
||||
are located. This is useful if you have your project split up in
|
||||
unique ways. You can also specify the path that the directory is
|
||||
mapped to, relative to the context.
|
||||
-->
|
||||
<webDirs>
|
||||
<webDir>
|
||||
<path>/</path>
|
||||
<dir>src/main/webapp</dir>
|
||||
</webDir>
|
||||
</webDirs>
|
||||
</configuration>
|
||||
@@ -0,0 +1 @@
|
||||
struts.date.format=yyyy/MM/dd hh:mm:ss
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class DynamicTreeSelectAction extends ActionSupport {
|
||||
|
||||
|
||||
public String getNodeName() {
|
||||
return currentCategory != null ? currentCategory.getName() : "Node not found";
|
||||
return currentCategory.getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* $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.
|
||||
*/
|
||||
package org.apache.struts2.showcase;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
import com.opensymphony.xwork2.Preparable;
|
||||
import com.uwyn.rife.continuations.ContinuableObject;
|
||||
|
||||
// START SNIPPET: example
|
||||
public class Guess extends ActionSupport implements Preparable, ContinuableObject {
|
||||
int guess;
|
||||
|
||||
public void prepare() throws Exception {
|
||||
// We clear the error message state before the action.
|
||||
// That is because with continuations, the original (or cloned) action is being
|
||||
// executed, which will still have the old errors and potentially cause problems,
|
||||
// such as with the workflow interceptor
|
||||
clearErrorsAndMessages();
|
||||
}
|
||||
|
||||
public String execute() throws Exception {
|
||||
int answer = new Random().nextInt(100) + 1;
|
||||
int tries = 5;
|
||||
|
||||
while (answer != guess && tries > 0) {
|
||||
pause(Action.SUCCESS);
|
||||
|
||||
if (guess > answer) {
|
||||
addFieldError("guess", "Too high!");
|
||||
} else if (guess < answer) {
|
||||
addFieldError("guess", "Too low!");
|
||||
}
|
||||
|
||||
tries--;
|
||||
}
|
||||
|
||||
if (answer == guess) {
|
||||
addActionMessage("You got it!");
|
||||
} else {
|
||||
addActionMessage("You ran out of tries, the answer was " + answer);
|
||||
}
|
||||
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
public void setGuess(int guess) {
|
||||
this.guess = guess;
|
||||
}
|
||||
}
|
||||
// END SNIPPET: example
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user