You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/10/20 11:40:58 UTC

svn commit: r706169 - /incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java

Author: fmeschbe
Date: Mon Oct 20 02:40:58 2008
New Revision: 706169

URL: http://svn.apache.org/viewvc?rev=706169&view=rev
Log:
SLING-705 Add single forward method to ScriptHelper implementation

Modified:
    incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java

Modified: incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java?rev=706169&r1=706168&r2=706169&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java (original)
+++ incubator/sling/trunk/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java Mon Oct 20 02:40:58 2008
@@ -119,7 +119,7 @@
     public void include(String path, RequestDispatcherOptions options) {
         final RequestDispatcher dispatcher = getRequest().getRequestDispatcher(
             path, options);
-
+        
         if (dispatcher != null) {
             try {
                 dispatcher.include(getRequest(), getResponse());
@@ -130,6 +130,22 @@
             }
         }
     }
+    
+    /** Forward the request to another resource, using specified options */
+    public void forward(String path, RequestDispatcherOptions options) {
+        final RequestDispatcher dispatcher = getRequest().getRequestDispatcher(
+            path, options);
+
+        if (dispatcher != null) {
+            try {
+                dispatcher.forward(getRequest(), getResponse());
+            } catch (IOException ioe) {
+                throw new SlingIOException(ioe);
+            } catch (ServletException se) {
+                throw new SlingServletException(se);
+            }
+        }
+    }
 
     /**
      * @see org.apache.sling.api.scripting.SlingScriptHelper#getService(java.lang.Class)