ro.isdc.wro.model.resource.processor
Interface ResourcePreProcessor

All Known Implementing Classes:
AbstractCssImportPreProcessor, AbstractCssUrlRewritingProcessor, AbstractLinterProcessor, AbstractNodeWithFallbackProcessor, AbstractProcessorDecorator, AbstractProcessorDecoratorSupport, BeautifyJsProcessor, BenchmarkProcessorDecorator, BourbonCssProcessor, CJsonProcessor, CoffeeScriptProcessor, CommentStripperProcessor, ConformColorsCssProcessor, ConsoleStripperProcessor, CopyrightKeeperProcessorDecorator, CssCompressorProcessor, CssDataUriPreProcessor, CssImportPreProcessor, CssLintProcessor, CssMinProcessor, CssUrlRewritingProcessor, CssVariablesProcessor, DefaultProcessorDecorator, DojoShrinksafeCompressorProcessor, DuplicatesAwareCssDataUriPreProcessor, DustJsProcessor, EmberJsProcessor, ExceptionHandlingProcessorDecorator, ExtensionsAwareProcessorDecorator, FallbackCssDataUriProcessor, GoogleClosureCompressorProcessor, HandlebarsJsProcessor, HoganJsProcessor, ImportAwareProcessorDecorator, JawrCssMinifierProcessor, JsHintProcessor, JsLintProcessor, JSMinProcessor, JsonHPackProcessor, JsTemplateCompilerProcessor, LazyProcessorDecorator, Less4jProcessor, LessCssImportPreProcessor, LessCssProcessor, MinimizeAwareProcessorDecorator, MultiLineCommentStripperProcessor, NodeCoffeeScriptProcessor, NodeLessCssProcessor, NodeTypeScriptProcessor, PackerJsProcessor, PathPatternProcessorDecorator, PlaceholderProcessor, ProcessorDecorator, RhinoCoffeeScriptProcessor, RhinoLessCssProcessor, RhinoTypeScriptProcessor, RubySassCssProcessor, SassCssProcessor, SemicolonAppenderPreProcessor, SingleLineCommentStripperProcessor, SupportAwareProcessorDecorator, TypeScriptProcessor, UglifyJsProcessor, VariablizeColorsCssProcessor, YUICssCompressorProcessor

public interface ResourcePreProcessor

Perform actual processing of the resource content from the Reader and writes the processed content to the Writer. The processor should focus only on transformation. If a processing fails, it is preferred to propagate the exception, because wro4j can allow custom behavior for this situation. It is possible to treat the exceptions by leaving the processed output unchanged, but in this case you may not benefit of global configuration.

Author:
Alex Objelean

Method Summary
 void process(Resource resource, Reader reader, Writer writer)
          Process a content supplied by a reader and perform some sort of processing.
 

Method Detail

process

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.

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.