Hi,
The auth-constraint apply to the combination of URL
pattern + http method.
The access permission is granted to the user/roles definded in the <auth-constraint> for the combination of url pattern and http method. Here there is no http-method definded. so the access granted to URL Pattern + ALL http methods.
It is equivalent to
<url-pattern>/acme/retail/*</url-pattern>
<http-method>GET</hhtp-method>
<http-method>POST</hhtp-method>
<http-method>PUT</hhtp-method>
<http-method>TRACE</hhtp-method>
<http-method>HEAd</hhtp-method>
<http-method>OPTION</hhtp-method>
..... ALL HTTP METHODS ......
My point is that if no http-method specified, It assume that all the methods are constraints and give permission to only the role name defined in the <auth-constraint> sub-entry.
If you specify only one http-method say POST. Any user can access the resource without any authentication for the http-method other than POST. Even the container does not display your authentication screen for these methods as your resource is not secure for these methods. But for the POST method, the user must be authenticated and must be match to the role names specified in the <auth-constraint>.
Also you can access the resource, if the corresponding doXXX method defined in the
servlet. If other methods in the Servlet other than POST is not implemented, then there is no use to apply constaint for all methods in most of cases as the default implementation throw exception.
Hope this help
Thanks
Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0