You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ge...@apache.org on 2007/01/26 21:56:59 UTC

svn commit: r500341 - /tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/servlet/ServletTilesRequestContext.java

Author: germuska
Date: Fri Jan 26 12:56:58 2007
New Revision: 500341

URL: http://svn.apache.org/viewvc?view=rev&rev=500341
Log:
Fix TILES-28 - only use requestDispatcher.include() after the response has been committed

Modified:
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/servlet/ServletTilesRequestContext.java

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/servlet/ServletTilesRequestContext.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/servlet/ServletTilesRequestContext.java?view=diff&rev=500341&r1=500340&r2=500341
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/servlet/ServletTilesRequestContext.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/servlet/ServletTilesRequestContext.java Fri Jan 26 12:56:58 2007
@@ -157,10 +157,25 @@
     }
 
     public void dispatch(String path) throws IOException {
-        include(path);
+    	if (response.isCommitted()) {
+    		include(path);
+    	} else {
+    		forward(path);
+    	}
     }
 
-    public void include(String path) throws IOException{
+    private void forward( String path ) throws IOException {
+        RequestDispatcher rd = request.getRequestDispatcher(path);
+        try {
+            rd.forward(request, response);
+        } catch (ServletException ex) {
+            LOG.error("Servlet Exception while including path", ex);
+            throw new IOException("Error including path '"+path+"'. " + ex.getMessage());
+        }
+	}
+
+
+	public void include(String path) throws IOException{
         RequestDispatcher rd = request.getRequestDispatcher(path);
         try {
             rd.include(request, response);