use of com.sun.faces.lifecycle.HttpMethodRestrictionsPhaseListener in project mojarra by eclipse-ee4j.
the class WebConfiguration method doPostBringupActions.
public void doPostBringupActions() {
if (deferredLoggingActions != null) {
for (DeferredLoggingAction loggingAction : deferredLoggingActions) {
loggingAction.log();
}
}
// Add the HttpMethodRestrictionPhaseListener if the parameter is enabled.
boolean enabled = isOptionEnabled(BooleanWebContextInitParameter.EnableHttpMethodRestrictionPhaseListener);
if (enabled) {
LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
PhaseListener listener = null;
for (String lifecycleId : toIterable(factory.getLifecycleIds())) {
Lifecycle lifecycle = factory.getLifecycle(lifecycleId);
boolean foundExistingListenerInstance = false;
for (PhaseListener curListener : lifecycle.getPhaseListeners()) {
if (curListener instanceof HttpMethodRestrictionsPhaseListener) {
foundExistingListenerInstance = true;
break;
}
}
if (!foundExistingListenerInstance) {
if (listener == null) {
listener = new HttpMethodRestrictionsPhaseListener();
}
lifecycle.addPhaseListener(listener);
}
}
}
discoverResourceLibraryContracts();
}
Aggregations