private void addSC(List<SecurityConstraintMetaData> securityContraints)
{
// security-constraint/ display-name = excluded
SecurityConstraintMetaData sc1 = new SecurityConstraintMetaData();
sc1.setDisplayName("excluded");
WebResourceCollectionMetaData wrcex = new WebResourceCollectionMetaData();
wrcex.setName("excluded");
sc1.getResourceCollections().add(wrcex);
// web-resource-collection/web-resource-name = No Access
wrcex.getUrlPatterns().add("/excluded/*");
wrcex.getUrlPatterns().add("/restricted/get-only/excluded/*");
wrcex.getUrlPatterns().add("/restricted/post-only/excluded/*");
wrcex.getUrlPatterns().add("/restricted/any/excluded/*");
wrcex.getUrlPatterns().add("/excluded/*");
// web-resource-collection/web-resource-name = No Access
WebResourceCollectionMetaData wrcna = new WebResourceCollectionMetaData();
wrcna.setName("No Access");
sc1.getResourceCollections().add(wrcna);
wrcna.getUrlPatterns().add("/restricted/*");
wrcna.getHttpMethods().add("DELETE");
wrcna.getHttpMethods().add("PUT");
wrcna.getHttpMethods().add("HEAD");
wrcna.getHttpMethods().add("OPTIONS");
wrcna.getHttpMethods().add("TRACE");
wrcna.getHttpMethods().add("GET");
wrcna.getHttpMethods().add("POST");
AuthConstraintMetaData excluded = new AuthConstraintMetaData();
sc1.setAuthConstraint(excluded);
UserDataConstraintMetaData none = new UserDataConstraintMetaData();
none.setTransportGuarantee(TransportGuaranteeType.NONE);
sc1.setUserDataConstraint(none);
// security-constraint/ display-name = unchecked
SecurityConstraintMetaData sc2 = new SecurityConstraintMetaData();
sc1.setDisplayName("unchecked");
WebResourceCollectionMetaData wrcun = new WebResourceCollectionMetaData();
wrcun.setName("Unchecked");
sc2.getResourceCollections().add(wrcun);
wrcun.getUrlPatterns().add("/unchecked/*");
wrcun.getUrlPatterns().add("/restricted/not/*");
wrcun.getHttpMethods().add("DELETE");
wrcun.getHttpMethods().add("PUT");
wrcun.getHttpMethods().add("HEAD");
wrcun.getHttpMethods().add("OPTIONS");
wrcun.getHttpMethods().add("TRACE");
wrcun.getHttpMethods().add("GET");
wrcun.getHttpMethods().add("POST");
// no auth-constraint
sc2.setAuthConstraint(null);
// user-data-constraint/transport-guarantee
sc2.setUserDataConstraint(none);