0

Why am I getting resourceInfo as null in this. Is there any other way to get resource class and resource method?

@Provider
@Authenticate
@Transactional
public class TestFilter2 implements ContainerRequestFilter {

  private final SessionRepository sessionRepository;

  @Context
  public ResourceInfo resourceInfo;

  @Inject
  public TestFilter2(SessionRepository sessionRepository) {
    this.sessionRepository = sessionRepository;
  }

  @Override
  public void filter(ContainerRequestContext requestContext) throws IOException {
    check();
  }


  private void check() {
    sessionRepository.getActiveSessionBySessionId("dsfsdf");

  }
}
Nipun Garg
  • 628
  • 2
  • 8
  • 22

1 Answers1

-1

@context annotation doesn't allow you to inject ResourceInfo type, here are the types that you can inject using @context :

  • SecurityContext
  • Request
  • ResourceContext
  • ServletConfig
  • ServletContext
  • HttpServletRequest
  • HttpServletResponse
  • HttpHeaders
  • UriInfo
Mohamed Ali RACHID
  • 3,245
  • 11
  • 22