Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@RolesAllowed, @PermitAll, etc Servlet . with Tomcat JDBC Realm

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends..

i've a doubt about Servlet and Tomcat JDBC Realm..
i've two user credential, manager and admin
assume that i've configured Tomcat JDBC Realm.. does realm recognized in Servlet?..

i've configured Servlet like this instance..


then how to get User's Role for used on Servlet?

Thanks in advance..
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me and correct me if iam wrong..

Yap, iam just greenhorn..
Thanks in advance...
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if @RolesAllowed can be used with Servlets or not. I think it is not supported on glassfish at least (reference). I think it will be supported after servlet 3.0 as given here. You can refer to this tutorial to see how to do this with configuration in web.xml file...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I can tell, the servlet API for 2.5 and earlier did not provide for any annotations. All configuration was via web.xml.

NOW - some projects, such as Jersey, used annotations but that was outside the servlet API.

Using annotations for configuration is one of the big jumps for servlet 3.0. Here is the JSR for servlet 3.0.

Where did you see RolesAllowed in use?

Bill
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any another way to configure roles in Servlet 2.5?..

i think i wanna save the role in Session.. (firstly, i save the role in Session when access Login Servlet)
and check it every access to Servlet.. .. yap, i think it's really "ticklish" to configure..
this is my implementation :


please correct me if i'm wrong..

Thanks in advance..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic