You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Eric B <eb...@hotmail.com> on 2013/10/25 22:36:23 UTC

Infinite loop when using completeAutoLoad=true & Tiles 3.0.1

I'm trying to use Spring MVC 3.2.4 & Tiles 3.0.1 with Regexp prefixes in 
my tiles.xml file.  I'm a newbie with Tiles, so I might be doing 
something wrong, but have been trying to follow things I have read on in 
the Tiles doc site as well as apply stuff from the tech.finn.no blog.

Unfortunately, when I use completeAutoLoad=true with RegExp prefix in my 
tiles.xml file, I get stuck in an infinite loop when trying to resolve 
the view.

Stack Trace:

     SEVERE: Servlet.service() for servlet jsp threw exception
     java.lang.StackOverflowError
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)

     ....
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.encodeURL(SaveContextOnUpdateOrErrorResponseWrapper.java:181)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)

     ....
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:76)
     	at 
org.springframework.web.servlet.tags.UrlTag.createUrl(UrlTag.java:227)
     	at 
org.springframework.web.servlet.tags.UrlTag.doEndTag(UrlTag.java:174)
     	at 
org.apache.jsp.tag.webutil.load_002dscripts_tag._jspx_meth_spring_005furl_005f0(load_002dscripts_tag.java:300)
     	at 
org.apache.jsp.tag.webutil.load_002dscripts_tag.doTag(load_002dscripts_tag.java:113)
     	at 
org.apache.jsp.WEB_002dINF.views.tiles.layouts.default_jsp._jspx_meth_util_005fload_002dscripts_005f0(default_jsp.java:176)
     	at 
org.apache.jsp.WEB_002dINF.views.tiles.layouts.default_jsp._jspService(default_jsp.java:93)
     	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
     	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
     	at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
     	at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
     	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
     	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
     	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
     	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
     	at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)


pom.xml:

		<dependency>
			<groupId>org.apache.tiles</groupId>
			<artifactId>tiles-extras</artifactId>
			<version>3.0.1</version>
		</dependency>



webmvc-config.xml:

     <bean 
class="org.springframework.web.servlet.view.tiles3.SpringWildcardServletTilesApplicationContext" 
autowire="constructor" />
     <bean id="viewResolver" 
class="org.springframework.web.servlet.view.tiles3.TilesViewResolver" >
     	<property name="cache" value="false"/>
     	<property name="viewClass" 
value="org.springframework.web.servlet.view.tiles3.TilesView" />
     </bean>

     <bean id="tilesConfigurer" 
class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
     <property name="completeAutoload" value="true"/>
     </bean>



Tiles.xml:

     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software 
Foundation//DTD Tiles Configuration 3.0//EN" 
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
     <tiles-definitions>
     <definition name="REGEXP:(.+)" 
template="/WEB-INF/views/tiles/layouts/default.jsp">
         <put-attribute name="meta" 
value="/WEB-INF/views/tiles/{1}/meta.jsp"/>
         <put-attribute name="head" 
value="/WEB-INF/views/tiles/{1}/head.jsp"/>
         <put-attribute name="header" 
value="/WEB-INF/views/tiles/{1}/header.jsp"/>
         <put-attribute name="menu" 
value="/WEB-INF/views/tiles/{1}/menu.jsp"/>
         <put-attribute name="body" 
value="/WEB-INF/views/tiles/{1}/body.jsp"/>
         <put-attribute name="footer" 
value="/WEB-INF/views/tiles/{1}/footer.jsp"/>
     </definition>

     </tiles-definitions>


default.jsp:

     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
     <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
     <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
     <%@ taglib prefix="util" tagdir="/WEB-INF/tags/util"%>
     <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
     <html>
     	<jsp:directive.page contentType="text/html;charset=UTF-8" />
     	<jsp:directive.page pageEncoding="UTF-8" />
     			
     	<head>
     		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     		<meta http-equiv="X-UA-Compatible" content="IE=8" />	
     		<tiles:insertAttribute name="meta" ignore="true" />
     			
     		<util:load-scripts />
     		
     		<tiles:insertAttribute name="head" ignore="true" />
     		
     		<spring:message code="application_name" var="app_name" 
htmlEscape="false"/>
     		<title><spring:message code="welcome_h3" arguments="${app_name}" 
/></title>
     	</head>
     	
       	<body class="tundra spring">
        		<div id="wrapper">
     		    <div id="header"><tiles:insertAttribute name="header" 
ignore="true" /></div>
     		    <div id="menu"><tiles:insertAttribute name="menu" 
ignore="true" /></div>
     		    <div id="main">
     	    		<div id="body"><tiles:insertAttribute name="body"/></div>
     		    	<div id="footer"><tiles:insertAttribute name="footer" 
ignore="true"/></div>
     		    </div>
     		</div>
     	</body>
     </html>



/WEB-INF/views/tiles/secure/login/body.jsp:

     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
     <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
     <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
     <%@ taglib uri="http://www.springframework.org/tags/form" 
prefix="form"%>
     <%@ taglib prefix="util" tagdir="/WEB-INF/tags/util"%>

     <jsp:directive.page contentType="text/html;charset=UTF-8" />

     <div class="container">

     <form name="login" class="form-signin" action='<spring:url 
value="/j_spring_security_check"/>' method="POST">
     	<h2 class="form-signin-heading">Please sign in</h2>
     	<input type="text" class="form-control" name="j_username" 
placeholder="Email address" autofocus>
     	<input type="password" class="form-control" name="j_password" 
placeholder="Password">
     	<label class="checkbox"> <input type="checkbox" 
value="remember-me"> Remember me</label>
     	<button class="btn btn-lg btn-primary btn-block" 
type="submit">Sign in</button>
     </form>
     </div>





I don't think there is anything specifically special in this 
configuration, so am not sure why I get into an infinite loop.  If I 
replace the CompleteAutoTilesInitializer class with the 
BasicTilesInitializerClass and use Wildcards (ie: */*) instead and 
replace {1} with {1}/{2}, then the view loads properly (no infinite loop).


Any ideas what I am doing wrong, or is this a Tiles problem?


Re: Infinite loop when using completeAutoLoad=true & Tiles 3.0.1

Posted by Paul Benedict <pb...@apache.org>.
Jinal,

You'll have to unsubscribe yourself:
http://struts.apache.org/mail.html

-- Paul


On Tue, Nov 5, 2013 at 3:33 PM, Jinal Patel <pa...@gmail.com> wrote:

> can you please remove me from the mailing list?  I am not sure why I am
> getting these emails.  Thank you
>
>
> On Tue, Nov 5, 2013 at 2:49 PM, Eric B <eb...@hotmail.com> wrote:
>
> > On 13-11-01 8:49 AM, Mck wrote:
> >
> >>
> >>  I don't think there is anything specifically special in this
> >>> configuration, so am not sure why I get into an infinite loop.  If I
> >>> replace the CompleteAutoTilesInitializer class with the
> >>> BasicTilesInitializerClass and use Wildcards (ie: */*) instead and
> >>> replace {1} with {1}/{2}, then the view loads properly (no infinite
> >>> loop).
> >>>
> >>
> >>
> >> This problem was fixed by making the REGEXP pattern less greedy correct?
> >>
> >
> > Yes - a less greedy regexp fixed this problem.  I had not realized that
> > every template name would be tested against the definition names/patterns
> > as well, and therefore cause an infinite loop with a greedy regex.
> >
> >
> >
>



-- 
Cheers,
Paul

Re: Infinite loop when using completeAutoLoad=true & Tiles 3.0.1

Posted by Jinal Patel <pa...@gmail.com>.
can you please remove me from the mailing list?  I am not sure why I am
getting these emails.  Thank you


On Tue, Nov 5, 2013 at 2:49 PM, Eric B <eb...@hotmail.com> wrote:

> On 13-11-01 8:49 AM, Mck wrote:
>
>>
>>  I don't think there is anything specifically special in this
>>> configuration, so am not sure why I get into an infinite loop.  If I
>>> replace the CompleteAutoTilesInitializer class with the
>>> BasicTilesInitializerClass and use Wildcards (ie: */*) instead and
>>> replace {1} with {1}/{2}, then the view loads properly (no infinite
>>> loop).
>>>
>>
>>
>> This problem was fixed by making the REGEXP pattern less greedy correct?
>>
>
> Yes - a less greedy regexp fixed this problem.  I had not realized that
> every template name would be tested against the definition names/patterns
> as well, and therefore cause an infinite loop with a greedy regex.
>
>
>

Re: Infinite loop when using completeAutoLoad=true & Tiles 3.0.1

Posted by Eric B <eb...@hotmail.com>.
On 13-11-01 8:49 AM, Mck wrote:
>
>> I don't think there is anything specifically special in this
>> configuration, so am not sure why I get into an infinite loop.  If I
>> replace the CompleteAutoTilesInitializer class with the
>> BasicTilesInitializerClass and use Wildcards (ie: */*) instead and
>> replace {1} with {1}/{2}, then the view loads properly (no infinite loop).
>
>
> This problem was fixed by making the REGEXP pattern less greedy correct?

Yes - a less greedy regexp fixed this problem.  I had not realized that every template name would be tested against the definition names/patterns as 
well, and therefore cause an infinite loop with a greedy regex.



Re: Infinite loop when using completeAutoLoad=true & Tiles 3.0.1

Posted by Mck <mc...@apache.org>.
> I don't think there is anything specifically special in this 
> configuration, so am not sure why I get into an infinite loop.  If I 
> replace the CompleteAutoTilesInitializer class with the 
> BasicTilesInitializerClass and use Wildcards (ie: */*) instead and 
> replace {1} with {1}/{2}, then the view loads properly (no infinite loop).


This problem was fixed by making the REGEXP pattern less greedy correct?

~mck