Hi all,
I'm facing following problem - InternalResourceViewResolver forwards to WEB-INF.
There is following configuration of dispatcher-servlet:
Code:<?xml version="1.0" encoding="UTF-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <context:property-placeholder location="classpath:/META-INF/*.properties"/> <context:component-scan base-package="lt.emc.imokos"/> <mvc:annotation-driven/> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="${application.jsp.preffix}"/> <property name="suffix" value="${application.jsp.suffix}"/> </bean> <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props> <prop key="org.springframework.beans.TypeMismatchException">error/typeMismatch</prop> <prop key="lt.emc.imokos.service.exception.DataServiceExeption">error/dataService</prop> <prop key="java.io.FileNotFoundException">error/fileNotFound</prop> <prop key="java.io.IOException">error/io</prop> <prop key="org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException"> error/404 </prop> <prop key="org.springframework.web.HttpRequestMethodNotSupportedException">error/405</prop> <prop key="org.springframework.web.bind.MissingServletRequestParameterException">error/400</prop> <prop key="org.springframework.beans.ConversionNotSupportedException">error/500</prop> <prop key="java.lang.Exception">error/index</prop> </props> </property> </bean> </beans>Code:<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>ImokosReport</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:/META-INF/application.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
As I understand - SimpleMappingExceptionResolver should cache exceptions that are mapped to specific view and forward to them. InternalResourceViewResolver should forward there viewes to the internal - in my case it would be with prefix /WEB-INF/view/ and suffix .jsp but somehow it tries to forward me to these views directly:
I'm facing this problem with Spring 3.0.5 release. It seems that problem with configuration but I cant understand where...Code:2011-04-19 15:27:55,187 DEBUG (AbstractView.java:328) - Added model object 'exception' of type [org.springframework.core.convert.ConversionFailedException] to request in view with name 'error/index' 2011-04-19 15:27:55,203 DEBUG (InternalResourceView.java:237) - Forwarding to resource [/WEB-INF/view/jsp/error/index.jsp] in InternalResourceView 'error/index' 2011-04-19 15:27:55,203 DEBUG (DispatcherServlet.java:842) - DispatcherServlet with name 'dispatcher' determining Last-Modified value for [/ImokosReport/WEB-INF/view/jsp/error/index.jsp] 2011-04-19 15:27:55,203 DEBUG (DispatcherServlet.java:939) - Testing handler map [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping@a36771] in DispatcherServlet with name 'dispatcher' 2011-04-19 15:27:55,203 DEBUG (AbstractUrlHandlerMapping.java:222) - No handler mapping found for [/WEB-INF/view/jsp/error/index.jsp] 2011-04-19 15:27:55,203 DEBUG (DispatcherServlet.java:850) - No handler found in getLastModified 2011-04-19 15:27:55,203 DEBUG (FrameworkServlet.java:643) - Bound request context to thread: org.apache.catalina.core.ApplicationHttpRequest@8032df 2011-04-19 15:27:55,203 DEBUG (DispatcherServlet.java:690) - DispatcherServlet with name 'dispatcher' processing GET request for [/ImokosReport/WEB-INF/view/jsp/error/index.jsp] 2011-04-19 15:27:55,203 DEBUG (DispatcherServlet.java:939) - Testing handler map [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping@a36771] in DispatcherServlet with name 'dispatcher' 2011-04-19 15:27:55,203 DEBUG (AbstractUrlHandlerMapping.java:222) - No handler mapping found for [/WEB-INF/view/jsp/error/index.jsp] 2011-04-19 15:27:55,203 WARN (DispatcherServlet.java:962) - No mapping found for HTTP request with URI [/ImokosReport/WEB-INF/view/jsp/error/index.jsp] in DispatcherServlet with name 'dispatcher'
Thanks in advice,
Kiril



Reply With Quote
