Page 1 of 1

About Question enthuware.jwpv6.2.645

Posted: Sat Jun 01, 2013 7:28 am
by dsemionov
Hello,

It seems that there is a mistake in question. From the following code we can see that there should be compilation error:

HttpConstraintElement constraint = new HttpConstraintElement(TransportGuarantee.NONE, new String[]{"employee"});
List<HttpMethodConstraintElement> methodConstraints = new ArrayList<HttpMethodConstraintElement>();
methodConstraints.add(new HttpMethodConstraintElement("GET", constraint ));
ServletSecurityElement servletSecurity = new ServletSecurityElement(constraint, methodConstraints);

ServletRegistration.Dynamic sd = ctx.addServlet("dynamicServlet", myDynamicServletClass);
sd.addMapping("/dynamic");
sd.setServletSecurity(myServletSecurity);
sd.addMapping("/secureDynamic");

There is no reference with name "myServletSecurity" created, instead of it there is "servletSecurity" created. So the correct answer chould be "None of these" instead of "A user must be in employee role to access /dynamic but not /secureDynamic through HTTP GET method.".

BR,
Dmitrij

Re: About Question enthuware.jwpv6.2.645

Posted: Sat Jun 01, 2013 9:45 am
by admin
You are right. It should be servletSecurity. This has now been fixed.

thank you for your feedback!