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

 
 

Reply via email to