ro.isdc.wro.extensions.processor
Class PathPatternProcessorDecorator

java.lang.Object
  extended by ro.isdc.wro.util.AbstractDecorator<T>
      extended by ro.isdc.wro.model.resource.processor.decorator.AbstractProcessorDecoratorSupport<ResourcePreProcessor>
          extended by ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator
              extended by ro.isdc.wro.extensions.processor.PathPatternProcessorDecorator
All Implemented Interfaces:
ImportAware, MinimizeAware, ResourcePostProcessor, ResourcePreProcessor, SupportAware, SupportedResourceTypeAware, ObjectDecorator<ResourcePreProcessor>

public final class PathPatternProcessorDecorator
extends ProcessorDecorator

A ProcessorDecorator with Ant path style support. This processor requires AntPathMatcher provided by spring framework.

The implementation is inspired from mwa project created by Edgar Espina.

Since:
1.5.0
Author:
Alex Objelean

Method Summary
static PathPatternProcessorDecorator exclude(Object processor, String... patterns)
          Decorates a processor which will not be applied on provided patterns.
static PathPatternProcessorDecorator include(Object processor, String... patterns)
          Decorates a processor which will be applied on provided patterns.
 void process(Resource resource, Reader reader, Writer writer)
          Process a content supplied by a reader and perform some sort of processing.
 String toString()
          
 
Methods inherited from class ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator
isEligible, isEnabled
 
Methods inherited from class ro.isdc.wro.model.resource.processor.decorator.AbstractProcessorDecoratorSupport
getSupportedResourceType, getSupportedResourceTypeInternal, getSupportedResourceTypes, isImportAware, isMinimize, isMinimizeInternal, isSupported, process
 
Methods inherited from class ro.isdc.wro.util.AbstractDecorator
getDecoratedObject, getOriginalDecoratedObject, getOriginalDecoratedObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

include

public static PathPatternProcessorDecorator include(Object processor,
                                                    String... patterns)
Decorates a processor which will be applied on provided patterns.

Parameters:
processor - The processor to decorate.
patterns - an array of patterns on which the processor will be applied.
Returns:
decorated processor.

exclude

public static PathPatternProcessorDecorator exclude(Object processor,
                                                    String... patterns)
Decorates a processor which will not be applied on provided patterns.

Parameters:
processor - The processor to decorate.
patterns - an array of patterns on which the processor will not be applied.
Returns:
decorated processor.

process

public void process(Resource resource,
                    Reader reader,
                    Writer writer)
             throws IOException
Process a content supplied by a reader and perform some sort of processing. It is important to know that you should use reader for processing instead of trying to access the resource original content using Resource, because this way you can ignore the other preProcessors from the chain.
It is not require to explicitly handle exception. When the processing fails, the following can happen:
It is not required to close the reader and writers, because these will be closed for you.

Specified by:
process in interface ResourcePreProcessor
Overrides:
process in class ProcessorDecorator
Parameters:
resource - the original resource as it found in the model.
reader - Reader used to read processed resource content.
writer - Writer where used to write processed results.
Throws:
IOException - when an exception occurs. The future version will change the exception type to Exception, because any exception may occur during processing. The processing failure will be handled based on value of WroConfiguration.isIgnoreFailingProcessor() configuration flag.

toString

public String toString()

Overrides:
toString in class ProcessorDecorator


Copyright © 2008-2013. All Rights Reserved.