mirror of
https://github.com/apache/struts.git
synced 2026-08-08 16:16:58 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a614104a48 | |||
| fa2439b51c | |||
| b721c64b5b |
+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.3</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();
|
||||
}
|
||||
+12
-4
@@ -1,10 +1,11 @@
|
||||
<?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">
|
||||
<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.0.13</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-blank</artifactId>
|
||||
@@ -46,11 +47,18 @@
|
||||
<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>
|
||||
|
||||
@@ -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/).
|
||||
@@ -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"/>
|
||||
|
||||
|
||||
+11
-4
@@ -1,10 +1,11 @@
|
||||
<?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">
|
||||
<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.0.13</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-mailreader</artifactId>
|
||||
@@ -18,7 +19,7 @@
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
@@ -30,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>
|
||||
@@ -32,6 +32,8 @@ 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.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -61,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 ----
|
||||
|
||||
@@ -455,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);
|
||||
}
|
||||
}
|
||||
@@ -552,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());
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
<struts>
|
||||
|
||||
<constant name="struts.action.extension" value="do" />
|
||||
<constant name="struts.devMode" value="true" />
|
||||
<constant name="struts.devMode" value="false" />
|
||||
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
|
||||
<constant name="struts.objectFactory" value="spring" />
|
||||
|
||||
<include file="mailreader-default.xml"/>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -9,17 +9,14 @@
|
||||
type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body onload="self.focus();document.Login.username.focus()">
|
||||
<body onLoad="self.focus();document.Login.username.focus()">
|
||||
|
||||
<s:actionerror />
|
||||
<s:text name="doesntexist" />
|
||||
<s:form action="Login" validate="true">
|
||||
<s:textfield key="username" />
|
||||
|
||||
<s:password key="password" showPassword="true"/>
|
||||
|
||||
<s:textfield name="doesntexist" />
|
||||
|
||||
<s:submit key="button.save"/>
|
||||
|
||||
<s:reset key="button.reset"/>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<li><a href="<s:url action="Logout"/>">
|
||||
<s:text name="mainMenu.logout"/>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body onload="self.focus();document.Registration_save_username.focus()">
|
||||
<body onLoad="self.focus();document.Registration_save_username.focus()">
|
||||
|
||||
<s:actionerror/>
|
||||
<s:form action="Registration_save" validate="false">
|
||||
@@ -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,11 +13,11 @@
|
||||
<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>
|
||||
|
||||
<body onload="self.focus();document.Subscription.username.focus()">
|
||||
<body onLoad="self.focus();document.Subscription.username.focus()">
|
||||
|
||||
<s:actionerror/>
|
||||
<s:form action="Subscription_save" validate="true">
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -182,36 +182,36 @@
|
||||
|
||||
<display-name>Struts 2 MailReader</display-name>
|
||||
|
||||
<strong><filter>
|
||||
<filter-name>struts2</filter-name>
|
||||
<filter-class>
|
||||
<strong><filter>
|
||||
<filter-name>struts2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.FilterDispatcher
|
||||
</filter-class>
|
||||
</filter></strong>
|
||||
</filter-class>
|
||||
</filter></strong>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name><strong>struts2</strong></filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<filter-mapping>
|
||||
<filter-name><strong>struts2</strong></filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.springframework.web.context.ContextLoaderListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Application Listener for MailReader database -->
|
||||
<listener>
|
||||
<listener-class>
|
||||
<!-- Application Listener for MailReader database -->
|
||||
<listener>
|
||||
<listener-class>
|
||||
mailreader2.ApplicationListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app></code></pre>
|
||||
</web-app></code></pre>
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
@@ -281,13 +281,13 @@
|
||||
|
||||
<hr/>
|
||||
<h5>MailReader's index.html</h5>
|
||||
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html><head>
|
||||
<META HTTP-EQUIV="Refresh" CONTENT="0;<strong>URL=Welcome.do</strong>">
|
||||
</head>
|
||||
<body>
|
||||
<p>Loading ...</p>
|
||||
</body></html></code></pre>
|
||||
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html><head>
|
||||
<META HTTP-EQUIV="Refresh" CONTENT="0;<strong>URL=Welcome.do</strong>">
|
||||
</head>
|
||||
<body>
|
||||
<p>Loading ...</p>
|
||||
</body></html></code></pre>
|
||||
<hr/>
|
||||
|
||||
<p>
|
||||
@@ -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>
|
||||
@@ -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) {
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
+42
-15
@@ -1,9 +1,31 @@
|
||||
<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">
|
||||
<?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$
|
||||
*/
|
||||
-->
|
||||
|
||||
<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.13</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
@@ -15,7 +37,7 @@
|
||||
<module>portlet</module>
|
||||
<module>showcase</module>
|
||||
</modules>
|
||||
|
||||
|
||||
<scm>
|
||||
<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>
|
||||
@@ -28,7 +50,7 @@
|
||||
<url>scp://people.apache.org/www/struts.apache.org/struts2/apps</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>hostedqa</id>
|
||||
@@ -83,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>
|
||||
@@ -109,7 +135,6 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
<version>0.3.1</version>
|
||||
<configuration>
|
||||
<container>
|
||||
<containerId>tomcat5x</containerId>
|
||||
@@ -131,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>
|
||||
@@ -146,9 +173,9 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
|
||||
<finalName>${pom.artifactId}</finalName>
|
||||
|
||||
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
@@ -166,5 +193,5 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
+15
-25
@@ -1,10 +1,11 @@
|
||||
<?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">
|
||||
<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.0.13</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet</artifactId>
|
||||
@@ -28,13 +29,7 @@
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-spring-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
@@ -56,25 +51,20 @@
|
||||
<artifactId>commons-digester</artifactId>
|
||||
<version>1.8</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<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.1</version>
|
||||
<version>2.0</version>
|
||||
</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.12</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -44,7 +44,4 @@ public class FormExample extends ActionSupport {
|
||||
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,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/).
|
||||
@@ -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>
|
||||
@@ -1,130 +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="view" extends="struts-portlet-default"
|
||||
namespace="/view">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/view/index.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="formExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/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">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputValidation.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processValidationExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
<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>
|
||||
</action>
|
||||
|
||||
<action name="tokenExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processTokenExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="input">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
<result name="invalid.token">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/tokenExample.jsp
|
||||
</result>
|
||||
<interceptor-ref name="portletDefaultStackWithToken" />
|
||||
</action>
|
||||
|
||||
<action name="springExample" class="springAction">
|
||||
<result name="success">
|
||||
/WEB-INF/view/springExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="freeMarkerExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport" method="input">
|
||||
<result type="freemarker" name="input">
|
||||
/WEB-INF/view/freeMarkerExampleInput.ftl
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFreeMarkerExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">/view/processFreeMarkerView.action?firstName=${firstName}&lastName=${lastName}</result>
|
||||
</action>
|
||||
|
||||
<action name="processFreeMarkerView" class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result type="freemarker" name="success">/WEB-INF/view/freeMarkerExample.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="velocityHelloWorld" class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result type="velocity" name="success">/WEB-INF/view/helloWorld.vm</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
@@ -1,11 +1,161 @@
|
||||
<?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>
|
||||
<include file="struts-portlet-default.xml"/>
|
||||
<include file="struts-view.xml"/>
|
||||
<include file="struts-edit.xml"/>
|
||||
<include file="struts-help.xml"/>
|
||||
</struts>
|
||||
<package name="view" extends="struts-portlet-default"
|
||||
namespace="/view">
|
||||
<action name="index"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="success">/WEB-INF/view/index.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="formExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFormExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="validationExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputValidation.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processValidationExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">
|
||||
/WEB-INF/view/formExample.jsp
|
||||
</result>
|
||||
<result name="input">
|
||||
/WEB-INF/view/formExampleInputValidation.jsp
|
||||
</result>
|
||||
<interceptor-ref name="validationWorkflowStack" />
|
||||
</action>
|
||||
|
||||
<action name="tokenExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport" method="input">
|
||||
<result name="input">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processTokenExample"
|
||||
class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result name="input">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
<result name="invalid.token">
|
||||
/WEB-INF/view/tokenExampleInput.jsp
|
||||
</result>
|
||||
<result name="success">
|
||||
/WEB-INF/view/tokenExample.jsp
|
||||
</result>
|
||||
<interceptor-ref name="token" />
|
||||
<interceptor-ref name="defaultStack" />
|
||||
</action>
|
||||
|
||||
<action name="springExample" class="springAction">
|
||||
<result name="success">
|
||||
/WEB-INF/view/springExample.jsp
|
||||
</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">
|
||||
/WEB-INF/view/freeMarkerExampleInput.ftl
|
||||
</result>
|
||||
</action>
|
||||
|
||||
<action name="processFreeMarkerExample"
|
||||
class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result name="success">/view/processFreeMarkerView.action?firstName=${firstName}&lastName=${lastName}</result>
|
||||
</action>
|
||||
|
||||
<action name="processFreeMarkerView" class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result type="freemarker" name="success">/WEB-INF/view/freeMarkerExample.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="velocityHelloWorld" class="com.opensymphony.xwork2.ActionSupport">
|
||||
<result type="velocity" name="success">/WEB-INF/view/helloWorld.vm</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
<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>
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
<!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"/>
|
||||
|
||||
@@ -1,132 +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>edit</portlet-mode>
|
||||
<portlet-mode>help</portlet-mode>
|
||||
<portlet-mode>view</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>
|
||||
<portlet-mode>view</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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -1,30 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE web-app
|
||||
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
<web-app id="StrutsPortlet">
|
||||
<!-- 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>
|
||||
</context-param>
|
||||
<filter id="filterdispatcher">
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.FilterDispatcher
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
<!-- 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>
|
||||
</context-param>
|
||||
|
||||
<filter id="filterdispatcher">
|
||||
<filter-name>Struts2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Struts2</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<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-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>
|
||||
|
||||
</web-app>
|
||||
|
||||
+13
-13
@@ -1,10 +1,11 @@
|
||||
<?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">
|
||||
<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.0.13</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
@@ -16,7 +17,7 @@
|
||||
<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>
|
||||
@@ -30,7 +31,7 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-struts1-plugin</artifactId>
|
||||
@@ -54,7 +55,7 @@
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-tiles-plugin</artifactId>
|
||||
@@ -62,10 +63,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-jsp</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<scope>runtime</scope>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-continuations-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -79,14 +79,14 @@
|
||||
<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>velocity</groupId>
|
||||
@@ -137,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,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
|
||||
-20
@@ -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 org.apache.struts2.showcase.freemarker;
|
||||
|
||||
import com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
+8
-12
@@ -57,7 +57,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
|
||||
public String execute() throws MalformedURLException, IOException {
|
||||
|
||||
if (page != null && page.trim().length() > 0) {
|
||||
if (page != null) {
|
||||
|
||||
InputStream in = ClassLoaderUtil.getResourceAsStream(page.substring(page.indexOf("//")+1), getClass());
|
||||
page = page.replace("//", "/");
|
||||
@@ -70,26 +70,18 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
}
|
||||
}
|
||||
pageLines = read(in, -1);
|
||||
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (className != null && className.trim().length() > 0) {
|
||||
className = "/" + className.replace('.', '/') + ".java";
|
||||
if (className != null) {
|
||||
className = "/"+className.replace('.', '/') + ".java";
|
||||
InputStream in = getClass().getResourceAsStream(className);
|
||||
if (in == null) {
|
||||
in = servletContext.getResourceAsStream("/WEB-INF/src"+className);
|
||||
}
|
||||
classLines = read(in, -1);
|
||||
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
if (config != null && config.trim().length() > 0) {
|
||||
if (config != null) {
|
||||
int pos = config.lastIndexOf(':');
|
||||
configLine = Integer.parseInt(config.substring(pos+1));
|
||||
config = config.substring(0, pos).replace("//", "/");
|
||||
@@ -126,6 +118,8 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
this.padding = padding;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the classLines
|
||||
*/
|
||||
@@ -221,4 +215,6 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
public void setServletContext(ServletContext arg0) {
|
||||
this.servletContext = arg0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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,6 +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/).
|
||||
Nifty Corners (http://www.html.it/articoli/nifty/index.html).
|
||||
+64
-64
@@ -1,73 +1,73 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
"-//OpenSymphony Group//XWork Validator 1.0//EN"
|
||||
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<!-- START SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
<validators>
|
||||
<field name="requiredValidatorField">
|
||||
<field-validator type="required">
|
||||
<message><![CDATA[ required ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="requiredStringValidatorField">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<field name="requiredValidatorField">
|
||||
<field-validator type="required">
|
||||
<message><![CDATA[ required ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="requiredStringValidatorField">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<message key="i18n.nothing.here"><![CDATA[ required and must be string ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="requiredStringValidatorField">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="requiredStringValidatorField">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<message key="i18n.requiredstring"><![CDATA[ required and must be string ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="integerValidatorField">
|
||||
<field-validator type="int">
|
||||
<param name="min">1</param>
|
||||
<param name="max">10</param>
|
||||
<message><![CDATA[ must be integer min 1 max 10 if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="dateValidatorField">
|
||||
<field-validator type="date">
|
||||
<param name="min">01/01/1990</param>
|
||||
<param name="max">01/01/2000</param>
|
||||
<message><![CDATA[ must be a min 01/01/1990 max 01/01/2000 if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="emailValidatorField">
|
||||
<field-validator type="email">
|
||||
<message><![CDATA[ must be a valid email if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="urlValidatorField">
|
||||
<field-validator type="url">
|
||||
<message><![CDATA[ must be a valid url if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="stringLengthValidatorField">
|
||||
<field-validator type="stringlength">
|
||||
<param name="maxLength">4</param>
|
||||
<param name="minLength">2</param>
|
||||
<param name="trim">true</param>
|
||||
<message><![CDATA[ must be a String of a specific greater than 1 less than 5 if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="regexValidatorField">
|
||||
<field-validator type="regex">
|
||||
<param name="expression">.*\.txt</param>
|
||||
<message><![CDATA[ regexValidatorField must match a regexp (.*\.txt) if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="fieldExpressionValidatorField">
|
||||
<field-validator type="fieldexpression">
|
||||
<param name="expression">(fieldExpressionValidatorField == requiredValidatorField)</param>
|
||||
<message><![CDATA[ must be the same as the Required Validator Field if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="integerValidatorField">
|
||||
<field-validator type="int">
|
||||
<param name="min">1</param>
|
||||
<param name="max">10</param>
|
||||
<message><![CDATA[ must be integer min 1 max 10 if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="dateValidatorField">
|
||||
<field-validator type="date">
|
||||
<param name="min">01/01/1990</param>
|
||||
<param name="max">01/01/2000</param>
|
||||
<message><![CDATA[ must be a min 01-01-1990 max 01-01-2000 if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="emailValidatorField">
|
||||
<field-validator type="email">
|
||||
<message><![CDATA[ must be a valid email if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="urlValidatorField">
|
||||
<field-validator type="url">
|
||||
<message><![CDATA[ must be a valid url if supplied ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="stringLengthValidatorField">
|
||||
<field-validator type="stringlength">
|
||||
<param name="maxLength">4</param>
|
||||
<param name="minLength">2</param>
|
||||
<param name="trim">true</param>
|
||||
<message><![CDATA[ must be a String of a specific greater than 1 less than 5 if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="regexValidatorField">
|
||||
<field-validator type="regex">
|
||||
<param name="expression">.*\.txt</param>
|
||||
<message><![CDATA[ regexValidatorField must match a regexp (.*\.txt) if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="fieldExpressionValidatorField">
|
||||
<field-validator type="fieldexpression">
|
||||
<param name="expression">(fieldExpressionValidatorField == requiredValidatorField)</param>
|
||||
<message><![CDATA[ must be the same as the Required Validator Field if specified ]]></message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
|
||||
<!-- END SNIPPET: fieldValidatorsExample -->
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
<struts>
|
||||
<package name="continuations" extends="struts-default" namespace="/continuations">
|
||||
<action name="guess" class="org.apache.struts2.showcase.Guess">
|
||||
<result type="freemarker">guess.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
@@ -10,7 +10,7 @@
|
||||
<default-action-ref name="download"/>
|
||||
|
||||
<action name="download" class="org.apache.struts2.showcase.filedownload.FileDownloadAction">
|
||||
<param name="inputPath">/images/struts.gif</param>
|
||||
<param name="inputPath">\images\struts.gif</param>
|
||||
<result name="success" type="stream">
|
||||
<param name="contentType">image/gif</param>
|
||||
<param name="inputName">inputStream</param>
|
||||
@@ -20,7 +20,7 @@
|
||||
</action>
|
||||
|
||||
<action name="download2" class="org.apache.struts2.showcase.filedownload.FileDownloadAction">
|
||||
<param name="inputPath">/images/struts-gif.zip</param>
|
||||
<param name="inputPath">\images\struts-gif.zip</param>
|
||||
<result name="success" type="stream">
|
||||
<param name="contentType">application/zip</param>
|
||||
<param name="inputName">inputStream</param>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<default-interceptor-ref name="integration" />
|
||||
<default-action-ref name="editGangster" />
|
||||
|
||||
<!-- Display entry page that uses Model-Driven technique -->
|
||||
<!-- Diplay entry page that uses Model-Driven technique -->
|
||||
<action name="editGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.EditGangsterAction</param>
|
||||
<result>modelDriven.jsp</result>
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
<result type="tiles">showcase.freemarker</result>
|
||||
</action>
|
||||
|
||||
<action name="freemarkerLayout">
|
||||
<result type="tiles">showcase.freemarkerLayout</result>
|
||||
</action>
|
||||
|
||||
<action name="sanity">
|
||||
<result type="redirect">/tiles/layout.jsp</result>
|
||||
<result type="redirect" name="success">/tiles/layout.jsp</result>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
struts.i18n.reload=true
|
||||
struts.devMode = true
|
||||
struts.configuration.xml.reload=true
|
||||
struts.continuations.package=org.apache.struts2.showcase
|
||||
struts.custom.i18n.resources=globalMessages
|
||||
#struts.action.extension=jspa
|
||||
struts.url.http.port = 8080
|
||||
struts.freemarker.manager.classname=customFreemarkerManager
|
||||
struts.serve.static=true
|
||||
struts.serve.static.browserCache=false
|
||||
struts.codebehind.defaultPackage=person
|
||||
@@ -7,27 +7,16 @@
|
||||
<!-- START SNIPPET: xworkSample -->
|
||||
<struts>
|
||||
|
||||
<!-- Some or all of these can be flipped to true for debugging -->
|
||||
<constant name="struts.i18n.reload" value="false" />
|
||||
<constant name="struts.devMode" value="false" />
|
||||
<constant name="struts.configuration.xml.reload" value="false" />
|
||||
<constant name="struts.custom.i18n.resources" value="globalMessages" />
|
||||
|
||||
<constant name="struts.codebehind.defaultPackage" value="person" />
|
||||
<constant name="struts.freemarker.manager.classname" value="customFreemarkerManager" />
|
||||
<constant name="struts.serve.static" value="true" />
|
||||
<constant name="struts.serve.static.browserCache" value="false" />
|
||||
|
||||
<include file="struts-chat.xml" />
|
||||
|
||||
|
||||
<include file="struts-hangman.xml" />
|
||||
|
||||
|
||||
<include file="struts-continuations.xml"/>
|
||||
|
||||
<include file="struts-tags.xml"/>
|
||||
|
||||
|
||||
<include file="struts-validation.xml" />
|
||||
|
||||
|
||||
<include file="struts-actionchaining.xml" />
|
||||
|
||||
<include file="struts-ajax.xml" />
|
||||
@@ -37,19 +26,19 @@
|
||||
<include file="struts-person.xml" />
|
||||
|
||||
<include file="struts-wait.xml" />
|
||||
|
||||
|
||||
<include file="struts-jsf.xml" />
|
||||
|
||||
<include file="struts-token.xml" />
|
||||
|
||||
|
||||
<include file="struts-model-driven.xml" />
|
||||
|
||||
|
||||
<include file="struts-integration.xml" />
|
||||
|
||||
|
||||
<include file="struts-filedownload.xml" />
|
||||
|
||||
|
||||
<include file="struts-conversion.xml" />
|
||||
|
||||
|
||||
<include file="struts-freemarker.xml" />
|
||||
|
||||
<include file="struts-tiles.xml" />
|
||||
@@ -59,17 +48,17 @@
|
||||
<package name="default" extends="struts-default">
|
||||
<interceptors>
|
||||
<interceptor-stack name="crudStack">
|
||||
<interceptor-ref name="checkbox" />
|
||||
<interceptor-ref name="checkbox" />
|
||||
<interceptor-ref name="params" />
|
||||
<interceptor-ref name="static-params" />
|
||||
<interceptor-ref name="static-params" />
|
||||
<interceptor-ref name="defaultStack" />
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
|
||||
<action name="showcase">
|
||||
<result>showcase.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="viewSource" class="org.apache.struts2.showcase.source.ViewSourceAction">
|
||||
<result>viewSource.jsp</result>
|
||||
</action>
|
||||
@@ -110,7 +99,7 @@
|
||||
<interceptor-ref name="basicStack"/>
|
||||
</action>
|
||||
<action name="edit-*" class="org.apache.struts2.showcase.action.EmployeeAction">
|
||||
<param name="empId">{1}</param>
|
||||
<param name="empId">{1}</param>
|
||||
<result>/empmanager/editEmployee.jsp</result>
|
||||
<interceptor-ref name="crudStack"><param name="validation.excludeMethods">execute</param></interceptor-ref>
|
||||
</action>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
|
||||
|
||||
// Calculate the view sources url
|
||||
String sourceUrl = request.getContextPath()+"/viewSource.action";
|
||||
com.opensymphony.xwork2.ActionInvocation inv = com.opensymphony.xwork2.ActionContext.getContext().getActionInvocation();
|
||||
@@ -14,9 +14,9 @@
|
||||
com.opensymphony.xwork2.util.location.Location loc = inv.getProxy().getConfig().getLocation();
|
||||
sourceUrl += "?config="+(loc != null ? loc.getURI()+":"+loc.getLineNumber() : "");
|
||||
sourceUrl += "&className="+inv.getProxy().getConfig().getClassName();
|
||||
|
||||
|
||||
if (inv.getResult() != null && inv.getResult() instanceof org.apache.struts2.dispatcher.StrutsResultSupport) {
|
||||
sourceUrl += "&page="+mapping.getNamespace()+"/"+((org.apache.struts2.dispatcher.StrutsResultSupport)inv.getResult()).getLastFinalLocation();
|
||||
sourceUrl += "&page="+mapping.getNamespace()+"/"+((org.apache.struts2.dispatcher.StrutsResultSupport)inv.getResult()).getLastFinalLocation();
|
||||
}
|
||||
} else {
|
||||
sourceUrl += "?page="+request.getServletPath();
|
||||
@@ -104,11 +104,11 @@
|
||||
|
||||
</div><!-- end content -->
|
||||
|
||||
<div>
|
||||
<p>
|
||||
<a href="<%=sourceUrl %>">View Sources</a>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
<a href="<%=sourceUrl %>">View Sources</a>
|
||||
</p>
|
||||
</div>
|
||||
<div id="footer" class="clearfix">
|
||||
<p>Copyright © 2003-<s:property value="#dateAction.now.year + 1900" /> The Apache Software Foundation.</p>
|
||||
</div><!-- end footer -->
|
||||
|
||||
@@ -28,21 +28,15 @@
|
||||
<tiles-definitions>
|
||||
|
||||
<definition name="showcase.index" template="/tiles/layout.jsp">
|
||||
<put-attribute name="title" value="Tiles Showcase"/>
|
||||
<put-attribute name="header" value="/tiles/header.jsp"/>
|
||||
<put-attribute name="body" value="/tiles/body.jsp"/>
|
||||
<put name="title" value="Tiles Showcase"/>
|
||||
<put name="header" value="/tiles/header.jsp"/>
|
||||
<put name="body" value="/tiles/body.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="showcase.freemarker" template="/tiles/layout.jsp">
|
||||
<put-attribute name="title" value="Tiles/Freemarker Showcase"/>
|
||||
<put-attribute name="header" value="/tiles/header.jsp"/>
|
||||
<put-attribute name="body" value="/tiles/body.ftl"/>
|
||||
</definition>
|
||||
|
||||
<definition name="showcase.freemarkerLayout" template="/tiles/layout.ftl">
|
||||
<put-attribute name="title" value="Tiles/Freemarker Showcase"/>
|
||||
<put-attribute name="header" value="/tiles/header.jsp"/>
|
||||
<put-attribute name="body" value="/tiles/body.ftl"/>
|
||||
<put name="title" value="Tiles/Freemarker Showcase"/>
|
||||
<put name="header" value="/tiles/header.jsp"/>
|
||||
<put name="body" value="/tiles/body.ftl"/>
|
||||
</definition>
|
||||
|
||||
</tiles-definitions>
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||
|
||||
<display-name>Struts Showcase Application</display-name>
|
||||
|
||||
<context-param>
|
||||
<param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
|
||||
<param-value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
<filter-name>struts-cleanup</filter-name>
|
||||
@@ -52,7 +57,7 @@
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.apache.struts2.tiles.StrutsTilesListener
|
||||
org.apache.tiles.listener.TilesListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
@@ -80,12 +85,6 @@
|
||||
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>JspSupportServlet</servlet-name>
|
||||
<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
|
||||
<!-- JavaServer Faces Servlet Mapping, not called directly -->
|
||||
<servlet-mapping>
|
||||
|
||||
@@ -24,7 +24,7 @@ Using a JSON list returned from an action (href="/JSONList.action"), without aut
|
||||
|
||||
Reload on type (loadOnTextChange="true"), after 3 characters (loadMinimumCout="3", it is "3" by default), without the down arrow button (showDownArrow="false")
|
||||
<br/>
|
||||
<s:autocompleter name="state" theme="ajax" indicator="indicator" href="%{jsonList}" cssStyle="width: 200px;" autoComplete="false" loadOnTextChange="true" loadMinimumCount="3" showDownArrow="false"/>
|
||||
<s:autocompleter theme="ajax" indicator="indicator" href="%{jsonList}" cssStyle="width: 200px;" autoComplete="false" loadOnTextChange="true" loadMinimumCount="3" showDownArrow="false"/>
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
|
||||
<br/>
|
||||
|
||||
@@ -15,9 +15,9 @@ Note: The Ajax tags are experimental. These examples have only been tested under
|
||||
<li><a href="remotediv">Remote div tag</a></li>
|
||||
<li><a href="remotelink">Remote link tag</a></li>
|
||||
<li><a href="tabbedpanel">Tabbed panel</a></li>
|
||||
<li><a href="widgets">Widgets </a> (may not work in all browsers!)
|
||||
<li><a href="widgets">Widgets </a> (may not work in all browsers!)
|
||||
see the <a href="http://www.dojotoolkit.org">dojo website</a> for more information</li>
|
||||
<li><a href="remoteforms">Remote forms</a></li>
|
||||
<li>(broken) <a href="remoteforms">Remote forms</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<!-- START SNIPPET: example -->
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<#list actionMessages as msg>
|
||||
${msg}
|
||||
</#list>
|
||||
|
||||
<@s.form action="guess" method="post">
|
||||
<@s.textfield label="Guess" name="guess"/>
|
||||
<@s.submit value="Guess"/>
|
||||
</@s.form>
|
||||
</body>
|
||||
</html>
|
||||
<!-- END SNIPPET: example -->
|
||||
@@ -1,6 +1,6 @@
|
||||
<%--
|
||||
<%--
|
||||
showcase.jsp
|
||||
|
||||
|
||||
@version $Date$ $Id$
|
||||
--%>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<p>
|
||||
<%-- THIS LIST IS MAINTAINED IN WEB-INF/decorators/main.jsp TO CREATE THE MENU BAR -- EDIT THERE AND COPY HERE --%>
|
||||
<ul>
|
||||
<li><a href="<s:url value="/showcase.jsp"/>">Home</a></li>
|
||||
<li><a href="<s:url value="/showcase.jsp"/>">Home</a></li>
|
||||
<li><a href="<s:url value="/ajax/index.jsp" />">Ajax Theme for Struts Tags</a></li>
|
||||
<li><a href="<s:url value="/chat/index.jsp"/>">Ajax Chat</a>
|
||||
<li><a href="<s:url action="actionChain1!input" namespace="/actionchaining" includeParams="none" />">Action Chaining</a></li>
|
||||
@@ -52,6 +52,15 @@
|
||||
<li><a href="<s:url value="/validation/index.jsp"/>">Validation</a></li>
|
||||
<li class="last"><a href="<s:url value="/help.jsp"/>">Help</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Sandbox</h2>
|
||||
<p>
|
||||
These examples are under development and may not be fully operational.
|
||||
</p>
|
||||
<ul>
|
||||
<li><a href="<s:url action="guess" namespace="/continuations" />">Continuations</a></li>
|
||||
</ul>
|
||||
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
<li>
|
||||
<a href="freemarker.action">View FreeMarker Example</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="freemarkerLayout.action">View Example with a FreeMarker Layout</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -1,12 +0,0 @@
|
||||
<#assign tiles=JspTaglibs["http://tiles.apache.org/tags-tiles"]>
|
||||
<@tiles.importAttribute name="title" scope="request"/>
|
||||
<html>
|
||||
<head><title><@tiles.getAsString name="title"/></title></head>
|
||||
<body>
|
||||
<@tiles.insertAttribute name="header"/>
|
||||
<p id="body">
|
||||
<@tiles.insertAttribute name="body"/>
|
||||
</p>
|
||||
<p>Notice that this is a layout made in FreeMarker</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
|
||||
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<%-- Show usage; Used in Header --%>
|
||||
@@ -6,12 +6,10 @@
|
||||
<html>
|
||||
<head><title><tiles:getAsString name="title"/></title></head>
|
||||
<body>
|
||||
<tiles:insertAttribute name="header"/>
|
||||
<tiles:attribute name="header"/>
|
||||
|
||||
<p id="body">
|
||||
<tiles:insertAttribute name="body"/>
|
||||
<tiles:attribute name="body"/>
|
||||
</p>
|
||||
|
||||
<p>Notice that this is a layout made in JSP</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<h1>Validation Examples</h1>
|
||||
|
||||
|
||||
<s:url id="quizBasic" namespace="/validation" action="quizBasic" method="input"/>
|
||||
<s:url id="quizClient" namespace="/validation" action="quizClient" method="input"/>
|
||||
<s:url id="quizClientCss" namespace="/validation" action="quizClientCss" method="input"/>
|
||||
@@ -24,13 +24,13 @@
|
||||
<s:url id="clientSideValidationUrl" action="clientSideValidationExample" namespace="/validation" />
|
||||
<s:url id="backToShowcase" action="showcase" namespace="/" />
|
||||
<s:url id="storeMessageAcrossRequestExample" value="/validation/storeErrorsAcrossRequestExample.jsp" />
|
||||
|
||||
|
||||
<ul>
|
||||
<li><s:a href="%{fieldValidatorUrl}">Field Validators</s:a></li>
|
||||
<li><s:a href="%{clientSideValidationUrl}">Field Validators with client-side JavaScript</s:a></li>
|
||||
<li><s:a href="%{nonFieldValidatorUrl}">Non Field Validator</s:a></li>
|
||||
<li><s:a href="%{storeMessageAcrossRequestExample}">Store across request using MessageStoreInterceptor (Example)</s:a></li>
|
||||
<li><s:a href="%{quizAjax}">Validation (ajax)</s:a></li>
|
||||
<li>(broken) <s:a href="%{quizAjax}">Validation (ajax)</s:a></li>
|
||||
<li><s:a href="%{quizBasic}">Validation (basic)</s:a></li>
|
||||
<li><s:a href="%{quizClient}">Validation (client)</s:a></li>
|
||||
<li><s:a href="%{quizClientCss}">Validation (client using css_xhtml theme)</s:a></li>
|
||||
|
||||
+24
-30
@@ -1,14 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/*
|
||||
/*
|
||||
* 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.
|
||||
@@ -33,7 +33,7 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.0.13</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
|
||||
<scm>
|
||||
@@ -100,10 +100,10 @@
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<groupId>opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<classifier>javadoc</classifier>
|
||||
<version>2.0.6</version>
|
||||
<version>2.0.0</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${project.build.directory}/xwork-apidocs</outputDirectory>
|
||||
@@ -155,13 +155,12 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<artifactId>struts2-api</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-codebehind-plugin</artifactId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -193,50 +192,38 @@
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-pell-multipart-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plexus-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-spring-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-struts1-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-tiles-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.tiles</groupId>
|
||||
<artifactId>tiles-jsp</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Include optional dependencies -->
|
||||
<dependency>
|
||||
@@ -390,7 +377,7 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-10</version>
|
||||
<version>1.0-alpha-10-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -429,7 +416,7 @@
|
||||
<version>1.2.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>myfaces</groupId>
|
||||
@@ -438,6 +425,13 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.rifers</groupId>
|
||||
<artifactId>rife-continuations</artifactId>
|
||||
<version>0.0.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Exclude transitive dependencies -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
||||
@@ -58,10 +58,10 @@
|
||||
<directory>../target/site</directory>
|
||||
<outputDirectory>docs</outputDirectory>
|
||||
</fileSet>
|
||||
<!--fileSet>
|
||||
<fileSet>
|
||||
<directory>../api/target/site</directory>
|
||||
<outputDirectory>docs/struts2-api</outputDirectory>
|
||||
</fileSet-->
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../core/target/site</directory>
|
||||
<outputDirectory>docs/struts2-core</outputDirectory>
|
||||
@@ -130,14 +130,14 @@
|
||||
<include>src/</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<!--fileSet>
|
||||
<fileSet>
|
||||
<directory>../api</directory>
|
||||
<outputDirectory>src/api</outputDirectory>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
<include>src/</include>
|
||||
</includes>
|
||||
</fileSet-->
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../apps</directory>
|
||||
<outputDirectory>src/apps</outputDirectory>
|
||||
|
||||
@@ -60,14 +60,14 @@
|
||||
<include>src/</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<!--fileSet>
|
||||
<fileSet>
|
||||
<directory>../api</directory>
|
||||
<outputDirectory>src/api</outputDirectory>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
<include>src/</include>
|
||||
</includes>
|
||||
</fileSet-->
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../apps</directory>
|
||||
<outputDirectory>src/apps</outputDirectory>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Retrotranslator: a Java bytecode transformer that translates Java classes
|
||||
compiled with JDK 5.0 into classes that can be run on JVM 1.4.
|
||||
|
||||
Copyright (c) 2005 - 2007 Taras Puchko
|
||||
Copyright (c) 2005, 2006 Taras Puchko
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
Binary file not shown.
+172
-207
@@ -64,15 +64,15 @@ and concurrency utilities
|
||||
Compile your classes with JDK 5.0 and put them into some directory, e.g. <code>myclasses</code>.
|
||||
</li>
|
||||
<li>
|
||||
Go to the unzipped directory and execute:<br>
|
||||
Go to the unzipped directory <code>Retrotranslator-<i>n.n.n</i>-bin</code> and execute:<br>
|
||||
<code>java -jar retrotranslator-transformer-<i>n.n.n</i>.jar -srcdir myclasses</code>
|
||||
</li>
|
||||
<li>
|
||||
If you use Java 5 API put <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code> and
|
||||
<code>backport-util-concurrent-<i>n.n</i>.jar</code> into the classpath of your application.
|
||||
<code>backport-util-concurrent.jar</code> into the classpath of your application.
|
||||
</li>
|
||||
<li>
|
||||
Run or debug the application as usual on J2SE 1.4.x, preferably 1.4.2.
|
||||
Run or debug the application as usual on any JVM 1.4, preferably JRE 1.4.2.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
@@ -84,74 +84,24 @@ and concurrency utilities
|
||||
<tr><th>Option</th><th>Description</th><th>Default</th></tr>
|
||||
<tr>
|
||||
<td nowrap><code>-srcdir</code></td>
|
||||
<td>The directory with classes that should be translated (may be specified several times).</td>
|
||||
<td>Directory with classes compiled using JDK 5.0 (may be specified several times).</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-srcjar</code></td>
|
||||
<td>The directory with classes that should be translated (may be specified several times).</td>
|
||||
<td>JAR file with classes compiled using JDK 5.0 (may be specified several times).</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-destdir</code></td>
|
||||
<td>The directory to place translated classes.</td>
|
||||
<td>Directory to place classes compatible with J2SE 1.4.</td>
|
||||
<td>Location of sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-destjar</code></td>
|
||||
<td>The JAR file to place translated classes.</td>
|
||||
<td>JAR file to place classes compatible with J2SE 1.4.</td>
|
||||
<td>Location of sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><a name="option_advanced"><code>-advanced</code></a></td>
|
||||
<td>Whether to use alternative implementations of Java 1.4 classes and methods for better Java 5 compatibility.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-verify</code></td>
|
||||
<td>Asks the translator to examine translated bytecode for references to classes, methods, or fields
|
||||
that cannot be found in the provided classpath.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-classpath</code></td>
|
||||
<td>The classpath for verification including <code>rt.jar</code>, <code>jce.jar</code>,
|
||||
<code>jsse.jar</code> (from JRE 1.4), <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code>,
|
||||
and <code>backport-util-concurrent-<i>n.n</i>.jar</code>.</td>
|
||||
<td>Current classpath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-srcmask</code></td>
|
||||
<td>The wildcard pattern specifying files that should be translated (either bytecode or UTF-8 text),
|
||||
e.g. "<code>*.class;*.tld</code>". There are three special characters: "<code>*?;</code>".
|
||||
</td>
|
||||
<td>*.class</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-embed</code></td>
|
||||
<td>Package name for a private copy of <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code> and
|
||||
<code>backport-util-concurrent-<i>n.n</i>.jar</code> to be put into <code>-destdir</code> or <code>-destjar</code>.
|
||||
This makes your application independent of other versions of Retrotranslator present in the classpath.
|
||||
</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><a name="option_backport"><code>-backport</code></a></td>
|
||||
<td>Informs the translator about <a href="#extension">user-defined</a> backport packages.
|
||||
Package names should be separated by semicolons.</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-target</code></td>
|
||||
<td>To make Java 6 classes compatible with Java 5 set this option to 1.5 and supply
|
||||
<a href="#extension">user-defined</a> backport packages via the <code>backport</code> option.</td>
|
||||
<td>1.4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-lazy</code></td>
|
||||
<td>Asks the translator to only transform classes compiled with a <code>target</code> greater than the current one.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-stripsign</code></td>
|
||||
<td>Asks the translator to strip signature (generics) information.</td>
|
||||
@@ -162,6 +112,42 @@ and concurrency utilities
|
||||
<td>Asks the translator for verbose output.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-lazy</code></td>
|
||||
<td>Asks the translator to transform only Java 5 classes.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><a name="option_advanced"><code>-advanced</code></a></td>
|
||||
<td>Allows to override Java 1.4 methods for better Java 5 compatibility.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-verify</code></td>
|
||||
<td>Asks the translator for warnings when references to unknown classes, methods, or fields are found.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-classpath</code></td>
|
||||
<td>The classpath to use for verification including <code>rt.jar</code>, <code>jce.jar</code>,
|
||||
<code>jsse.jar</code> (from JRE 1.4), <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code>,
|
||||
and <code>backport-util-concurrent.jar</code>.</td>
|
||||
<td>Current classpath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-srcmask</code></td>
|
||||
<td>Files to translate (either bytecode or UTF-8 text) , e.g. "<code>*.class;*.tld</code>".
|
||||
Only three special characters are supported: "<code>*?;</code>".</td>
|
||||
<td>*.class</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-embed</code></td>
|
||||
<td>Package name for a private copy of <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code> and
|
||||
<code>backport-util-concurrent.jar</code> to be put into <code>-destdir</code> or <code>-destjar</code>.
|
||||
This makes your application independent of other versions of Retrotranslator present in the classpath.
|
||||
</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-retainapi</code></td>
|
||||
<td>Asks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API.
|
||||
@@ -175,6 +161,12 @@ and concurrency utilities
|
||||
<td>Asks the translator to keep Java 5 specific access modifiers.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><a name="option_backport"><code>-backport</code></a></td>
|
||||
<td>Informs the translator about <a href="#extension">user-defined</a> backport packages.
|
||||
Package names should be separated by semicolons.</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
For example, if you have a Java 5 application <code>myapplication5.jar</code> you can use the following command
|
||||
@@ -194,81 +186,24 @@ and concurrency utilities
|
||||
<tr><th>Attribute</th><th>Description</th><th>Default</th></tr>
|
||||
<tr>
|
||||
<td><code>srcdir</code></td>
|
||||
<td>The directory with classes that should be translated.</td>
|
||||
<td>Directory with classes compiled using JDK 5.0.</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>srcjar</code></td>
|
||||
<td>The directory with classes that should be translated.</td>
|
||||
<td>JAR file with classes compiled using JDK 5.0.</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>destdir</code></td>
|
||||
<td>The directory to place translated classes.</td>
|
||||
<td>Directory to place classes compatible with J2SE 1.4.</td>
|
||||
<td>Location of sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>destjar</code></td>
|
||||
<td>The JAR file to place translated classes.</td>
|
||||
<td>JAR file to place classes compatible with J2SE 1.4.</td>
|
||||
<td>Location of sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>advanced</code></td>
|
||||
<td>Whether to use alternative implementations of Java 1.4 classes and methods for better Java 5 compatibility.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>verify</code></td>
|
||||
<td>Asks the translator to examine translated bytecode for references to classes, methods, or fields
|
||||
that cannot be found in the provided classpath.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>classpath</code></td>
|
||||
<td>The classpath for the verification, including <code>rt.jar</code>, <code>jce.jar</code>,
|
||||
<code>jsse.jar</code> (from JRE 1.4), <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code>,
|
||||
and <code>backport-util-concurrent-<i>n.n</i>.jar</code>.
|
||||
</td>
|
||||
<td>Current classpath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>classpathref</code></td>
|
||||
<td>The classpath for the verification, given as a reference to a path defined elsewhere.
|
||||
</td>
|
||||
<td>Current classpath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>srcmask</code></td>
|
||||
<td>The wildcard pattern specifying files that should be translated (either bytecode or UTF-8 text),
|
||||
e.g. "<code>*.class;*.tld</code>". There are three special characters: "<code>*?;</code>".
|
||||
</td>
|
||||
<td>*.class</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>embed</code></td>
|
||||
<td>Package name for a private copy of <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code> and
|
||||
<code>backport-util-concurrent-<i>n.n</i>.jar</code> to be put into <code>-destdir</code> or <code>-destjar</code>.
|
||||
This makes your application independent of other versions of Retrotranslator present in the classpath.
|
||||
</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>backport</code></td>
|
||||
<td>Informs the translator about <a href="#extension">user-defined</a> backport packages.
|
||||
Package names should be separated by semicolons.</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>target</code></td>
|
||||
<td>Set this option to 1.5 and supply <a href="#extension">user-defined</a> backport packages via
|
||||
the <code>backport</code> option to make Java 6 classes compatible with Java 5.</td>
|
||||
<td>1.4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>lazy</code></td>
|
||||
<td>Asks the translator to only transform classes compiled with a <code>target</code> greater than the current one.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>stripsign</code></td>
|
||||
<td>Asks the translator to strip signature (generics) information.</td>
|
||||
@@ -279,6 +214,43 @@ and concurrency utilities
|
||||
<td>Asks the translator for verbose output.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>lazy</code></td>
|
||||
<td>Asks the translator to transform only Java 5 classes.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>advanced</code></td>
|
||||
<td>Allows to override Java 1.4 methods for better Java 5 compatibility.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>verify</code></td>
|
||||
<td>Asks the translator for warnings when references to unknown classes, methods, or fields are found.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>classpath</code></td>
|
||||
<td>The classpath to use for verification including <code>rt.jar</code>, <code>jce.jar</code>,
|
||||
<code>jsse.jar</code> (from JRE 1.4), <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code>,
|
||||
and <code>backport-util-concurrent.jar</code>.
|
||||
</td>
|
||||
<td>Current classpath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>srcmask</code></td>
|
||||
<td>Files to translate (either bytecode or UTF-8 text) , e.g. "<code>*.class;*.tld</code>".
|
||||
Only three special characters are supported: "<code>*?;</code>".</td>
|
||||
<td>*.class</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>embed</code></td>
|
||||
<td>Package name for a private copy of <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code> and
|
||||
<code>backport-util-concurrent.jar</code> to be put into <code>-destdir</code> or <code>-destjar</code>.
|
||||
This makes your application independent of other versions of Retrotranslator present in the classpath.
|
||||
</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>retainapi</code></td>
|
||||
<td>Asks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API.
|
||||
@@ -292,6 +264,12 @@ and concurrency utilities
|
||||
<td>Asks the translator to keep Java 5 specific access modifiers.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>backport</code></td>
|
||||
<td>Informs the translator about <a href="#extension">user-defined</a> backport packages.
|
||||
Package names should be separated by semicolons.</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>failonwarning</code></td>
|
||||
<td>Indicates whether the build will fail when there are verification warnings.</td>
|
||||
@@ -299,8 +277,8 @@ and concurrency utilities
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
You may use nested <code>fileset</code>, <code>jarfileset</code>, and <code>dirset</code> elements to specify
|
||||
source files and <code>classpath</code> elements to specify classpath. For example:
|
||||
You may use nested <code>src</code> elements to specify source directories or JAR files, and nested
|
||||
<code>classpath</code> elements to specify classpath for verification. For example:
|
||||
</p>
|
||||
<pre>
|
||||
<path id="classpath">
|
||||
@@ -309,8 +287,7 @@ and concurrency utilities
|
||||
<taskdef name="retrotranslator" classpathref="classpath"
|
||||
classname="net.sf.retrotranslator.transformer.RetrotranslatorTask" />
|
||||
<retrotranslator destdir="build/classes14" verify="true">
|
||||
<fileset dir="build/classes15" includes="**/*.class">
|
||||
<jarfileset dir="build/lib15" includes="**/*.jar">
|
||||
<src path="build/classes15"/>
|
||||
<classpath location="${java14_home}/jre/lib/rt.jar"/>
|
||||
<classpath refid="classpath"/>
|
||||
</retrotranslator>
|
||||
@@ -322,16 +299,16 @@ and concurrency utilities
|
||||
</p>
|
||||
<h4><a name="idea">How to use Retrotranslator from IntelliJ IDEA?</a></h4>
|
||||
<p>
|
||||
There is a <a href="http://plugins.intellij.net/plugin/?id=145">plugin</a> to automatically translate and verify
|
||||
classes compiled by <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a>, so you can develop in Java 5 but
|
||||
run and debug on JRE 1.4.
|
||||
To automatically translate and verify classes compiled by <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a>
|
||||
you may <a href="http://plugins.intellij.net/plugin/?id=145">download a plugin</a>
|
||||
that generates classes compatible with 1.4 virtual machines from your Java 5 source code.
|
||||
</p>
|
||||
|
||||
<h4><a name="jit">How to use Just-in-Time Retrotranslator?</a></h4>
|
||||
|
||||
<p>
|
||||
JIT Retrotranslator is able to translate at runtime Java classes loaded with any classloader.
|
||||
It works on J2SE 1.4 from most JVM vendors like Sun, IBM, BEA, and Apple, but does nothing on J2SE 5.0.
|
||||
It works on J2SE 1.4 from Sun, IBM, BEA, and Apple, but does nothing on J2SE 5.0 and other platforms.
|
||||
However translation at runtime consumes additional memory and processing resources and it will not
|
||||
work if your classes make use of Java 5 API but were compiled with "<code>-target 1.4</code>".
|
||||
</p>
|
||||
@@ -352,25 +329,29 @@ and concurrency utilities
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
JIT Retrotranslator can accept the <code><a href="#option_advanced">advanced</a></code>
|
||||
and <code><a href="#option_backport">backport</a></code> options.
|
||||
JIT Retrotranslator can accept <code>-<a href="#option_advanced">advanced</a></code>
|
||||
and <code>-<a href="#option_backport">backport</a></code> options.
|
||||
</p>
|
||||
|
||||
<h4><a name="supported">What Java 5 classes and methods are supported?</a></h4>
|
||||
<table border="1" cellspacing="0" cellpadding="5">
|
||||
<tr><th>Package</th><th>Class</th><th>Methods and fields</th><th>Compatibility notes</th></tr>
|
||||
<tr><td><code>java.lang.annotation</code></td><td>* (all classes)</td><td>* (all methods)</td><td> </td></tr>
|
||||
<tr><td><code>java.lang.instrument</code></td><td>* (all classes)</td><td>* (all methods)</td><td>
|
||||
Bytecode instrumentation is not implemented.</td></tr>
|
||||
<tr><td><code>java.util.concurrent,<br>java.util.concurrent.atomic,<br>java.util.concurrent.locks</code></td>
|
||||
<td>almost all classes<sup><a href="#1">1</a></sup></td><td>almost all methods</td>
|
||||
<td>The <code>LockSupport</code> class may be unusable due to poor efficiency.
|
||||
The <code>Condition.awaitNanos(long)</code> method has
|
||||
<td>almost all classes</td><td>almost all methods</td>
|
||||
<td>
|
||||
Supported via the <a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php">
|
||||
Backport of JSR 166</a>.<br>
|
||||
The <code>Condition.awaitNanos(long)</code> method is supported with
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/doc/api/edu/emory/mathcs/backport/java/util/concurrent/helpers/Utils.html#awaitNanos(edu.emory.mathcs.backport.java.util.concurrent.locks.Condition, long)">
|
||||
little</a> accuracy guarantees.</td></tr>
|
||||
<tr><td rowspan="6"><code>java.io</code></td><td><code>Closeable<sup><a href="#2">2</a></sup></code>
|
||||
</td><td><code>*</code></td><td> </td></tr>
|
||||
<tr><td><code>Flushable<sup><a href="#2">2</a></sup></code></td><td><code>*</code></td><td> </td></tr>
|
||||
very little</a> accuracy guarantees.
|
||||
</td></tr>
|
||||
<tr><td rowspan="6"><code>java.io</code></td><td><code>Closeable</code></td><td><code>*</code></td><td>
|
||||
<code>new Closeable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Flushable</code></td><td><code>*</code></td><td>
|
||||
<code>new Flushable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>PrintStream</code></td><td>
|
||||
* (11 new methods and constructors)
|
||||
</td><td> </td></tr>
|
||||
@@ -385,16 +366,17 @@ and concurrency utilities
|
||||
append(CharSequence, int, int),<br>
|
||||
append(char)</code>
|
||||
</td><td> </td></tr>
|
||||
<tr><td rowspan="26"><code>java.lang</code></td><td><code>Appendable<sup><a href="#2">2</a></sup></code></td><td>*
|
||||
</td><td> </td></tr>
|
||||
<tr><td rowspan="24"><code>java.lang</code></td><td><code>Appendable</code></td><td>*
|
||||
</td><td>
|
||||
<code>new Appendable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Boolean</code></td><td><code>parseBoolean(String),<br>
|
||||
compareTo(Boolean)</code></td><td> </td></tr>
|
||||
<tr><td><code>Byte</code></td><td><code>valueOf(byte)</code></td><td> </td></tr>
|
||||
<tr><td><code>Character</code></td><td><code>valueOf(char)</code></td><td> </td></tr>
|
||||
<tr><td><code>Class</code></td><td>* (21 new methods)</td><td>
|
||||
<code>Class.getMethod(String, Class...)</code> and <code>Class.getDeclaredMethod(String, Class...)</code>
|
||||
are intercepted to better support generics and covariant return types
|
||||
on several platforms<sup><a href="#3">3</a></sup>.
|
||||
<code>Class.getMethod(String, Class...)</code> and <code>Class.getDeclaredMethod(String, Class...)</code> are
|
||||
intercepted in advanced mode to better support generics and covariant return types on several JVM implementations.
|
||||
</td></tr>
|
||||
<tr><td><code>Deprecated</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Double</code></td><td><code>valueOf(double)</code></td><td> </td></tr>
|
||||
@@ -405,17 +387,20 @@ and concurrency utilities
|
||||
<tr><td><code>IllegalStateException</code></td><td><code>IllegalStateException(String, Throwable),<br>
|
||||
IllegalStateException(Throwable)</code></td><td> </td></tr>
|
||||
<tr><td><code>Integer</code></td><td><code>valueOf(int), signum(int)</code></td><td> </td></tr>
|
||||
<tr><td><code>Iterable<sup><a href="#2">2</a></sup></code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Iterable</code></td><td>*</td><td>
|
||||
<code>new Iterable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Long</code></td><td><code>valueOf(long), signum(long)</code></td><td> </td></tr>
|
||||
<tr><td><code>Package</code></td><td>* (4 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>Readable<sup><a href="#2">2</a></sup></code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Readable</code></td><td>*</td><td>
|
||||
<code>new Readable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Short</code></td><td><code>valueOf(short)</code></td><td> </td></tr>
|
||||
<tr><td><code>String</code></td><td><code>contains(CharSequence),<br>
|
||||
contentEquals(CharSequence),<br>
|
||||
format(Locale, String, Object...),<br>
|
||||
format(String, Object...),<br>
|
||||
replace(CharSequence, CharSequence),<br>
|
||||
isEmpty()<sup><a href="#4">4</a></sup>
|
||||
replace(CharSequence, CharSequence)
|
||||
</code></td><td> </td></tr>
|
||||
<tr><td><code>StringBuffer</code></td><td><code>
|
||||
StringBuffer(CharSequence),<br>
|
||||
@@ -426,10 +411,12 @@ and concurrency utilities
|
||||
</code></td><td> </td></tr>
|
||||
<tr><td><code>StringBuilder</code></td><td>
|
||||
All methods supported in <code>StringBuffer</code>
|
||||
</td><td><code>StringBuilder</code> is replaced with <code>StringBuffer</code>.</td></tr>
|
||||
</td><td><code>StringBuilder</code> is replaced with <code>StringBuffer</code></td></tr>
|
||||
<tr><td><code>SuppressWarnings</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>System</code></td><td><code>nanoTime()<sup><a href="#1">1</a></sup>,<br> clearProperty(String)</code></td><td>
|
||||
The <code>System.nanoTime()</code> method precision
|
||||
<tr><td><code>System</code></td><td><code>nanoTime(),<br> clearProperty(String)</code></td><td>
|
||||
The <code>System.nanoTime()</code> method is supported via the
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php">Backport of JSR 166</a>
|
||||
and its precision
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/doc/api/edu/emory/mathcs/backport/java/util/concurrent/helpers/Utils.html#nanoTime()">
|
||||
may vary</a> on different platforms.
|
||||
</td></tr>
|
||||
@@ -437,35 +424,26 @@ and concurrency utilities
|
||||
</code></td><td>The <code>Thread.getStackTrace()</code>
|
||||
method returns non-empty stack trace only for the current thread.<br>
|
||||
The <code>Thread.getId()</code> method does not reflect the order in which threads are created.</td></tr>
|
||||
<tr><td><code>Thread.State</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>ThreadLocal</code></td><td><code>remove()<sup><a href="#3">3</a></sup></code></td>
|
||||
<td><code>ThreadLocal</code> and <code>InheritableThreadLocal</code>
|
||||
are replaced by corresponding classes from the runtime library.<sup><a href="#3">3</a></sup>.</td></tr>
|
||||
<tr><td><code>TypeNotPresentException</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td rowspan="2"><code>java.lang.ref</code></td>
|
||||
<td><code>SoftReference</code></td><td>*</td><td>
|
||||
<code>SoftReference(Object,ReferenceQueue)</code>
|
||||
supports <code>null</code> for the second parameter
|
||||
on all platforms<sup><a href="#3">3</a></sup>.
|
||||
</td></tr>
|
||||
<tr><td><code>WeakReference</code></td><td>*</td><td>
|
||||
<code>WeakReference(Object,ReferenceQueue)</code>
|
||||
supports <code>null</code> for the second parameter
|
||||
on all platforms<sup><a href="#3">3</a></sup>.
|
||||
</td></tr>
|
||||
|
||||
<tr><td rowspan="13"><code>java.lang.reflect</code></td>
|
||||
<td><code>AccessibleObject</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>AnnotatedElement<sup><a href="#2">2</a></sup></code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>AnnotatedElement</code></td><td>*</td><td>
|
||||
<code>new AnnotatedElement[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Constructor</code></td><td>* (11 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>Field</code></td><td>* (8 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>GenericArrayType</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>GenericDeclaration<sup><a href="#2">2</a></sup></code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>GenericDeclaration</code></td><td>*</td><td>
|
||||
<code>new GenericDeclaration[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>GenericSignatureFormatError</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>MalformedParameterizedTypeException</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Method</code></td><td>* (14 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>ParameterizedType</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Type<sup><a href="#2">2</a></sup></code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Type</code></td><td>*</td><td>
|
||||
<code>new Type[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>TypeVariable</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>WildcardType</code></td><td>*</td><td> </td></tr>
|
||||
|
||||
@@ -474,57 +452,48 @@ and concurrency utilities
|
||||
divideToIntegralValue(BigDecimal),<br> pow(int),<br> remainder(BigDecimal),<br>
|
||||
toPlainString(),<br> valueOf(double),<br>
|
||||
valueOf(long)</code></td><td>The <code>BigDecimal.setScale(int, int)</code>
|
||||
method supports negative scales<sup><a href="#3">3</a></sup>.</td></tr>
|
||||
|
||||
<tr><td rowspan="3"><code>java.net</code></td><td><code>URL</code></td>
|
||||
<td><code>openConnection(Proxy)</code>,<br>
|
||||
<code>toURI()</code>
|
||||
</td><td>The <code>Proxy</code> is ignored by the <code>openConnection(Proxy)</code> method.</td></tr>
|
||||
<tr><td><code>Proxy</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>ProxySelector</code></td><td>*</td><td> </td></tr>
|
||||
|
||||
method supports negative scales in advanced mode.</td></tr>
|
||||
<tr><td ><code>java.rmi.server</code></td><td><code>RemoteObjectInvocationHandler</code></td>
|
||||
<td>*</td><td> </td></tr>
|
||||
|
||||
<tr><td ><code>java.text</code></td><td><code>DecimalFormat</code></td>
|
||||
<td><code>isParseBigDecimal()<sup><a href="#3">3</a></sup>,<br>
|
||||
setParseBigDecimal(boolean)<sup><a href="#3">3</a></sup></code></td><td>
|
||||
<code>BigDecimal</code> parsing and formatting precision is limited by
|
||||
<code>java.lang.Double</code> or <code>java.lang.Long</code> precision.
|
||||
</td></tr>
|
||||
<tr><td ><code>java.net</code></td><td><code>URL</code></td>
|
||||
<td><code>toURI()</code></td><td> </td></tr>
|
||||
|
||||
<tr><td><code>java.util.nio</code></td><td><code>CharBuffer</code></td><td>
|
||||
<code>append(CharSequence),<br> append(CharSequence, int, int),<br> append(char),<br> read(CharBuffer)</code>
|
||||
</td><td> </td></tr>
|
||||
|
||||
<tr><td rowspan="10"><code>java.util</code></td><td><code>AbstractQueue<sup><a href="#1">1</a></sup></code></td>
|
||||
<td>*</td><td> </td></tr>
|
||||
<tr><td rowspan="10"><code>java.util</code></td><td><code>AbstractQueue</code></td><td>*</td><td>
|
||||
Supported via the <a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php">
|
||||
Backport of JSR 166</a>.
|
||||
</td></tr>
|
||||
<tr><td><code>Arrays</code></td><td>* (21 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>Collections<sup><a href="#1">1</a></sup></code></td><td>* (13 new methods)<br>
|
||||
newSetFromMap(Map)<sup><a href="#4">4</a></sup>
|
||||
|
||||
</td><td> </td></tr>
|
||||
<tr><td><code>Collections</code></td><td>* (13 new methods)</td><td>
|
||||
Supported via the <a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php">
|
||||
Backport of JSR 166</a>.
|
||||
</td></tr>
|
||||
<tr><td><code>EnumMap</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>EnumSet</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Formatter</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>LinkedList</code></td><td>* (5 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>PriorityQueue<sup><a href="#1">1</a></sup></code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Queue<sup><a href="#1">1</a>,<a href="#2">2</a></sup></code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>PriorityQueue</code></td><td>*</td><td>
|
||||
Supported via the <a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php">
|
||||
Backport of JSR 166</a>.
|
||||
</td></tr>
|
||||
<tr><td><code>Queue</code></td><td>*</td><td>
|
||||
Supported via the <a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php">
|
||||
Backport of JSR 166</a>.<br>
|
||||
<code>new Queue[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>UUID</code></td><td>*</td><td> </td></tr>
|
||||
|
||||
<tr><td rowspan="3"><code>java.util.regex</code></td><td><code>Matcher</code></td><td>
|
||||
<code>quoteReplacement(String),<br> toMatchResult()</code></td><td> </td></tr>
|
||||
<tr><td><code>MatchResult<sup><a href="#2">2</a></sup></code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>MatchResult</code></td><td>*</td><td>
|
||||
<code>new MatchResult[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Pattern</code></td><td><code>quote(String)</code></td><td> </td></tr>
|
||||
</table>
|
||||
<p>
|
||||
<a name="1"><sup>1</sup></a> Supported via the
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php"> Backport of JSR 166</a>.<br>
|
||||
<a name="2"><sup>2</sup></a> In most cases this type is being replaced with it's base type.<br>
|
||||
<a name="3"><sup>3</sup></a> Supported only in advanced mode, i.e. when
|
||||
the <code><a href="#option_advanced">advanced</a></code> option is specified.<br>
|
||||
<a name="4"><sup>4</sup></a> Introduced in Java 6, but available only for 1.4 target.<br>
|
||||
</p>
|
||||
|
||||
<h4><a name="extension">How to write an extension for Retrotranslator?</a></h4>
|
||||
|
||||
@@ -535,7 +504,7 @@ and concurrency utilities
|
||||
<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/EnumSet.html"><code>java.util.EnumSet</code></a>
|
||||
are replaced with references to
|
||||
<a href="http://retrotranslator.cvs.sourceforge.net/retrotranslator/Retrotranslator/src/net/sf/retrotranslator/runtime/java/util/EnumSet_.java?view=markup">
|
||||
<code>net.sf.retrotranslator.runtime.java.util.EnumSet<b>_</b></code></a> (optional trailing underscore) if the latter can be found.
|
||||
<code>net.sf.retrotranslator.runtime.java.util.EnumSet<b>_</b></code></a> (trailing underscore) if the latter can be found.
|
||||
But if you replace a whole class that exists in J2SE 1.4 you may encounter interoperability issues with other libraries.
|
||||
So, for example, support for Java 5 fields, methods, and constructors of
|
||||
<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html"><code>java.math.BigDecimal</code></a> is placed into
|
||||
@@ -571,12 +540,8 @@ and concurrency utilities
|
||||
</p>
|
||||
<p>
|
||||
You can put your extensions into packages other than <code>net.sf.retrotranslator.runtime</code>.
|
||||
For example, specify the following at the command line to make Retrotranslator use
|
||||
<code>com.mycompany.internal.java.lang._String</code> and to rewrite all references to
|
||||
<code>com.sun.org.apache.xerces.internal.*</code> with <code>org.apache.xerces.*</code>:<br>
|
||||
<code>-backport com.mycompany.internal;com.sun.org.apache.xerces.internal:org.apache.xerces</code>
|
||||
</p>
|
||||
<p>
|
||||
For example, to make Retrotranslator use <code>com.mycompany.internal.java.lang._String</code>
|
||||
just specify <code>-backport com.mycompany.internal</code> at the command line.
|
||||
If you have written an extension that does not contain copyrighted code, you may send
|
||||
a <a href="http://sourceforge.net/tracker/?group_id=153566&atid=788281">patch</a>
|
||||
under the <a href="#license">Retrotranslator license</a>.
|
||||
@@ -625,7 +590,7 @@ and concurrency utilities
|
||||
Retrotranslator: a Java bytecode transformer that translates Java classes
|
||||
compiled with JDK 5.0 into classes that can be run on JVM 1.4.
|
||||
|
||||
Copyright (c) 2005 - 2007 Taras Puchko
|
||||
Copyright (c) 2005, 2006 Taras Puchko
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,4 @@
|
||||
java -jar retrotranslator-transformer-1.2.2.jar -advanced -srcjar ../lib/struts2-core-2.0.13.jar -destjar struts2-core-j4-2.0.13.jar
|
||||
java -jar retrotranslator-transformer-1.2.2.jar -advanced -srcjar ../lib/xwork-2.0.6.jar -destjar xwork-j4-2.0.6.jar
|
||||
java -jar retrotranslator-transformer-1.1.0.jar -srcjar ../lib/struts2-core-2.0.3.jar -destjar struts2-core-j4-2.0.3.jar
|
||||
java -jar retrotranslator-transformer-1.1.0.jar -srcjar ../lib/struts2-api-2.0.3.jar -destjar struts2-api-j4-2.0.3.jar
|
||||
java -jar retrotranslator-transformer-1.1.0.jar -srcjar ../lib/struts2-extras-2.0.3.jar -destjar struts2-extras-j4-2.0.3.jar
|
||||
java -jar retrotranslator-transformer-1.1.0.jar -srcjar ../lib/xwork-2.0.0.jar -destjar xwork-j4-2.0.0-RC1.jar
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
java -jar retrotranslator-transformer-1.2.2.jar -advanced -srcjar ../lib/struts2-core-2.0.13.jar -destjar struts2-core-j4-2.0.13.jar
|
||||
java -jar retrotranslator-transformer-1.2.2.jar -advanced -srcjar ../lib/xwork-2.0.6.jar -destjar xwork-j4-2.0.6.jar
|
||||
+92
-132
@@ -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-parent</artifactId>
|
||||
<version>2.0.13</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
@@ -41,9 +20,9 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.0-alpha-4</version>
|
||||
<version>2.0-alpha-1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack-xwork</id>
|
||||
@@ -52,25 +31,25 @@
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.0.6</version>
|
||||
<classifier>sources</classifier>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${project.build.directory}/xwork-sources</outputDirectory>
|
||||
</configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<classifier>sources</classifier>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${project.build.directory}/xwork-sources</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.myfaces.tobago</groupId>
|
||||
<artifactId>maven-apt-plugin</artifactId>
|
||||
<configuration>
|
||||
<A>uri=/struts-tags,tlibVersion=2.2.3,jspVersion=1.2,shortName=s,displayName="Struts Tags",
|
||||
outFile=${basedir}/target/classes/META-INF/struts-tags.tld,
|
||||
outFile=${basedir}/src/main/resources/META-INF/struts-tags.tld,
|
||||
description="To make it easier to access dynamic data;
|
||||
the Apache Struts framework includes a library of custom tags.
|
||||
The tags interact with the framework's validation and internationalization features;
|
||||
@@ -96,14 +75,14 @@
|
||||
<goal>execute</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
@@ -128,93 +107,72 @@
|
||||
</links>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<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/test/resources/org/apache/struts2/views/jsp/ui/*</exclude>
|
||||
<exclude>src/main/etc/**</exclude>
|
||||
<exclude>src/main/resources/org/apache/struts2/static/dojo/src/**</exclude>
|
||||
<exclude>src/main/resources/org/apache/struts2/static/dojo/*</exclude>
|
||||
<exclude>src/main/resources/org/apache/struts2/static/niftycorners/**</exclude>
|
||||
<exclude>src/test/resources/org/apache/struts2/interceptor/validation/*</exclude>
|
||||
<exclude>src/site/resources/tags/**</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<!--
|
||||
Run the translator for Java 1.4 compatiblity
|
||||
<profile>
|
||||
<!--
|
||||
Run the translator for Java 1.4 compatiblity
|
||||
|
||||
Samples:
|
||||
$ cd struts/struts2/
|
||||
$ mvn clean install -Papps,j4 -Djava14.jar=$JAVA_HOME/../Classes/classes.jar
|
||||
$ mvn clean install -Papps,j4 -Djava14.jar="$JAVA_HOME/jre/lib/rt.jar"
|
||||
Sample:
|
||||
$ cd struts/struts2/
|
||||
$ mvn clean install -Papps,j4 -Djava14.jar=$JAVA_HOME/../Classes/classes.jar
|
||||
|
||||
-->
|
||||
<id>j4</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>retrotranslator-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>retrotranslate</id>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-j4-jar</id>
|
||||
<goals><goal>jar</goal></goals>
|
||||
<configuration>
|
||||
<classesDirectory>${project.build.directory}/classes-retro</classesDirectory>
|
||||
<classifier>j4</classifier>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Extension-Name>${project.artifactId}-j4</Extension-Name>
|
||||
<Specification-Vendor>${project.organization.name}</Specification-Vendor>
|
||||
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
|
||||
<Implementation-Title>${project.description}</Implementation-Title>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
<Revision>${scm.revision}</Revision>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>sun.jdk</groupId>
|
||||
<artifactId>rt</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<scope>system</scope>
|
||||
<!-- path to rt.jar (on OSX, it's classes.jar) -->
|
||||
<systemPath>${java14.jar}</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.retrotranslator</groupId>
|
||||
<artifactId>retrotranslator-runtime</artifactId>
|
||||
<version>1.0.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
-->
|
||||
<id>j4</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>retrotranslator-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>retrotranslate</id>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-j4-jar</id>
|
||||
<goals><goal>jar</goal></goals>
|
||||
<configuration>
|
||||
<classesDirectory>${project.build.directory}/classes-retro</classesDirectory>
|
||||
<classifier>j4</classifier>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Extension-Name>${project.artifactId}-j4</Extension-Name>
|
||||
<Specification-Vendor>${project.organization.name}</Specification-Vendor>
|
||||
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
|
||||
<Implementation-Title>${project.description}</Implementation-Title>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
<Revision>${scm.revision}</Revision>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>sun.jdk</groupId>
|
||||
<artifactId>rt</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<scope>system</scope>
|
||||
<!-- path to rt.jar (on OSX, it's classes.jar) -->
|
||||
<systemPath>${java14.jar}</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.retrotranslator</groupId>
|
||||
<artifactId>retrotranslator-runtime</artifactId>
|
||||
<version>1.0.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>alljars</id>
|
||||
@@ -292,15 +250,21 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<groupId>opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.0.6</version>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-api</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.8</version>
|
||||
<version>2.3.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -318,9 +282,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>opensymphony</groupId>
|
||||
<groupId>ognl</groupId>
|
||||
<artifactId>ognl</artifactId>
|
||||
<version>2.6.11</version>
|
||||
<version>2.6.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -497,16 +461,12 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- struts-annotations must be in compile scope for maven-apt-plugin to
|
||||
function correctly. Marking it optional to exclude it from transitive
|
||||
dependency resolution -->
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts-annotations</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<optional>true</optional>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -76,9 +76,6 @@ public final class StrutsConstants {
|
||||
/** The org.apache.struts2.views.freemarker.FreemarkerManager implementation class */
|
||||
public static final String STRUTS_FREEMARKER_MANAGER_CLASSNAME = "struts.freemarker.manager.classname";
|
||||
|
||||
/** Cache Freemarker templates */
|
||||
public static final String STRUTS_FREEMARKER_TEMPLATES_CACHE = "struts.freemarker.templatesCache";
|
||||
|
||||
/** org.apache.struts2.views.velocity.VelocityManager implementation class */
|
||||
public static final String STRUTS_VELOCITY_MANAGER_CLASSNAME = "struts.velocity.manager.classname";
|
||||
|
||||
@@ -148,13 +145,4 @@ public final class StrutsConstants {
|
||||
|
||||
/** The name of the xwork converter implementation */
|
||||
public static final String STRUTS_XWORKCONVERTER = "struts.xworkConverter";
|
||||
|
||||
public static final String STRUTS_ALWAYS_SELECT_FULL_NAMESPACE = "struts.mapper.alwaysSelectFullNamespace";
|
||||
|
||||
/** XWork default text provider */
|
||||
public static final String STRUTS_XWORKTEXTPROVIDER = "struts.xworkTextProvider";
|
||||
|
||||
/** The name of the parameter to create when mapping an id (used by some action mappers) */
|
||||
public static final String STRUTS_ID_PARAMETER_NAME = "struts.mapper.idParameterName";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: StrutsTestCase.java 476696 2006-11-19 03:56:18Z tmjee $
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -49,7 +49,6 @@ public abstract class AbstractRemoteCallUIBean extends ClosingUIBean implements
|
||||
protected String notifyTopics;
|
||||
protected String showErrorTransportText;
|
||||
protected String indicator;
|
||||
protected String showLoadingText;
|
||||
|
||||
public AbstractRemoteCallUIBean(ValueStack stack, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
@@ -60,7 +59,7 @@ public abstract class AbstractRemoteCallUIBean extends ClosingUIBean implements
|
||||
super.evaluateExtraParams();
|
||||
|
||||
if (href != null)
|
||||
addParameter("href", ensureAttributeSafelyNotEscaped(findString(href)));
|
||||
addParameter("href", findString(href));
|
||||
if (errorText != null)
|
||||
addParameter("errorText", findString(errorText));
|
||||
if (loadingText != null)
|
||||
@@ -87,8 +86,6 @@ public abstract class AbstractRemoteCallUIBean extends ClosingUIBean implements
|
||||
addParameter("showErrorTransportText", findValue(showErrorTransportText, Boolean.class));
|
||||
else
|
||||
addParameter("showErrorTransportText", true);
|
||||
if (showLoadingText != null)
|
||||
addParameter("showLoadingText", findString(showLoadingText));
|
||||
}
|
||||
|
||||
|
||||
@@ -168,8 +165,4 @@ public abstract class AbstractRemoteCallUIBean extends ClosingUIBean implements
|
||||
this.indicator = indicator;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Show loading text on targets", type="Boolean", defaultValue="true")
|
||||
public void setShowLoadingText(String showLoadingText) {
|
||||
this.showLoadingText = showLoadingText;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <!-- START SNIPPET: example -->
|
||||
*
|
||||
* <s:actionerror />
|
||||
* <s:form .... >
|
||||
* <s:form .... >>
|
||||
* ....
|
||||
* </s:form>
|
||||
*
|
||||
|
||||
@@ -71,7 +71,6 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* 'listenTopics' comma separated list of topics names, that will trigger a request
|
||||
* 'indicator' element to be shown while the request executing
|
||||
* 'showErrorTransportText': whether errors should be displayed (on 'targets')</p>
|
||||
* 'showLoadingText' show loading text on targets</p>
|
||||
* 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:<p/>
|
||||
* <ul>
|
||||
* <li>data: html or json object when type='load' or type='error'</li>
|
||||
|
||||
@@ -29,10 +29,18 @@ import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* <p>The autocomplete tag is a combobox that can autocomplete text entered on the input box.
|
||||
* When used on the "simple" theme, the autocompleter can be used like the ComboBox.
|
||||
* When used on the "ajax" theme, the list can be retieved from an action. </p>
|
||||
* When used on the "ajax" theme, the list can be retieved from an action. This action must
|
||||
* return a JSON list in the format:</p>
|
||||
* <pre>
|
||||
* [
|
||||
* ["Text 1","Value1"],
|
||||
* ["Text 2","Value2"],
|
||||
* ["Text 3","Value3"]
|
||||
* ]
|
||||
* </pre>
|
||||
* <!-- START SNIPPET: ajaxJavadoc -->
|
||||
* <B>THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED</B>
|
||||
* <ul>
|
||||
* <li>href</li>
|
||||
@@ -62,27 +70,15 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* 'showErrorTransportText': whether errors should be displayed (on 'targets')<p/>
|
||||
* 'loadOnTextChange' options will be reloaded everytime a character is typed on the textbox<p/>
|
||||
* 'loadMinimumCount' minimum number of characters that will force the content to be loaded<p/>
|
||||
* 'showDownError' show or hide the down arrow button<p/>
|
||||
* 'showDownError' show or hide the down arrow button
|
||||
* 'searchType' how the search must be performed, options are: "startstring", "startword" and "substring"<p/>
|
||||
* 'keyName' name of the field to which the selected key will be assigned<p/>
|
||||
* 'iconPath' path of icon used for the dropdown<p/>
|
||||
* 'templateCssPath' path to css file used to customize Dojo's widget<p/>
|
||||
* 'dataFieldName' name of the field to be used as the list in the returned JSON string<p/>
|
||||
* 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:<p/>
|
||||
* <ul>
|
||||
* <li>data: selected value when type='valuechanged'</li>
|
||||
* <li>type: 'before' before the request is made, 'valuechanged' when selection changes, 'load' when the request succeeds, or 'error' when it fails</li>
|
||||
* <li>request: request javascript object, when type='load' or type='error'</li>
|
||||
* <ul>
|
||||
*<!-- END SNIPPET: javadoc -->
|
||||
*<!-- START SNIPPET: example -->
|
||||
*<p>Autocompleter that gets its list from an action:</p>
|
||||
*<s:autocompleter name="test" href="%{jsonList}" autoComplete="false"/>
|
||||
*<br/>
|
||||
**<p>Autocompleter that uses a list:</p>
|
||||
*<s:autocompleter name="test" list="{'apple','banana','grape','pear'}" autoComplete="false"/>
|
||||
*<br/>
|
||||
*<!-- END SNIPPET: example -->
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="autocompleter", tldTagClass="org.apache.struts2.views.jsp.ui.AutocompleterTag", description="Renders a combobox with autocomplete and AJAX capabilities")
|
||||
public class Autocompleter extends ComboBox {
|
||||
@@ -105,12 +101,7 @@ public class Autocompleter extends ComboBox {
|
||||
protected String loadOnTextChange;
|
||||
protected String loadMinimumCount;
|
||||
protected String showDownArrow;
|
||||
protected String templateCssPath;
|
||||
protected String iconPath;
|
||||
protected String keyName;
|
||||
protected String dataFieldName;
|
||||
protected String resultsLimit;
|
||||
|
||||
|
||||
public Autocompleter(ValueStack stack, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -168,23 +159,11 @@ public class Autocompleter extends ComboBox {
|
||||
addParameter("showDownArrow", findValue(showDownArrow, Boolean.class));
|
||||
else
|
||||
addParameter("showDownArrow", Boolean.TRUE);
|
||||
if(templateCssPath != null)
|
||||
addParameter("templateCssPath", findString(templateCssPath));
|
||||
if(iconPath != null)
|
||||
addParameter("iconPath", findString(iconPath));
|
||||
if(dataFieldName != null)
|
||||
addParameter("dataFieldName", findString(dataFieldName));
|
||||
if(keyName != null)
|
||||
addParameter("keyName", findString(keyName));
|
||||
else {
|
||||
keyName = name + "Key";
|
||||
addParameter("keyName", findString(keyName));
|
||||
//get the key value
|
||||
if(name != null) {
|
||||
String keyNameExpr = "%{" + name + "Key}";
|
||||
addParameter("key", findString(keyNameExpr));
|
||||
}
|
||||
|
||||
String keyNameExpr = "%{" + keyName + "}";
|
||||
addParameter("key", findString(keyNameExpr));
|
||||
if(resultsLimit != null)
|
||||
addParameter("searchLimit", findString(resultsLimit));
|
||||
}
|
||||
|
||||
protected Object findListValue() {
|
||||
@@ -277,29 +256,4 @@ public class Autocompleter extends ComboBox {
|
||||
public void setList(String list) {
|
||||
super.setList(list);
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Template css path")
|
||||
public void setTemplateCssPath(String templateCssPath) {
|
||||
this.templateCssPath = templateCssPath;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Path to icon used for the dropdown")
|
||||
public void setIconPath(String iconPath) {
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Name of the field to which the selected key will be assigned")
|
||||
public void setKeyName(String keyName) {
|
||||
this.keyName = keyName;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Name of the field in the returned JSON object that contains the data array", defaultValue="Value specified in 'name'")
|
||||
public void setDataFieldName(String dataFieldName) {
|
||||
this.dataFieldName = dataFieldName;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Limit how many results are shown as autocompletion options", defaultValue="30")
|
||||
public void setResultsLimit(String resultsLimit) {
|
||||
this.resultsLimit = resultsLimit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ package org.apache.struts2.components;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -65,12 +65,12 @@ public class Component {
|
||||
*/
|
||||
public Component(ValueStack stack) {
|
||||
this.stack = stack;
|
||||
this.parameters = new LinkedHashMap();
|
||||
this.parameters = new HashMap();
|
||||
getComponentStack().push(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this component.
|
||||
* Get's the name of this component.
|
||||
* @return the name of this component.
|
||||
*/
|
||||
private String getComponentName() {
|
||||
@@ -87,7 +87,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the OGNL value stack assoicated with this component.
|
||||
* Get's the OGNL value stack assoicated with this component.
|
||||
* @return the OGNL value stack assoicated with this component.
|
||||
*/
|
||||
public ValueStack getStack() {
|
||||
@@ -95,7 +95,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the component stack of this component.
|
||||
* Get's the component stack of this component.
|
||||
* @return the component stack of this component, never <tt>null</tt>.
|
||||
*/
|
||||
public Stack getComponentStack() {
|
||||
@@ -215,7 +215,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>RuntimeException</code> based on the given information.
|
||||
* Constructs?a <code>RuntimeException</code> based on the given information.
|
||||
* <p/>
|
||||
* A message is constructed and logged at ERROR level before being returned
|
||||
* as a <code>RuntimeException</code>.
|
||||
@@ -323,26 +323,6 @@ public class Component {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an action URL by consulting the {@link org.apache.struts2.dispatcher.mapper.ActionMapper}.
|
||||
* @param action the action
|
||||
* @param namespace the namespace
|
||||
* @param method the method
|
||||
* @param req HTTP request
|
||||
* @param res HTTP response
|
||||
* @param parameters parameters
|
||||
* @param scheme http or https
|
||||
* @param includeContext should the context path be included or not
|
||||
* @param encodeResult should the url be encoded
|
||||
* @return the action url.
|
||||
*/
|
||||
@Deprecated
|
||||
protected String determineActionURL(String action, String namespace, String method,
|
||||
HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme,
|
||||
boolean includeContext, boolean encodeResult) {
|
||||
return determineActionURL(action, namespace, method, req, res, parameters, scheme, includeContext, encodeResult, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an action URL by consulting the {@link org.apache.struts2.dispatcher.mapper.ActionMapper}.
|
||||
* @param action the action
|
||||
@@ -354,20 +334,16 @@ public class Component {
|
||||
* @param scheme http or https
|
||||
* @param includeContext should the context path be included or not
|
||||
* @param encodeResult should the url be encoded
|
||||
* @param forceAddSchemeHostAndPort should the scheme host and port be added to the url no matter what
|
||||
* @param escapeAmp should the ampersands used separate parameters be escaped or not
|
||||
* @return the action url.
|
||||
*/
|
||||
protected String determineActionURL(String action, String namespace, String method,
|
||||
HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme,
|
||||
boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort,
|
||||
boolean escapeAmp) {
|
||||
boolean includeContext, boolean encodeResult) {
|
||||
String finalAction = findString(action);
|
||||
String finalMethod = method != null ? findString(method) : method;
|
||||
String finalNamespace = determineNamespace(namespace, getStack(), req);
|
||||
ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, finalMethod, parameters);
|
||||
ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, method, parameters);
|
||||
String uri = actionMapper.getUriFromActionMapping(mapping);
|
||||
return UrlHelper.buildUrl(uri, req, res, parameters, scheme, includeContext, encodeResult, forceAddSchemeHostAndPort, escapeAmp);
|
||||
return UrlHelper.buildUrl(uri, req, res, parameters, scheme, includeContext, encodeResult);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,7 +407,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parameters.
|
||||
* Get's the parameters.
|
||||
* @return the parameters. Is never <tt>null</tt>.
|
||||
*/
|
||||
public Map getParameters() {
|
||||
@@ -439,7 +415,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all the given parameters to this component's own parameters.
|
||||
* Add's all the given parameters to this componenets own parameters.
|
||||
* @param params the parameters to add.
|
||||
*/
|
||||
public void addAllParameters(Map params) {
|
||||
@@ -447,9 +423,9 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given key and value to this component's own parameter.
|
||||
* Add's the given key and value to this components own parameter.
|
||||
* <p/>
|
||||
* If the provided key is <tt>null</tt> nothing happens.
|
||||
* If the provided key is <tt>null</tt> nothing happends.
|
||||
* If the provided value is <tt>null</tt> any existing parameter with
|
||||
* the given key name is removed.
|
||||
* @param key the key of the new parameter to add.
|
||||
@@ -468,7 +444,7 @@ public class Component {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id for referencing element.
|
||||
* Get's the id for referencing element.
|
||||
* @return the id for referencing element.
|
||||
*/
|
||||
public String getId() {
|
||||
@@ -489,4 +465,5 @@ public class Component {
|
||||
public boolean usesBody() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -45,53 +43,51 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* A stand-alone DateTimePicker widget that makes it easy to select a date/time, or increment by week, month,
|
||||
* and/or year.
|
||||
* </p>
|
||||
* Dates attributes passed in the `RFC 3339` format:
|
||||
*
|
||||
* <p>
|
||||
* It is possible to customize the user-visible formatting with either the
|
||||
* 'formatLength' (long, short, medium or full) or 'displayFormat' attributes. By defaulty current
|
||||
* locale will be used.</p>
|
||||
* </p>
|
||||
*
|
||||
* Syntax supported by 'displayFormat' is (http://www.unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns):-
|
||||
* Renders date/time picker element.</p>
|
||||
* Format supported by this component are:-
|
||||
* <table border="1">
|
||||
* <tr>
|
||||
* <td>Format</td>
|
||||
* <td>Description</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>d</td>
|
||||
* <td>Day of the month</td>
|
||||
* <td>#dd</td>
|
||||
* <td>Display day in two digits format</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>D</td>
|
||||
* <td>Day of year</td>
|
||||
* <td>#d</td>
|
||||
* <td>Try to display day in one digit format, if cannot use 2 digit format</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>M</td>
|
||||
* <td>Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or 5 for the narrow name.</td>
|
||||
* <td>#MM</td>
|
||||
* <td>Display month in two digits format</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>h</td>
|
||||
* <td>Hour [1-12].</td>
|
||||
* <td>#M</td>
|
||||
* <td>Try to display month in one digits format, if cannot use 2 digit format</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>H</td>
|
||||
* <td>Hour [0-23].</td>
|
||||
* <td>#yyyy</td>
|
||||
* <td>Display year in four digits format</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>m</td>
|
||||
* <td>Minute. Use one or two for zero padding.</td>
|
||||
* <td>#yy</td>
|
||||
* <td>Display the last two digits of the yaer</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>s</td>
|
||||
* <td>Second. Use one or two for zero padding.</td>
|
||||
* <td>#y</td>
|
||||
* <td>Display the last digits of the year</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* <p>
|
||||
* The value sent to the server is
|
||||
* It is possible to customize the user-visible formatting with either the
|
||||
* formatLength or displayFormat attributes. The value sent to the server is
|
||||
* typically a locale-independent value in a hidden field as defined by the name
|
||||
* attribute. RFC3339 representation is the format used.
|
||||
* attribute. RFC3339 representation is used by default, but other options are
|
||||
* available with saveFormat
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
@@ -106,7 +102,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* Example 1:
|
||||
* <s:datetimepicker name="order.date" label="Order Date" />
|
||||
* Example 2:
|
||||
* <s:datetimepicker name="delivery.date" label="Delivery Date" format="yyyy-MM-dd" />
|
||||
* <s:datetimepicker name="delivery.date" label="Delivery Date" format="#yyyy-#MM-#dd" />
|
||||
*
|
||||
* <!-- END SNIPPET: expl1 -->
|
||||
* </pre>
|
||||
@@ -131,10 +127,8 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
public class DateTimePicker extends UIBean {
|
||||
|
||||
final public static String TEMPLATE = "datetimepicker";
|
||||
// Backported changes from s2 trunk (r657936)
|
||||
// final private static SimpleDateFormat RFC3339_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||
final private static String RFC3339_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
||||
final private static String RFC3339_PATTERN = "{0,date," + RFC3339_FORMAT + "}";
|
||||
final private static SimpleDateFormat RFC3399_FORMAT = new SimpleDateFormat(
|
||||
"yyyy-MM-dd'T'HH:mm:ss");
|
||||
final protected static Log LOG = LogFactory.getLog(DateTimePicker.class);
|
||||
|
||||
protected String iconPath;
|
||||
@@ -152,7 +146,6 @@ public class DateTimePicker extends UIBean {
|
||||
protected String staticDisplay;
|
||||
protected String dayWidth;
|
||||
protected String language;
|
||||
protected String templateCssPath;
|
||||
|
||||
public DateTimePicker(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -184,7 +177,7 @@ public class DateTimePicker extends UIBean {
|
||||
if(value != null)
|
||||
addParameter("value", findString(value));
|
||||
if(iconPath != null)
|
||||
addParameter("iconPath", findString(iconPath));
|
||||
addParameter("iconPath", iconPath);
|
||||
if(formatLength != null)
|
||||
addParameter("formatLength", findString(formatLength));
|
||||
if(displayFormat != null)
|
||||
@@ -198,9 +191,7 @@ public class DateTimePicker extends UIBean {
|
||||
addParameter("type", findString(type));
|
||||
else
|
||||
addParameter("type", "date");
|
||||
if(templateCssPath != null)
|
||||
addParameter("templateCssPath", findString(templateCssPath));
|
||||
|
||||
|
||||
// format the value to RFC 3399
|
||||
if(parameters.containsKey("value")) {
|
||||
parameters.put("nameValue", format(parameters.get("value")));
|
||||
@@ -267,7 +258,7 @@ public class DateTimePicker extends UIBean {
|
||||
this.formatLength = formatLength;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Path to icon used for the dropdown")
|
||||
@StrutsTagAttribute(description=" Path to icon used for the dropdown")
|
||||
public void setIconPath(String iconPath) {
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
@@ -288,32 +279,25 @@ public class DateTimePicker extends UIBean {
|
||||
this.toggleType = toggleType;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Template css path")
|
||||
public void setTemplateCssPath(String templateCssPath) {
|
||||
this.templateCssPath = templateCssPath;
|
||||
}
|
||||
|
||||
private String format(Object obj) {
|
||||
if(obj == null)
|
||||
return null;
|
||||
|
||||
if(obj instanceof Date) {
|
||||
return MessageFormat.format(RFC3339_PATTERN, (Date) obj);
|
||||
} else if(obj instanceof Calendar) {
|
||||
return MessageFormat.format(RFC3339_PATTERN, ((Calendar) obj).getTime());
|
||||
return RFC3399_FORMAT.format((Date) obj);
|
||||
} else {
|
||||
// try to parse a date
|
||||
String dateStr = obj.toString();
|
||||
if(dateStr.equalsIgnoreCase("today"))
|
||||
return MessageFormat.format(RFC3339_PATTERN, new Date());
|
||||
return RFC3399_FORMAT.format(new Date());
|
||||
|
||||
try {
|
||||
Date date = null;
|
||||
if(this.displayFormat != null) {
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
(String) getParameters().get("displayFormat"));
|
||||
this.displayFormat);
|
||||
date = format.parse(dateStr);
|
||||
return MessageFormat.format(RFC3339_PATTERN, date);
|
||||
return RFC3399_FORMAT.format(date);
|
||||
} else {
|
||||
// last resource to assume already in correct/default format
|
||||
return dateStr;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user