Revision: 974
http://stripes.svn.sourceforge.net/stripes/?rev=974&view=rev
Author: javelotinfo
Date: 2008-10-14 20:52:30 +0000 (Tue, 14 Oct 2008)
Log Message:
-----------
Implementation for STS-615
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/action/ForwardResolution.java
Modified:
trunk/stripes/src/net/sourceforge/stripes/action/ForwardResolution.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/action/ForwardResolution.java
2008-10-10 21:03:13 UTC (rev 973)
+++ trunk/stripes/src/net/sourceforge/stripes/action/ForwardResolution.java
2008-10-14 20:52:30 UTC (rev 974)
@@ -35,6 +35,9 @@
* <i>forwarding</i> to it. This behaviour can be turned off be calling
* [EMAIL PROTECTED] autoInclude(false)}.</p>
*
+ * <p>You can optionally set an HTTP status code with [EMAIL PROTECTED]
#setStatus(int)}, in which case a call
+ * to [EMAIL PROTECTED] response.setStatus(status)} will be made when
executing the resolution.</p>
+ *
* @see RedirectResolution
* @author Tim Fennell
*/
@@ -42,6 +45,7 @@
private boolean autoInclude = true;
private static final Log log = Log.getInstance(ForwardResolution.class);
private String event;
+ private Integer status;
/**
* Simple constructor that takes in the path to forward the user to.
@@ -86,7 +90,21 @@
this.autoInclude = auto;
}
+ /** Get the HTTP status, or <code>null</code> if none was explicitly set.
*/
+ public Integer getStatus() {
+ return status;
+ }
+
/**
+ * Explicitly sets an HTTP status code, in which case a call to [EMAIL
PROTECTED] response.setStatus(status)}
+ * will be made when executing the resolution.
+ */
+ public ForwardResolution setStatus(int status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
* Attempts to forward the user to the specified path.
* @throws ServletException thrown when the Servlet container encounters
an error
* @throws IOException thrown when the Servlet container encounters an
error
@@ -94,6 +112,9 @@
public void execute(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
+ if (status != null) {
+ response.setStatus(status);
+ }
String path = getUrl(request.getLocale());
// Set event name as a request attribute
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development