unico 2003/11/14 10:58:18
Modified: src/java/org/apache/cocoon/components/flow/javascript/fom
FOM_Cocoon.java
Log:
add cocoon.sendStatus and cocoon.response.setStatus methods to FOM
Revision Changes Path
1.17 +13 -1
cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_Cocoon.java
Index: FOM_Cocoon.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_Cocoon.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- FOM_Cocoon.java 31 Oct 2003 10:30:15 -0000 1.16
+++ FOM_Cocoon.java 14 Nov 2003 18:58:18 -0000 1.17
@@ -72,6 +72,7 @@
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.Response;
import org.apache.cocoon.environment.Session;
+import org.apache.cocoon.environment.http.HttpResponse;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.JavaScriptException;
import org.mozilla.javascript.Script;
@@ -216,6 +217,10 @@
PipelinesNode.getRedirector(environment).redirect(false, uri);
}
+ public void jsFunction_sendStatus(int sc) {
+ PipelinesNode.getRedirector(environment).sendStatus(sc);
+ }
+
/*
NOTE (SM): These are the hooks to the future FOM Event Model that will be
@@ -585,6 +590,13 @@
public void jsFunction_addHeader(String name, String value) {
response.addHeader(name, value);
}
+
+ public void jsFunction_setStatus(int sc) {
+ if (response instanceof HttpResponse) {
+ ((HttpResponse) response).setStatus(sc);
+ }
+ }
+
}
public static class FOM_Session extends ScriptableObject {