cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Wolf <cwolf.a...@gmail.com>
Subject How to inject fake HttpServletRequest/HttpServletResponse in local transport?
Date Wed, 15 Jul 2015 00:20:19 GMT
For legacy reasons, all of the resource methods in the project I'm
working on have a signature similar to:

    @GET
    @Path("/book")
    public Response getBook(@Context HttpServletRequest request,
            @Context HttpServletResponse response);


When I change to local transport (to save runtime setup of Jetty in
unit tests), these parameters are null, which makes sense since the
protocol is not HTTP.  I tried implementing a custom Interceptor to
replace Message content with a two element list containing mock
HttpServletRequest and HttpServletResponse , but I couldn't find the
correct phase.

(the mocks are from mockrunner-servlet)

Now I'm thinking it might be easier with a custom invoker, as
mentioned at the bottom of this page:

http://cxf.apache.org/docs/jax-rs-filters.html

I downloaded the source tarball and found the source at:

https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob;f=systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomJAXRSInvoker.java;h=cce0f048d1c9f1b12925725b9def7730a4aa01ff;hb=HEAD

...but now I can't find any other java module that would show how to
configure this custom invoker.  Apologies if I missed it online, but
could find nothing.

Thanks,

Chris

Mime
View raw message