【发布时间】:2015-03-20 06:25:48
【问题描述】:
我对 JAX-RS 过滤器的实现如下,
请求过滤器是:
public class AuthorizationRequestFilter implements ContainerRequestFilter {
public static long entryTime;
@Override
public void filter(ContainerRequestContext requestContext)
throws IOException {
/*some preprocessing before unmarshalling*/
}
}
响应过滤器是:-
公共类 ResponseFilter 实现 ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
throws IOException {
if (!requestContext.getMethod().equalsIgnoreCase("Head")) {
/*Some processing after Marshalling*/
}
}
我的处理程序是:-
@POST
@Path("abc")
@Produces(MediaType.APPLICATION_XML)
public Response createABC(App app){
/*lines of code*/
return Response.status(Status.CRETED).entity(abc).build();
}
我的问题是在 Marshallling 和 Unmarshalling 之后调用的过滤器,即在方法 AuthorizationRequestFilter 和 abc 之后创建的应用程序对象在调用响应过滤器之前被编组
【问题讨论】:
标签: jaxb jax-rs marshalling unmarshalling