You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by un...@apache.org on 2003/11/17 00:20:28 UTC

cvs commit: cocoon-2.2/src/java/org/apache/cocoon/components/flow/javascript/fom FOM_Cocoon.java

unico       2003/11/16 15:20:28

  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.2/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_Cocoon.java
  
  Index: FOM_Cocoon.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/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 11:22:16 -0000	1.16
  +++ FOM_Cocoon.java	16 Nov 2003 23:20:27 -0000	1.17
  @@ -71,6 +71,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;
  @@ -207,6 +208,10 @@
           // environment.redirect(false, uri);
           PipelinesNode.getRedirector(environment).redirect(false, uri);
       }
  +    
  +    public void jsFunction_sendStatus(int sc) {
  +        PipelinesNode.getRedirector(environment).sendStatus(sc);
  +    }
   
   /*
   
  @@ -577,6 +582,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 {