nerdexam
Oracle

1Z0-899 · Question #185

Which java code snippet roles "MANAGER" and "EMPLOYEE" in a given application? @DeclareRole("EMPLOYEE") public class MyServlet extends HttpServlet {}

The correct answer is A. @DeclareRoles({ "MANAGER", "EMPLOYEE" })public class MyServlet extends HttpServlet {}. The syntax for declaring more than one role is as shown in the following example: @DeclareRoles({"Administrator", "Manager", "Employee"}) This annotation declares the security roles defined by the application. javax.annotation.security Annotation Type DeclareRoles…

Security

Question

Which java code snippet roles "MANAGER" and "EMPLOYEE" in a given application? @DeclareRole("EMPLOYEE") public class MyServlet extends HttpServlet {}

Options

  • A@DeclareRoles({ "MANAGER", "EMPLOYEE" })public class MyServlet extends HttpServlet {}
  • B@SecurityRoles({ "MANAGER", "EMPLOYEE" })public class MyServlet extends HttpServlet {}
  • C@DeclareRoles("MANAGER")
  • D@DeclareRole("MANAGER")

How the community answered

(42 responses)
  • A
    76% (32)
  • B
    2% (1)
  • C
    14% (6)
  • D
    7% (3)

Explanation

  • The syntax for declaring more than one role is as shown in the following example: @DeclareRoles({"Administrator", "Manager", "Employee"}) This annotation declares the security roles defined by the application. * javax.annotation.security Annotation Type DeclareRoles @Retention(value=RUNTIME) @Target(value=TYPE) public @interface DeclareRoles Used by application to declare roles. It can be specified on a class.

Topics

#@DeclareRoles#security role declaration#servlet annotations#role configuration

Community Discussion

No community discussion yet for this question.

Full 1Z0-899 Practice