This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes @RolesAllowed, @PermitAll, etc Servlet . with Tomcat JDBC Realm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Servlets
Bookmark "@RolesAllowed, @PermitAll, etc Servlet . with Tomcat JDBC Realm" Watch "@RolesAllowed, @PermitAll, etc Servlet . with Tomcat JDBC Realm" New topic

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

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

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..

Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Please help me and correct me if iam wrong..

Yap, iam just greenhorn..
Thanks in advance...
Ankit Garg

Joined: Aug 03, 2008
Posts: 9405

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...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13001
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?

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

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..
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: @RolesAllowed, @PermitAll, etc Servlet . with Tomcat JDBC Realm
It's not a secret anymore!