|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ro.isdc.wro.model.resource.processor.impl.css.AbstractCssUrlRewritingProcessor
@SupportedResourceType(value=CSS) public abstract class AbstractCssUrlRewritingProcessor
A processor responsible for rewriting url's from inside the css resources.
Constructor Summary | |
---|---|
AbstractCssUrlRewritingProcessor()
|
Method Summary | |
---|---|
protected String |
cleanImageUrl(String imageUrl)
Cleans the image url by triming result and removing \' or \" characters if such exists. |
protected String |
getUrlPrefix()
This method has protected modifier in order to be accessed by unit test class. |
boolean |
isImportAware()
|
protected boolean |
isReplaceNeeded(String url)
Check if url must be replaced or not. |
protected CssUrlInspector |
newCssUrlInspector()
|
protected void |
onProcessCompleted()
Invoked when the process operation is completed. |
protected void |
onUrlReplaced(String replacedUrl)
Invoked when an url is replaced. |
void |
process(Reader reader,
Writer writer)
Perform actual resource processing. |
void |
process(Resource resource,
Reader reader,
Writer writer)
Process a content supplied by a reader and perform some sort of processing. |
protected String |
replaceDeclaration(String originalDeclaration,
String modifiedDeclaration)
Invoked to replace the entire css declaration. |
protected abstract String |
replaceImageUrl(String cssUri,
String imageUrl)
Replace provided url with the new url if needed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractCssUrlRewritingProcessor()
Method Detail |
---|
public void process(Reader reader, Writer writer) throws IOException
process
in interface ResourcePostProcessor
reader
- source stream.writer
- destination stream.
IOException
public final void process(Resource resource, Reader reader, Writer writer) throws IOException
Resource
, because
this way you can ignore the other preProcessors from the chain.RuntimeException
and the processing chain is interrupted (by default)WroConfiguration.isIgnoreFailingProcessor()
is true)
process
in interface ResourcePreProcessor
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.
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.protected CssUrlInspector newCssUrlInspector()
protected void onProcessCompleted()
protected String replaceDeclaration(String originalDeclaration, String modifiedDeclaration)
background: url(/image.png);Useful when the css declaration should be changed. The use-case is:
FallbackCssDataUriProcessor
.
originalDeclaration
- the original, unchanged declaration.modifiedDeclaration
- the changed expression.
protected void onUrlReplaced(String replacedUrl)
replacedUrl
- the newly computed url created as a result of url rewriting.protected abstract String replaceImageUrl(String cssUri, String imageUrl)
cssUri
- Uri of the parsed css.imageUrl
- to replace.
protected final String cleanImageUrl(String imageUrl)
imageUrl
- to clean.
protected boolean isReplaceNeeded(String url)
url
- to check.
protected String getUrlPrefix()
public boolean isImportAware()
isImportAware
in interface ImportAware
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |