Author: mrdon
Date: Mon Oct 9 11:49:38 2006
New Revision: 454455
URL: http://svn.apache.org/viewvc?view=rev&rev=454455
Log:
Adding more friendly result constructors and setters, changed
xwork dep to beta 1
WW-1463 WW-1453
Modified:
struts/struts2/trunk/core/pom.xml
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java
struts/struts2/trunk/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java
struts/struts2/trunk/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java
struts/struts2/trunk/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java
struts/struts2/trunk/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java
struts/struts2/trunk/pom.xml
Modified: struts/struts2/trunk/core/pom.xml
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/pom.xml?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
--- struts/struts2/trunk/core/pom.xml (original)
+++ struts/struts2/trunk/core/pom.xml Mon Oct 9 11:49:38 2006
@@ -36,20 +36,10 @@
<dependencies>
- <!-- unreferenced dependencies:
- * clover, mockobjects, xdoclet : only needed for build
- * cewolf : only used in demos
- * quickstart : because i'm lazy, and because it's unlikely to be
needed to build a
- project using ww
- * w3c.dom : needed for the xslt : this is all included in jdk1.5
- - classes missing in jdk1.4 are org.w3c.dom.TypeInfo,
- org.w3c.dom.UserDataHandler,
org.w3c.dom.DOMConfiguration
- - this should be configurable with <profiles>
- -->
<dependency>
<groupId>opensymphony</groupId>
<artifactId>xwork</artifactId>
- <version>2.0-SNAPSHOT</version>
+ <version>2.0-beta-1</version>
</dependency>
<dependency>
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java
Mon Oct 9 11:49:38 2006
@@ -75,8 +75,19 @@
private boolean parse = true;
- private Map headers;
+ private Map<String,String> headers;
private int status = -1;
+
+ public HttpHeaderResult() {
+ super();
+ headers = new HashMap<String,String>();
+ }
+
+ public HttpHeaderResult(int status) {
+ this();
+ this.status = status;
+ this.parse = false;
+ }
/**
@@ -85,10 +96,6 @@
* @return a Map of all HTTP headers.
*/
public Map getHeaders() {
- if (headers == null) {
- headers = new HashMap();
- }
-
return headers;
}
@@ -98,8 +105,9 @@
* @param parse <tt>true</tt> if HTTP header values should be evaluated
agains the ValueStack, <tt>false</tt>
* otherwise.
*/
- public void setParse(boolean parse) {
+ public HttpHeaderResult setParse(boolean parse) {
this.parse = parse;
+ return this;
}
/**
@@ -108,8 +116,19 @@
* @param status the Http status code
* @see javax.servlet.http.HttpServletResponse#setStatus(int)
*/
- public void setStatus(int status) {
+ public HttpHeaderResult setStatus(int status) {
this.status = status;
+ return this;
+ }
+
+ /**
+ * Adds an HTTP header to the response
+ * @param name
+ * @param value
+ */
+ public HttpHeaderResult addHeader(String name, String value) {
+ headers.put(name, value);
+ return this;
}
/**
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java
Mon Oct 9 11:49:38 2006
@@ -79,6 +79,13 @@
private String charSet;
+ public PlainTextResult() {
+ super();
+ }
+
+ public PlainTextResult(String location) {
+ super(location);
+ }
/**
* Set the character set
@@ -94,8 +101,9 @@
*
* @param charSet The character set
*/
- public void setCharSet(String charSet) {
+ public PlainTextResult setCharSet(String charSet) {
this.charSet = charSet;
+ return this;
}
/* (non-Javadoc)
@@ -132,13 +140,13 @@
InputStreamReader reader = null;
try {
if (charset != null) {
- reader = new
InputStreamReader(servletContext.getResourceAsStream(location), charset);
+ reader = new
InputStreamReader(servletContext.getResourceAsStream(finalLocation), charset);
}
else {
- reader = new
InputStreamReader(servletContext.getResourceAsStream(location));
+ reader = new
InputStreamReader(servletContext.getResourceAsStream(finalLocation));
}
if (reader == null) {
- _log.warn("resource at location ["+location+"]
cannot be obtained (return null) from ServletContext !!! ");
+ _log.warn("resource at location
["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! ");
}
else {
char[] buffer = new char[BUFFER_SIZE];
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java
Mon Oct 9 11:49:38 2006
@@ -132,7 +132,28 @@
protected String actionName;
protected String namespace;
protected String method;
+
+ private Map<String, String> requestParameters = new HashMap<String,
String>();
+ public ServletActionRedirectResult() {
+ super();
+ }
+
+ public ServletActionRedirectResult(String actionName) {
+ this(null, actionName, null);
+ }
+
+ public ServletActionRedirectResult(String actionName, String method) {
+ this(null, actionName, method);
+ }
+
+ public ServletActionRedirectResult(String namespace, String actionName,
String method) {
+ super(null);
+ this.namespace = namespace;
+ this.actionName = actionName;
+ this.method = method;
+ }
+
protected List<String> prohibitedResultParam = Arrays.asList(new String[] {
DEFAULT_PARAM, "namespace", "method", "encode", "parse",
"location",
"prependServletContext" });
@@ -154,24 +175,26 @@
method = conditionalParse(method, invocation);
}
- Map<String, String> requestParameters = new HashMap<String, String>();
- ResultConfig resultConfig =
invocation.getProxy().getConfig().getResults().get(
- invocation.getResultCode());
- Map resultConfigParams = resultConfig.getParams();
- for (Iterator i = resultConfigParams.entrySet().iterator();
i.hasNext(); ) {
- Map.Entry e = (Map.Entry) i.next();
- if (! prohibitedResultParam.contains(e.getKey())) {
- requestParameters.put(e.getKey().toString(),
- e.getValue() == null ? "":
-
conditionalParse(e.getValue().toString(), invocation));
- }
+ String resultCode = invocation.getResultCode();
+ if (resultCode != null) {
+ ResultConfig resultConfig =
invocation.getProxy().getConfig().getResults().get(
+ resultCode);
+ Map resultConfigParams = resultConfig.getParams();
+ for (Iterator i = resultConfigParams.entrySet().iterator();
i.hasNext(); ) {
+ Map.Entry e = (Map.Entry) i.next();
+ if (! prohibitedResultParam.contains(e.getKey())) {
+ requestParameters.put(e.getKey().toString(),
+ e.getValue() == null ? "":
+
conditionalParse(e.getValue().toString(), invocation));
+ }
+ }
}
ActionMapper mapper = ActionMapperFactory.getMapper();
StringBuffer tmpLocation = new
StringBuffer(mapper.getUriFromActionMapping(new ActionMapping(actionName,
namespace, method, null)));
UrlHelper.buildParametersString(requestParameters, tmpLocation, "&");
- location = tmpLocation.toString();
+ setLocation(tmpLocation.toString());
super.execute(invocation);
}
@@ -181,8 +204,9 @@
*
* @param actionName The name
*/
- public void setActionName(String actionName) {
+ public ServletActionRedirectResult setActionName(String actionName) {
this.actionName = actionName;
+ return this;
}
/**
@@ -190,8 +214,9 @@
*
* @param namespace The namespace
*/
- public void setNamespace(String namespace) {
+ public ServletActionRedirectResult setNamespace(String namespace) {
this.namespace = namespace;
+ return this;
}
/**
@@ -199,7 +224,20 @@
*
* @param method The method
*/
- public void setMethod(String method) {
+ public ServletActionRedirectResult setMethod(String method) {
this.method = method;
+ return this;
}
+
+ /**
+ * Adds a request parameter to be added to the redirect url
+ *
+ * @param key The parameter name
+ * @param value The parameter value
+ */
+ public ServletActionRedirectResult addParameter(String key, Object value) {
+ requestParameters.put(key, String.valueOf(value));
+ return this;
+ }
+
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java
Mon Oct 9 11:49:38 2006
@@ -88,7 +88,14 @@
private static final Log log =
LogFactory.getLog(ServletDispatcherResult.class);
-
+ public ServletDispatcherResult() {
+ super();
+ }
+
+ public ServletDispatcherResult(String location) {
+ super(location);
+ }
+
/**
* Dispatches to the given location. Does its forward via a
RequestDispatcher. If the
* dispatch fails a 404 error will be sent back in the http response.
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
Mon Oct 9 11:49:38 2006
@@ -24,6 +24,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.mapper.ActionMapperFactory;
+import org.springframework.beans.factory.config.SetFactoryBean;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
@@ -80,14 +81,23 @@
protected boolean prependServletContext = true;
+ public ServletRedirectResult() {
+ super();
+ }
+
+ public ServletRedirectResult(String location) {
+ super(location);
+ }
+
/**
* Sets whether or not to prepend the servlet context path to the
redirected URL.
*
* @param prependServletContext <tt>true</tt> to prepend the location with
the servlet context path,
* <tt>false</tt> otherwise.
*/
- public void setPrependServletContext(boolean prependServletContext) {
+ public ServletRedirectResult setPrependServletContext(boolean
prependServletContext) {
this.prependServletContext = prependServletContext;
+ return this;
}
/**
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java
Mon Oct 9 11:49:38 2006
@@ -83,8 +83,17 @@
protected String contentLength;
protected String contentDisposition = "inline";
protected String inputName = "inputStream";
+ protected InputStream inputStream;
protected int bufferSize = 1024;
+ public StreamResult() {
+ super();
+ }
+
+ public StreamResult(InputStream in) {
+ this.inputStream = in;
+ }
+
/**
* @return Returns the bufferSize.
*/
@@ -95,8 +104,9 @@
/**
* @param bufferSize The bufferSize to set.
*/
- public void setBufferSize(int bufferSize) {
+ public StreamResult setBufferSize(int bufferSize) {
this.bufferSize = bufferSize;
+ return this;
}
/**
@@ -109,8 +119,9 @@
/**
* @param contentType The contentType to set.
*/
- public void setContentType(String contentType) {
+ public StreamResult setContentType(String contentType) {
this.contentType = contentType;
+ return this;
}
/**
@@ -123,8 +134,9 @@
/**
* @param contentLength The contentLength to set.
*/
- public void setContentLength(String contentLength) {
+ public StreamResult setContentLength(String contentLength) {
this.contentLength = contentLength;
+ return this;
}
/**
@@ -137,8 +149,9 @@
/**
* @param contentDisposition the Content-disposition header value to use.
*/
- public void setContentDisposition(String contentDisposition) {
+ public StreamResult setContentDisposition(String contentDisposition) {
this.contentDisposition = contentDisposition;
+ return this;
}
/**
@@ -151,8 +164,9 @@
/**
* @param inputName The inputName to set.
*/
- public void setInputName(String inputName) {
+ public StreamResult setInputName(String inputName) {
this.inputName = inputName;
+ return this;
}
/**
@@ -160,14 +174,15 @@
*/
protected void doExecute(String finalLocation, ActionInvocation
invocation) throws Exception {
- InputStream oInput = null;
OutputStream oOutput = null;
try {
- // Find the inputstream from the invocation variable stack
- oInput = (InputStream)
invocation.getStack().findValue(conditionalParse(inputName, invocation));
-
- if (oInput == null) {
+ if (inputStream == null) {
+ // Find the inputstream from the invocation variable
stack
+ inputStream = (InputStream)
invocation.getStack().findValue(conditionalParse(inputName, invocation));
+ }
+
+ if (inputStream == null) {
String msg = ("Can not find a java.io.InputStream with the
name [" + inputName + "] in the invocation stack. " +
"Check the <param name=\"inputName\"> tag specified for
this action.");
log.error(msg);
@@ -212,7 +227,7 @@
log.debug("Streaming to output buffer +++ START +++");
byte[] oBuff = new byte[bufferSize];
int iSize;
- while (-1 != (iSize = oInput.read(oBuff))) {
+ while (-1 != (iSize = inputStream.read(oBuff))) {
oOutput.write(oBuff, 0, iSize);
}
log.debug("Streaming to output buffer +++ END +++");
@@ -221,7 +236,7 @@
oOutput.flush();
}
finally {
- if (oInput != null) oInput.close();
+ if (inputStream != null) inputStream.close();
if (oOutput != null) oOutput.close();
}
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java
Mon Oct 9 11:49:38 2006
@@ -104,11 +104,25 @@
/** The default parameter */
public static final String DEFAULT_PARAM = "location";
- protected boolean parse = true;
- protected boolean encode = false;
- protected String location;
- protected String lastFinalLocation;
+ private boolean parse;
+ private boolean encode;
+ private String location;
+ private String lastFinalLocation;
+ public StrutsResultSupport() {
+ this(null, true, false);
+ }
+
+ public StrutsResultSupport(String location) {
+ this(location, false, false);
+ }
+
+ public StrutsResultSupport(String location, boolean parse, boolean encode)
{
+ this.location = location;
+ this.parse = parse;
+ this.encode = encode;
+ }
+
/**
* The location to go to after action execution. This could be a JSP page
or another action.
* The location can contain OGNL expressions which will be evaulated if
the <tt>parse</tt>
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java
Mon Oct 9 11:49:38 2006
@@ -86,6 +86,13 @@
private static final Log log = LogFactory.getLog(VelocityResult.class);
+ public VelocityResult() {
+ super();
+ }
+
+ public VelocityResult(String location) {
+ super(location);
+ }
/**
* Creates a Velocity context from the action, loads a Velocity template
and executes the
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java
Mon Oct 9 11:49:38 2006
@@ -57,6 +57,14 @@
private String contentType = "text/html";
private String title;
+
+ public PortletResult() {
+ super();
+ }
+
+ public PortletResult(String location) {
+ super(location);
+ }
/**
* Execute the result. Obtains the
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java
Mon Oct 9 11:49:38 2006
@@ -95,6 +95,14 @@
private static final Log log = LogFactory
.getLog(PortletVelocityResult.class);
+ public PortletVelocityResult() {
+ super();
+ }
+
+ public PortletVelocityResult(String location) {
+ super(location);
+ }
+
/* (non-Javadoc)
* @see
org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String,
com.opensymphony.xwork2.ActionInvocation)
*/
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java
Mon Oct 9 11:49:38 2006
@@ -106,9 +106,17 @@
protected String location;
private String pContentType = "text/html";
+ public FreemarkerResult() {
+ super();
+ }
+
+ public FreemarkerResult(String location) {
+ super(location);
+ }
- public void setContentType(String aContentType) {
+ public FreemarkerResult setContentType(String aContentType) {
pContentType = aContentType;
+ return this;
}
/**
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java
Mon Oct 9 11:49:38 2006
@@ -65,8 +65,17 @@
private String pContentType = "text/html";
- public void setContentType(String aContentType) {
+ public PortletFreemarkerResult() {
+ super();
+ }
+
+ public PortletFreemarkerResult(String location) {
+ super(location);
+ }
+
+ public PortletFreemarkerResult setContentType(String aContentType) {
pContentType = aContentType;
+ return this;
}
/**
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java
Mon Oct 9 11:49:38 2006
@@ -201,6 +201,11 @@
templatesCache = new HashMap<String, Templates>();
noCache =
Settings.get("struts.xslt.nocache").trim().equalsIgnoreCase("true");
}
+
+ public XSLTResult(String stylesheetLocation) {
+ this();
+ setStylesheetLocation(stylesheetLocation);
+ }
/**
* @deprecated Use #setStylesheetLocation(String)
@@ -209,11 +214,11 @@
setStylesheetLocation(location);
}
- public void setStylesheetLocation(String location) {
+ public XSLTResult setStylesheetLocation(String location) {
if (location == null)
throw new IllegalArgumentException("Null location");
- System.out.println("location = " + location);
this.stylesheetLocation = location;
+ return this;
}
public String getStylesheetLocation() {
@@ -225,8 +230,9 @@
*
* @param parse
*/
- public void setParse(boolean parse) {
+ public XSLTResult setParse(boolean parse) {
this.parse = parse;
+ return this;
}
public void execute(ActionInvocation invocation) throws Exception {
Modified:
struts/struts2/trunk/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java
(original)
+++
struts/struts2/trunk/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java
Mon Oct 9 11:49:38 2006
@@ -128,33 +128,46 @@
protected String delimiter;
protected String imageServletUrl = "/images/";
-
+ public JasperReportsResult() {
+ super();
+ }
+
+ public JasperReportsResult(String location) {
+ super(location);
+ }
+
public String getImageServletUrl() {
return imageServletUrl;
}
- public void setImageServletUrl(final String imageServletUrl) {
+ public JasperReportsResult setImageServletUrl(final String
imageServletUrl) {
this.imageServletUrl = imageServletUrl;
+ return this;
}
- public void setDataSource(String dataSource) {
+ public JasperReportsResult setDataSource(String dataSource) {
this.dataSource = dataSource;
+ return this;
}
- public void setFormat(String format) {
+ public JasperReportsResult setFormat(String format) {
this.format = format;
+ return this;
}
- public void setDocumentName(String documentName) {
+ public JasperReportsResult setDocumentName(String documentName) {
this.documentName = documentName;
+ return this;
}
- public void setContentDisposition(String contentDisposition) {
+ public JasperReportsResult setContentDisposition(String
contentDisposition) {
this.contentDisposition = contentDisposition;
+ return this;
}
- public void setDelimiter(String delimiter) {
+ public JasperReportsResult setDelimiter(String delimiter) {
this.delimiter = delimiter;
+ return this;
}
protected void doExecute(String finalLocation, ActionInvocation
invocation) throws Exception {
Modified:
struts/struts2/trunk/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java
(original)
+++
struts/struts2/trunk/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java
Mon Oct 9 11:49:38 2006
@@ -42,15 +42,25 @@
private int height;
private int width;
+ public ChartResult() {
+ super();
+ }
+
+ public ChartResult(JFreeChart chart, int height, int width) {
+ setChart(chart);
+ this.height = height;
+ this.width = width;
+ }
/**
* Sets the JFreeChart to use.
*
* @param chart a JFreeChart object.
*/
- public void setChart(JFreeChart chart) {
+ public ChartResult setChart(JFreeChart chart) {
this.chart = chart;
chartSet = true;
+ return this;
}
/**
@@ -58,8 +68,9 @@
*
* @param height the height of the chart in pixels.
*/
- public void setHeight(int height) {
+ public ChartResult setHeight(int height) {
this.height = height;
+ return this;
}
/**
@@ -67,8 +78,9 @@
*
* @param width the width of the chart in pixels.
*/
- public void setWidth(int width) {
+ public ChartResult setWidth(int width) {
this.width = width;
+ return this;
}
/**
Modified:
struts/struts2/trunk/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java
(original)
+++
struts/struts2/trunk/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java
Mon Oct 9 11:49:38 2006
@@ -33,6 +33,13 @@
private static final long serialVersionUID = -3548970638740937804L;
+ public FacesResult() {
+ super();
+ }
+
+ public FacesResult(String location) {
+ super(location);
+ }
/**
* Checks to see if we need to build a new JSF ViewId from the Struts
Result
* config and then renders the result by delegating to the
Modified:
struts/struts2/trunk/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
---
struts/struts2/trunk/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java
(original)
+++
struts/struts2/trunk/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java
Mon Oct 9 11:49:38 2006
@@ -84,6 +84,13 @@
protected ActionInvocation invocation;
private DefinitionsFactory definitionsFactory;
+ public TilesResult() {
+ super();
+ }
+
+ public TilesResult(String location) {
+ super(location);
+ }
/**
* Dispatches to the given location. Does its forward via a
RequestDispatcher. If the
* dispatch fails a 404 error will be sent back in the http response.
@@ -94,7 +101,7 @@
* HTTP request.
*/
public void doExecute(String location, ActionInvocation invocation) throws
Exception {
- this.location = location;
+ setLocation(location);
this.invocation = invocation;
HttpServletRequest request = ServletActionContext.getRequest();
@@ -106,7 +113,7 @@
(DefinitionsFactory)
servletContext.getAttribute(TilesUtilImpl.DEFINITIONS_FACTORY);
// get component definition
- ComponentDefinition definition =
getComponentDefinition(this.definitionsFactory, request);
+ ComponentDefinition definition = getComponentDefinition(location,
this.definitionsFactory, request);
if (definition == null) {
throw new ServletException("No Tiles definition found for name '"
+ location + "'");
}
@@ -150,7 +157,7 @@
* @param request current HTTP request
* @return the component definition
*/
- protected ComponentDefinition getComponentDefinition(DefinitionsFactory
factory, HttpServletRequest request)
+ protected ComponentDefinition getComponentDefinition(String location,
DefinitionsFactory factory, HttpServletRequest request)
throws Exception {
ComponentDefinitions definitions = factory.readDefinitions();
return definitions.getDefinition(location, deduceLocale(request));
Modified: struts/struts2/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/pom.xml?view=diff&rev=454455&r1=454454&r2=454455
==============================================================================
--- struts/struts2/trunk/pom.xml (original)
+++ struts/struts2/trunk/pom.xml Mon Oct 9 11:49:38 2006
@@ -256,16 +256,6 @@
</plugins>
</reporting>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>opensymphony</groupId>
- <artifactId>xwork</artifactId>
- <version>2.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<repositories>
<repository>
<id>snapshots-maven-codehaus</id>
@@ -297,7 +287,7 @@
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<releases>
- <enabled>false</enabled>
+ <enabled>true</enabled>
</releases>
<url>http://maven.opensymphony.com</url>
</repository>