[ 
https://issues.apache.org/jira/browse/TILES-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262475#comment-13262475
 ] 

Viktor Hedefalk commented on TILES-544:
---------------------------------------

The TilesView I have in Spring 3.1.1 doesn't really look like the code you 
posted. I have this method:

{code}
protected void renderMergedOutputModel(
                        Map<String, Object> model, HttpServletRequest request, 
HttpServletResponse response) throws Exception {

                ServletContext servletContext = getServletContext();
                TilesContainer container = 
ServletUtil.getContainer(servletContext);
                if (container == null) {
                        throw new ServletException("Tiles container is not 
initialized. " +
                                        "Have you added a TilesConfigurer to 
your web application context?");
                }

                exposeModelAsRequestAttributes(model, request);
                JstlUtils.exposeLocalizationContext(new RequestContext(request, 
servletContext));

                if (!response.isCommitted()) {
                        // Tiles is going to use a forward, but some web 
containers (e.g. OC4J 10.1.3)
                        // do not properly expose the Servlet 2.4 forward 
request attributes... However,
                        // must not do this on Servlet 2.5 or above, mainly for 
GlassFish compatibility.
                        if (this.exposeForwardAttributes) {
                                try {
                                        
WebUtils.exposeForwardRequestAttributes(request);
                                }
                                catch (Exception ex) {
                                        // Servlet container rejected to set 
internal attributes, e.g. on TriFork.
                                        this.exposeForwardAttributes = false;
                                }
                        }
                }

                container.render(getUrl(), request, response);
        }

{code}

But it's ok to just surround the container.render() call with start- and 
endContext()?

Thanks,
Viktor
                
> Stack overflow due to rendering loop when including a resource resulting in 
> another tiles view.
> -----------------------------------------------------------------------------------------------
>
>                 Key: TILES-544
>                 URL: https://issues.apache.org/jira/browse/TILES-544
>             Project: Tiles
>          Issue Type: Bug
>    Affects Versions: 2.2.2
>         Environment: Spring MVC 3.1.1
>            Reporter: Viktor Hedefalk
>         Attachments: tiles-stackoverflow.txt
>
>
> I get a stackoverflow because of a rendering loop when including an call to a 
> controller with a view is also a tile. This is a dup of TILES-418, but since 
> that one was closed and I couldn't attach my stack trace, I'll open this new 
> one.
> To me this is very critical. I just upgraded an application from Spring 2.0.7 
> and old struts-tiles to Spring 3.1.1 and tiles 2.2.2 and the structure worked 
> with struts-tiles. It's kind of a homebrew portlet thingy where we iterate 
> over url:s pointing to controllers given by a cms.
> The included controller is called correctly and returns a model and view 
> where the view points to a tile definition. But when Spring gives over the 
> rendering to tiles, the loop begins.
> It doesn't matter if I include the url with:
>  <tiles:insertTemplate name="${entry.url}" />
> or
>  <c:import url="${entry.url }"  />
> the same error occurs.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to