I don't know how to pass object data from container request filter to any other resources, by using CDI, because I cannot get my data in the resource. Any idea?
@Provider
public class AuthFilter implements ContainerRequestFilter {
@Inject
private SomeBean bean;
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
bean.setData("test");
}
}
@ManagedBean
@RequestScoped
public class SomeBean
{
private String data;
public String getData() {
return data;
}
}
And in my resource class I have the following:
@Inject
private SomeBean bean;
@GET
public Response someMethod() {
return Response.ok(bean.getData()).build();
}