File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes security-role-ref Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "security-role-ref" Watch "security-role-ref" New topic
Author

security-role-ref

Sharmila Punde
Ranch Hand

Joined: Dec 26, 2007
Posts: 133
Dear All,
What the method 'isUserInRole(String)' will return if <security-role-ref> does not exists into <servlet>.
Will it return false?
Thanks


Regards, Sharmila.
We will have a future if we save Nature!
Rohan kanade
Ranch Hand

Joined: Oct 22, 2009
Posts: 106
it first looks for mapping in the <security-role-ref> then it looks in the <security-role>
element.


SCJP 1.6 ,SCWCD 5
Gladwin Burboz
Greenhorn

Joined: Feb 26, 2008
Posts: 25

You can use a role name declared by a <security-role> rule as a parameter to the isUserInRole() method. For example, with the following snippet of a web.xml entry:



The servlet secret can call isUserInRole("mgr") or isUserInRole("manager") -- they will give the same behavior. Basically, security-role-ref acts to create an alias, but isn't necessary. That is what you'd naturally expect, but the API 2.2 specification could be interpreted as implying that you could only use roles explicitly declared in a <security-role-ref> alias rule. (If that doesn't make sense to you, don't worry about it; just be aware that things are now guaranteed to work as they should.)

Reference Article: Servlet 2.3: New features exposed , see - DTD Clarifications


<a href="http://www.sealordresortarnala.com" target="_blank" rel="nofollow">http://www.sealordresortarnala.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: security-role-ref