Announcement Announcement Module
Collapse
No announcement yet.
Work-around needed to prevent recursive look up of resource due to mapping Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Work-around needed to prevent recursive look up of resource due to mapping

    I am facing stackoverflow error due to a recursive look up.

    Mapping we need to have is:

    Web.xml part:
    Code:
    	<servlet-mapping>
    		<servlet-name>dispatcher</servlet-name>
     		<url-pattern>*.html</url-pattern> 
    	</servlet-mapping>
    In dispatcher-servlet.xml:

    Code:
    	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"
    		p:prefix="/static/html/" p:suffix=".html" p:order="1" />
    When I access my application like this using :
    Code:
    http://mymachine:7001/myapp/root.html
    I am getting a blank page and my code is going into an infinite loop:

    Code:
    <Error> <HTTP> <BEA-101107> <[ServletContext@630131[app:xxx module:xxx path:/xxx spec-version:2.5]] Problem occurred while serving the error page.
    java.lang.StackOverflowError
    	at org.springframework.web.util.UrlPathHelper.decodeRequestString(UrlPathHelper.java:338)
    	at org.springframework.web.util.UrlPathHelper.getContextPath(UrlPathHelper.java:225)
    	at org.springframework.web.util.UrlPathHelper.getPathWithinApplication(UrlPathHelper.java:175)
            .................. 
            ..................
    This was working fine when the web.xml part was:

    Code:
    	<servlet-mapping>
    		<servlet-name>dispatcher</servlet-name>
     		<url-pattern>*.do</url-pattern> 
    	</servlet-mapping>
    For few refactoring, we need to have the mapping as explained initially but we are getting into recursive look up for html and so stackoverflow error.


    Is there any work around to prevent this ?
    Can we write a custom ViewResolver by extending the InternalResourceViewResolver and modify the URL so that we dont get into infinite loop ?
Working...
X