Search in sources :

Example 1 with ResourceReferenceHandlerChain

use of org.xwiki.resource.ResourceReferenceHandlerChain in project xwiki-platform by xwiki.

the class AbstractResourceReferenceHandlerManager method handle.

@Override
public void handle(ResourceReference reference) throws ResourceReferenceHandlerException {
    // Look for a Handler supporting the Resource Type located in the passed Resource Reference object.
    Set<ResourceReferenceHandler> orderedHandlers = getMatchingHandlers(extractResourceReferenceQualifier(reference));
    if (!orderedHandlers.isEmpty()) {
        // Create the Handler chain
        ResourceReferenceHandlerChain chain = new DefaultResourceReferenceHandlerChain(orderedHandlers, this.observation);
        // Call the first Handler
        chain.handleNext(reference);
    } else {
        // Resource has not been handled since no Handler was found for it!
        throw new NotFoundResourceHandlerException(reference);
    }
}
Also used : ResourceReferenceHandler(org.xwiki.resource.ResourceReferenceHandler) NotFoundResourceHandlerException(org.xwiki.resource.NotFoundResourceHandlerException) ResourceReferenceHandlerChain(org.xwiki.resource.ResourceReferenceHandlerChain)

Aggregations

NotFoundResourceHandlerException (org.xwiki.resource.NotFoundResourceHandlerException)1 ResourceReferenceHandler (org.xwiki.resource.ResourceReferenceHandler)1 ResourceReferenceHandlerChain (org.xwiki.resource.ResourceReferenceHandlerChain)1