aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt regarding request.isUserInRole() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Doubt regarding request.isUserInRole()" Watch "Doubt regarding request.isUserInRole()" New topic
Author

Doubt regarding request.isUserInRole()

Mohit Chadha
Ranch Hand

Joined: Feb 04, 2007
Posts: 264
Hi
Following is a question from a Mock exam.

Consider the following web.xml code snippet:

<servlet>
<servlet-name>BankServlet</servlet-name>
<servlet-class>com.abc.bankapp.BankServlet</servlet-class>
<security-role-ref>
<role-name>manager</role-name>
<role-link>supervisor</role-link>
</security-role-ref>
</servlet>

Which of the following statements are correct?
1)The servlet code should use "manager" as a parameter in request.isUserInRole() method.
2)The servlet code can use "manager" or "supervisor" as a parameter in request.isUserInRole() method.
3)The servlet code should use"supervisor" as a parameter in request.isUserInRole() method.
4)The role of "manager" must be defined in the servlet container.
5)None of these.

The answer is (1), but I think the answer should be (2) as we are using <security-role-ref> we will be declaring
<security-role>
<role-name>supervisor</role-name>
</security-role>
and hence we can call request.isUserInRole() with "manager" or "supervisor" as a parameter.
Please correct me if I am wrong.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

I would say 1 and 2. You should use "manager", but you can use "supervisor" (but it's not a good practice)


[My Blog]
All roads lead to JavaRanch
Mohit Chadha
Ranch Hand

Joined: Feb 04, 2007
Posts: 264
Thanks Satou!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Doubt regarding request.isUserInRole()
 
Similar Threads
role-link
Practice exam question
[jdiscuss][mock][question]
doubt in security role ref
Programatic Security?