Given an HttpServletRequest request and an EJB SessionContext ctx.
Which is a valid way to retrieve the Principal invoking either behavior?
Given an HttpServletRequest request and an EJB SessionContext ctx.
Which is a valid way to retrieve the Principal invoking either behavior?
The correct methods to retrieve the Principal from an HttpServletRequest and an EJB SessionContext are request.getUserPrincipal() and ctx.getCallerPrincipal() respectively. The HttpServletRequest method getUserPrincipal() retrieves the Principal associated with the request, while the EJB SessionContext method getCallerPrincipal() retrieves the Principal associated with the EJB invocation.
D is the correct syntax and awnser
D is the correct answer
Answer D