Hi Team,
I got CXF2.7.3 installed in today and was trying to get hands on with
ContainerRequest and Response Filter
I have problems in getting the following changes working
*1. Change the URI in ContainerRequestFilter*
I wrote a simple filter class, turned on prematching, and added that
as a provider in the xml file. I wrote the following two lines in the filter
method
/URI redirectURI = new URI(uriInfo.getBaseUri().toString());
reqCtx.setRequestUri(redirectURI);/
Any uri that I give here I always get an exception
"javax.ws.rs.NotFoundException" even though the resource method is there
Not sure what is wrong.
*Replace request body in container request filter*
I replaced the entity stream inside the filter, but still the request body
that is posted with the request is being picked up and not the entity stream
that i replaced in the filter.
reqCtx.setEntityStream(new ByteArrayInputStream(str.getBytes()));
*ContainerResponseFilter:*
I created a custom name binding for the filter and it worked with
charm. I thought of returning an object in the resource method and in the
filter forward that to the jsp page based on the custom annotation.
@Path("/mvcfilter/")
@GET
@Produces(MediaType.TEXT_HTML)
@MVCTemplate
public DemoBean mvcfilter() {
DemoBean bean = new DemoBean();
return bean;
}
in the filter ,
Response res = Response.ok(RedirectionStatus.LOGIN_SUCCESS).
entity(responseContext.getEntity()).build();
responseContext.setEntity(res,
responseContext.getEntityAnnotations(),
responseContext.getMediaType());
I thought of using the enum way to redirect the response to jsp page. But I
got "No MessageBodyWriter found for ResponseImpl" The fillter is being
picked up but not sure whether i can do this or not
Can some one please help me out to resove these issues?
--
View this message in context:
http://cxf.547215.n5.nabble.com/Not-able-to-change-uri-in-ContainerrequestFilter-CXF2-7-3-tp5723617.html
Sent from the cxf-user mailing list archive at Nabble.com.