Given the resource class fragment:
Choose the code fragment below that would secure access only to the Resource update() method (Choose one):
A.
<security-constraint>
<web-resource-collection>
<url-pattern>/rest</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
B.
<security-constraint>
<web-resource-collection>
<url-pattern>/rest</url-pattern>
<http-method>POST</http-method>
</web-resource-collection>
C.
<security-constraint>
<web-resource-collection>
<url-pattern>/rest/id</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
D.
<security-constraint>D.<security-constraint>
<web-resource-collection>
<url-pattern>/id</url-pattern>
<http-method>POST</http-method>
</web-resource-collection>
In web.xml
/rest/id
POST
In java
@path(“id”)/{idValue}
@post
String update(@pathParam Integer idValue){
}
answer : B
example :
<security-constraint
<display-nameSecurityConstraintdisplay-name
<web-resource-collection
<web-resource-nameWRCollectionweb-resource-name
<url-pattern/hellourl-pattern
web-resource-collection
<auth-constraint
<role-namebasicUserrole-name
auth-constraint
<user-data-constraint
<transport-guaranteeNONEtransport-guarantee
user-data-constraint
security-constraint