ro.isdc.wro.model.resource.processor.decorator
Class CopyrightKeeperProcessorDecorator
java.lang.Object
ro.isdc.wro.util.AbstractDecorator<T>
ro.isdc.wro.model.resource.processor.decorator.AbstractProcessorDecoratorSupport<ResourcePreProcessor>
ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator
ro.isdc.wro.model.resource.processor.decorator.CopyrightKeeperProcessorDecorator
- All Implemented Interfaces:
- ImportAware, MinimizeAware, ResourcePostProcessor, ResourcePreProcessor, SupportAware, SupportedResourceTypeAware, ObjectDecorator<ResourcePreProcessor>
public class CopyrightKeeperProcessorDecorator
- extends ProcessorDecorator
Inspects the resource for copyright (licence) header and inserts them back if the decorated processor removes them.
The decorated processor does the compression logic and probably removes copyright comments. If copyright comments are
removed, our processor will put them back.
- Since:
- 1.3.7
- Author:
- Alex Objelean
decorate
public static CopyrightKeeperProcessorDecorator decorate(ResourcePreProcessor preProcessor)
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.
Copyright © 2008-2013. All Rights Reserved.