Author: ddewolf Date: Thu Nov 2 13:21:51 2006 New Revision: 470525 URL: http://svn.apache.org/viewvc?view=rev&rev=470525 Log: Slowly removing TilesUtil dependencies in order to move towards container
Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspTilesRequestContext.java struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspUtil.java struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/BaseInsertTag.java Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspTilesRequestContext.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspTilesRequestContext.java?view=diff&rev=470525&r1=470524&r2=470525 ============================================================================== --- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspTilesRequestContext.java (original) +++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspTilesRequestContext.java Thu Nov 2 13:21:51 2006 @@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.JspException; import java.io.IOException; /** @@ -56,9 +57,7 @@ public void include(String path) throws TilesException { try { include(path, false); - } catch (IOException e) { - throw new TilesException(e); - } catch (ServletException e) { + } catch (JspException e) { throw new TilesException(e); } } @@ -71,10 +70,9 @@ * * @param path Uri or Definition name to forward. * @param flush If the writer should be flushed before the include - * @throws javax.servlet.ServletException - Thrown by call to pageContext.include() - * @throws java.io.IOException - Thrown by call to pageContext.include() + * @throws JspException if the underlying include fails */ - public void include(String path, boolean flush) throws IOException, ServletException { + public void include(String path, boolean flush) throws JspException { JspUtil.doInclude(pageContext, path, flush); } Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspUtil.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspUtil.java?view=diff&rev=470525&r1=470524&r2=470525 ============================================================================== --- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspUtil.java (original) +++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/context/jsp/JspUtil.java Thu Nov 2 13:21:51 2006 @@ -24,6 +24,7 @@ import javax.servlet.ServletException; import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.JspException; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -57,7 +58,7 @@ } public static void doInclude(PageContext pageContext, String uri, boolean flush) - throws IOException, ServletException { + throws JspException { try { // perform include with new JSP 2.0 method that supports flushing @@ -65,13 +66,17 @@ include.invoke(pageContext, uri, flush); return; } + pageContext.include(uri); } catch (IllegalAccessException e) { LOG.debug("Could not find JSP 2.0 include method. Using old one.", e); } catch (InvocationTargetException e) { LOG.debug("Unable to execute JSP 2.0 include method. Trying old one.", e); + } catch (IOException e) { + throw new JspException("IOException while including page.", e); + } catch (ServletException e) { + throw new JspException("ServletException while including page.", e); } - pageContext.include(uri); } Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/BaseInsertTag.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/BaseInsertTag.java?view=diff&rev=470525&r1=470524&r2=470525 ============================================================================== --- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/BaseInsertTag.java (original) +++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/BaseInsertTag.java Thu Nov 2 13:21:51 2006 @@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.tiles.definition.ComponentAttribute; import org.apache.tiles.context.ComponentContext; +import org.apache.tiles.context.jsp.JspUtil; import org.apache.tiles.TilesRequestContext; import org.apache.tiles.definition.ComponentDefinition; import org.apache.tiles.preparer.ViewPreparer; @@ -384,12 +385,10 @@ * * @param page The page that will be included * @param flush If the writer should be flushed before the include - * @throws ServletException - Thrown by call to pageContext.include() - * @throws IOException - Thrown by call to pageContext.include() + * @throws javax.servlet.jsp.JspException */ - protected void doInclude(String page, boolean flush) throws Exception, - IOException { - TilesUtil.doInclude(page, pageContext, flush); + protected void doInclude(String page, boolean flush) throws JspException { + JspUtil.doInclude(pageContext, page, flush); } // ///////////////////////////////////////////////////////////////////////////