Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
1.2.7
-
None
-
None
-
Operating System: All
Platform: All
-
35703
Description
TilesUtilImpl doInclude() methods do not call the TilesRequestProcessor but
instead use either pageContext or servletContext include() methods.
IMHO this is wrong.
That would definitely make sense to call the application's TilesRequestProcessor
as any Web App could implement its own (RequestProcessor) - as a subclass of
TilesRequestProcessor - which could basically override doInclude() and
doForward() or general request processing (action, JSP,... etc.).
IMO not calling the TilesRequestProcessor from TilesUtilsImpl fails part of the
contract of the RequestProcessor.
That's a major issue as far as I'm concerned.
Following is the patch I'm currently using to fix it (fix for 2 classes):
- First part of the patch is for TilesRequestProcessor to override
RequestProcessor doInclude() method to allow for calling overloaded methods of
subclasses of TilesRequestProcessor. - Second part is the actual fix for TilesUtilImpl to call TilesRequestProcessor
doInclude() method.
=======================
TilesRequestProcessor
=======================
— org/apache/struts/tiles/TilesRequestProcessor.java.orig 2005-05-06
10:48:22.000000000 +0200
+++ org/apache/struts/tiles/TilesRequestProcessor.java 2005-07-12
10:41:49.429375000 +0200
@@ -264,6 +264,25 @@
}
}
+ /**
+ * Do an include using request dispatcher.
+ * Uri is a valid uri.
+ * Necessary to allow usage of overloaded RequestProcessor.
+ * N.B.: scope is to make this method available to tiles package.
+ * @param uri Uri or Definition name to include.
+ * @param request Current page request.
+ * @param response Current page response.
+ */
+ protected void doInclude(
+ String uri,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws IOException, ServletException
+
+
/**
- Overloaded method from Struts' RequestProcessor.
- Forward or redirect to the specified destination by the specified
=======================
TilesUtilImpl
=======================
— org/apache/struts/tiles/TilesUtilImpl.java.orig 2005-05-06
10:48:16.000000000 +0200
+++ org/apache/struts/tiles/TilesUtilImpl.java 2005-07-12 14:28:23.148125000 +0200
@@ -30,6 +30,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts.Globals;
import org.apache.struts.tiles.definition.ComponentDefinitionsFactoryWrapper;
import org.apache.struts.util.RequestUtils;
@@ -62,7 +63,8 @@
ServletContext servletContext)
throws IOException, ServletException
/**
@@ -82,7 +84,8 @@
ServletContext servletContext)
throws IOException, ServletException
/**
@@ -96,7 +99,10 @@
public void doInclude(String uri, PageContext pageContext)
throws IOException, ServletException
/**
@@ -200,4 +206,15 @@
servletContext.setAttribute(DEFINITIONS_FACTORY, factory);
}
-}
\ No newline at end of file
+ /**
+ * Get Tiles RequestProcessor associated to application.
+ * @param servletContext Current servlet context.
+ * @return The
for the current request.
+ */
+ protected TilesRequestProcessor getRequestProcessor(
+ ServletContext servletContext)
+}