List of usage examples for javax.servlet HttpConstraintElement HttpConstraintElement
public HttpConstraintElement(EmptyRoleSemantic semantic, TransportGuarantee guarantee, String... roleNames)
From source file:com.jsmartframework.web.manager.ContextControl.java
private HttpConstraintElement getHttpConstraintElement(SecureMethod secureMethod) { HttpConstraintElement constraintElement = null; if (secureMethod.getEmptyRole() != null && secureMethod.getTransport() != null) { EmptyRoleSemantic emptyRole = getEmptyRoleSemantic(secureMethod.getEmptyRole()); TransportGuarantee transport = getTransportGuarantee(secureMethod.getTransport()); if (transport == null || emptyRole == null) { throw new RuntimeException( "Invalid transport or emptyRole attribute for [secure-method] tag! Values allowed are [confidential, none]."); }//from w w w . j a va 2 s . com constraintElement = new HttpConstraintElement(emptyRole, transport, secureMethod.getRoles() != null ? secureMethod.getRoles() : new String[] {}); } else if (secureMethod.getTransport() != null) { TransportGuarantee transport = getTransportGuarantee(secureMethod.getTransport()); if (transport == null) { throw new RuntimeException( "Invalid transport attribute for [secure-method] tag! Values allowed are [confidential, none]."); } constraintElement = new HttpConstraintElement(transport, secureMethod.getRoles() != null ? secureMethod.getRoles() : new String[] {}); } else if (secureMethod.getEmptyRole() != null) { EmptyRoleSemantic emptyRole = getEmptyRoleSemantic(secureMethod.getEmptyRole()); if (emptyRole == null) { throw new RuntimeException( "Invalid emptyRole attribute for [secure-method] tag! Values allowed are [deny, permit]."); } constraintElement = new HttpConstraintElement(emptyRole); } return constraintElement; }