tag:blogger.com,1999:blog-5003701650524272230.post983802465891407658..comments2023-05-15T08:30:40.114-05:00Comments on Programming fun at startup: Jesey writing an authentication filterKalpesh Patelhttp://www.blogger.com/profile/05753943463214172718noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-5003701650524272230.post-37132734266655768852012-12-18T23:25:49.053-06:002012-12-18T23:25:49.053-06:00you dont really need to create a new instance for ...you dont really need to create a new instance for e.g. this url here the author is not create a new instance http://anismiles.wordpress.com/2012/03/02/securing-versioning-and-auditing-rest-jax-rs-jersey-apis/ of SecurityContextFilter in the factory. But I guess I had to use uriInfo that I was injecting in the factory and thats why I might have done it. I could have injected that in the filter also but not sure if its doable, will have to try it out.Kalpesh Patelhttps://www.blogger.com/profile/05753943463214172718noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-89020052257275771972012-12-18T01:12:17.460-06:002012-12-18T01:12:17.460-06:00Thank you very much for your response. Sorry for b...Thank you very much for your response. Sorry for being so precise, but as far as i know there is only one instance of ServletFilter in JVM loaded (it's according to Servlet 2.4 Spec 6.2.1 https://jira.sakaiproject.org/secure/attachment/16135/servlet-2_4-fr-spec.pdf)<br />therefore perhaps there is a request scope variable in jersey that contains invoked abstact method information. Once again thank you for your helpAzazellohttps://www.blogger.com/profile/09842896889566613506noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-14455278065362343252012-12-17T20:00:38.638-06:002012-12-17T20:00:38.638-06:00in this e.g. you could get away by reusing same fi...in this e.g. you could get away by reusing same filter but what if someone tomorrow comes and adds instance variables in the class then in that case there can be concurrency issues. so like ServletFilter even here I am creating a new instance.Kalpesh Patelhttps://www.blogger.com/profile/05753943463214172718noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-55277213304092491362012-12-17T17:56:50.974-06:002012-12-17T17:56:50.974-06:00Hi, thank you very much for sample code. May i que...Hi, thank you very much for sample code. May i question, why are you using new instance of Filter for each resource method? Are there some thread-safe issues here? Thank you very much in advanceAzazellohttps://www.blogger.com/profile/09842896889566613506noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-72269526537712209422012-10-08T14:32:54.685-05:002012-10-08T14:32:54.685-05:00BasicAuthHelper is just a class written by me, the...BasicAuthHelper is just a class written by me, the intent of the code was to just demonstrate the strucuture of writing a filter. Instead of BasicAuthHelper you can plug in your own class to authenticate the user.Kalpesh Patelhttps://www.blogger.com/profile/05753943463214172718noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-35361495874155121832012-10-08T11:21:13.666-05:002012-10-08T11:21:13.666-05:00what library need to be imported for BasicAuthHel...what library need to be imported for BasicAuthHelper?<br />ericnoreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-29083399065577338952012-08-07T15:50:31.907-05:002012-08-07T15:50:31.907-05:00Thanks for posting this article.It really saved my...Thanks for posting this article.It really saved my day. Also I have found this article here describe the usage of jersey resource filter .<br /><br />http://goo.gl/Pm7lsAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-30452791229552707052012-04-27T11:11:43.051-05:002012-04-27T11:11:43.051-05:00You have to inject the httpServletRequest in your ...You have to inject the httpServletRequest in your authfilterfactory and then get session from it.<br /><br />@Context<br />private HttpServletRequest httpServletRequest;Kalpesh Patelhttps://www.blogger.com/profile/05753943463214172718noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-54649115939811894832012-04-26T22:33:51.126-05:002012-04-26T22:33:51.126-05:00Hi. How do you get session from ContainerRequestHi. How do you get session from ContainerRequestVijayhttps://www.blogger.com/profile/05761197683643031037noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-67945738924006816812012-02-13T16:23:21.941-06:002012-02-13T16:23:21.941-06:00John unfortunately the code has some internal deta...John unfortunately the code has some internal details of the company I work for and I cant publish those. I would be though happy to answer any spefic questions you have.Kalpesh Patelhttps://www.blogger.com/profile/05753943463214172718noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-68713250154149481552012-02-13T08:21:05.137-06:002012-02-13T08:21:05.137-06:00Do you have a complete code example of your approa...Do you have a complete code example of your approach which you can publish?John Yearyhttps://www.blogger.com/profile/00461192445071361043noreply@blogger.comtag:blogger.com,1999:blog-5003701650524272230.post-31294151492521116932011-11-24T23:31:00.594-06:002011-11-24T23:31:00.594-06:00Thank you, your article save me :)Thank you, your article save me :)Anonymousnoreply@blogger.com