Even if I create a separate spring MVC servlet that delegates to the JSP, after spring MVC has processed the request and forwarded to the JSP, my jaxrs:server JAXRSInInterceptor still tries to intercept and process the /WEB-INF/jsp/test.jsp URL and throws a method not found error.
Any clues on how to prevent this ? -----Original Message----- From: Paul Wilton [mailto:[email protected]] Sent: 04 January 2010 15:08 To: [email protected] Subject: RE: another question on RequestDispatcherProvider okay - I have a two jaxrs:server beans configured on different URLS, It seems when the first one completes the other is picking up the forward from the first one... very confusing. -----Original Message----- From: Paul Wilton [mailto:[email protected]] Sent: 04 January 2010 14:17 To: [email protected] Subject: RE: another question on RequestDispatcherProvider Just to follow up on this, here is a thread dump showing the call stack at the point the WARNIGN message is output. You can see how the forward is being recycled through the JAXRSInInterceptor chain after the RequestDispatcherProvider.writeTo() method has successfully delegated (forwarded) to the JSP. http-808...@7 daemon, prio=5, in group 'main', status: 'runnable' java.lang.Thread.State: RUNNABLE at org.apache.cxf.jaxrs.utils.JAXRSUtils.logNoMatchMessage(JAXRSUtils.java:381) at org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:337) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:148) at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:63) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:394) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:133) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org.apache.cxf.jaxrs.provider.RequestDispatcherProvider.writeTo(RequestDispatcherProvider.java:104) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:232) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:137) at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:77) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:76) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:394) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:133) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Thread.java:619) -----Original Message----- From: Paul Wilton [mailto:[email protected]] Sent: 04 January 2010 14:10 To: [email protected] Subject: another question on RequestDispatcherProvider I am experiencing some unexpected behaviour when using RequestDispatcherProvider to delegate a request to a JSP After the service method has been executed the writeTo method on the RequestDispatcherProvider is invoked, and correctly forwards to my JSP using javax.servlet.RequestDispatcher.forward(request,response) However at that point, somewhere during/after the forward, the JAXRSOutInterceptor picks up the forwarded request (the JSP path) as if it's a redirect and throws a 404 error trying to martch the forward against one of its JAX-RS patterns: "No operation matching request path /WEB-INF/jsp/test.jsp is found" I would have expected the response from the forward to be returned directly to the client - but it somehow seems to be being recycled (redirected) back into the JAX-RS interceptor chain. I am using CXF 2.2.5 Wiring as follows: <jaxrs:server id="testRestServer" address="/test/"> <jaxrs:serviceBeans> <ref bean="testServer"/> </jaxrs:serviceBeans> <jaxrs:providers> <ref bean="dispatchProvider1"/> </jaxrs:providers> </jaxrs:server> <bean id="dispatchProvider1" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider"> <property name="resourcePath" value="/WEB-INF/jsp/test.jsp"/> <property name="scope" value="request"/> </bean> <bean id="testServer" class="my.package.TestServer" /> public class TestServer { @GET @Path("/test") public Test getTest() { Test test = new test("hello world"); return test; } } On requesting GET /test/test The method TestServer.getTest() is being invoked and the RequestDispatcherProvider subsequently calls RequestDispactyer.forward() to the /WEB-INF/jsp/test.jsp (which renders the message from the Test object) However, I am then subsequently getting an error : Jan 4, 2010 1:51:31 PM org.apache.cxf.jaxrs.utils.JAXRSUtils findTargetMethod WARNING: .No operation matching request path /WEB-INF/jsp/test.jsp is found As the forward is recycled through the JAXRS interceptor as a redirect or incoming request, resulting in a 404. This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this This e-mail has been sent by one of the following wholly-owned subsidiaries of the BBC: BBC Worldwide Limited, Registration Number: 1420028 England, Registered Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ BBC World News Limited, Registration Number: 04514407 England, Registered Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ BBC World Distribution Limited, Registration Number: 04514408, Registered Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
