Available since OmniFaces 1.2
This configuration enum parses the
/WEB-INF/web.xml and all
/META-INF/web-fragment files found in the classpath and offers methods to obtain information from them which is not available by the standard Servlet API.
// Get the <welcome-file-list> (which are essentially path-relative filenames which needs to be served when a folder is requested). List<String> welcomeFiles = WebXml.INSTANCE.getWelcomeFiles();
// Get a mapping of all error page locations by exception type (a key of null represents the default error page location, if any). Map<Class<Throwable>, String> errorPageLocations = WebXml.INSTANCE.getErrorPageLocations();
// Get the <form-login-page> (which is a context-relative URL to the login page of FORM based authentication). String formLoginPage = WebXml.INSTANCE.getFormLoginPage();
// Get a mapping of all <security-constraint> URL patterns and associated roles. Map<String, Set<String>> securityConstraints = WebXml.INSTANCE.getSecurityConstraints();
// Check if access to certain (context-relative) URL is allowed for the given role based on <security-constraint>. boolean accessAllowed = WebXml.INSTANCE.isAccessAllowed("/admin.xhtml", "admin");
// Get web.xml configured session timeout (in seconds). int sessionTimeout = WebXml.INSTANCE.getSessionTimeout();
If you know more useful methods/functions which you think should be added to this OmniFaces utility class so that everyone can benefit from a "standard" JSF utility library, feel free to post a feature request.