Search in sources :

Example 1 with ResourceReferenceHandlingEvent

use of org.xwiki.resource.events.ResourceReferenceHandlingEvent in project xwiki-platform by xwiki.

the class DefaultResourceReferenceHandlerChain method handleNext.

@Override
public void handleNext(ResourceReference reference) throws ResourceReferenceHandlerException {
    if (!this.handlerStack.isEmpty()) {
        ResourceReferenceHandler<?> handler = this.handlerStack.poll();
        if (this.observation != null) {
            this.observation.notify(new ResourceReferenceHandlingEvent(reference), handler);
        }
        ResourceReferenceHandlerException exception = null;
        try {
            handler.handle(reference, this);
        } catch (ResourceReferenceHandlerException e) {
            exception = e;
        } finally {
            if (this.observation != null) {
                this.observation.notify(new ResourceReferenceHandledEvent(reference), handler, exception);
            }
        }
        // Throw the exception if any
        if (exception != null) {
            throw exception;
        }
    }
}
Also used : ResourceReferenceHandlerException(org.xwiki.resource.ResourceReferenceHandlerException) ResourceReferenceHandlingEvent(org.xwiki.resource.events.ResourceReferenceHandlingEvent) ResourceReferenceHandledEvent(org.xwiki.resource.events.ResourceReferenceHandledEvent)

Aggregations

ResourceReferenceHandlerException (org.xwiki.resource.ResourceReferenceHandlerException)1 ResourceReferenceHandledEvent (org.xwiki.resource.events.ResourceReferenceHandledEvent)1 ResourceReferenceHandlingEvent (org.xwiki.resource.events.ResourceReferenceHandlingEvent)1