1Z0-899 · Question #189
Which java code snippet checks whether the user is of the role "MANAGER" for a given HttpServRequest, httpServletRequest?
The correct answer is A. httpServletRequest.isUserInRole("MANAGER"). public boolean isUserInRole(java.lang.String role) Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method…
Question
Options
- AhttpServletRequest.isUserInRole("MANAGER");
- BhttpServletRequest.isCallerInRole("MANAGER");
- ChttpServletRequest.isPrincipalInRole("MANAGER");
- DhttpServletRequest.isAuthnticatedUserInRole("MANAGER");
How the community answered
(53 responses)- A77% (41)
- B15% (8)
- C6% (3)
- D2% (1)
Explanation
public boolean isUserInRole(java.lang.String role) Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false. role - a String specifying the name of the role a boolean indicating whether the user making this request belongs to a given role; false if the user has not been authenticated Not B: isCallerInRole is depreciated.
Topics
Community Discussion
No community discussion yet for this question.