java - Jersey filter ContainerRequestContext with HttpServletRequest return nullpointer -
i injecting httpservletrequest containerrequestfilter . when trying use abort , getting nullppointerexception . @provider public class authorizationrequestfilter implements containerrequestfilter { @context httpservletrequest httprequest; @override public void filter(containerrequestcontext requestcontext ) throws ioexception { // string auth = requestcontext.getheaderstring("authorization"); uriinfo uriinfo = requestcontext.geturiinfo(); system.out.println(uriinfo.getpath()); //login request if (uriinfo.getpath().equals("resource/users/login")) { return ; } if (httprequest.isrequestedsessionidvalid()== true) { requestcontext.abortwith(response .status(response.status.unauthorized) .build()); } stacktrace :09:28 pm org.apache.catalina.core.standardwrappervalve invoke severe