About Question enthuware.jwpv6.2.645

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
dsemionov
Posts: 1
Joined: Sat Jun 01, 2013 7:06 am
Contact:

About Question enthuware.jwpv6.2.645

Post 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

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.645

Post by admin »

You are right. It should be servletSecurity. This has now been fixed.

thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests