ro.isdc.wro.model.resource.processor.impl.css
Class CssDataUriPreProcessor
java.lang.Object
ro.isdc.wro.model.resource.processor.impl.css.AbstractCssUrlRewritingProcessor
ro.isdc.wro.model.resource.processor.impl.css.CssDataUriPreProcessor
- All Implemented Interfaces:
- ResourcePostProcessor, ResourcePreProcessor
- Direct Known Subclasses:
- DuplicatesAwareCssDataUriPreProcessor
public class CssDataUriPreProcessor
- extends AbstractCssUrlRewritingProcessor
Rewrites background images by replacing the url with data uri of the image. If the replacement is not successful, it
is left unchanged.
For more details, @see http://en.wikipedia.org/wiki/Data_URI_scheme
- Author:
- Alex Objelean
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ALIAS
public static final String ALIAS
- See Also:
- Constant Field Values
CssDataUriPreProcessor
public CssDataUriPreProcessor()
replaceImageUrl
protected String replaceImageUrl(String cssUri,
String imageUrl)
- Replace provided url with the new url if needed.
- Specified by:
replaceImageUrl in class AbstractCssUrlRewritingProcessor
- Parameters:
imageUrl - to replace.cssUri - Uri of the parsed css.
- Returns:
- replaced url.
replaceWithDataUri
protected boolean replaceWithDataUri(String dataUri)
throws UnsupportedEncodingException
- Decides whether the computed dataUri should replace the image url. It is useful when you want to limit the dataUri size.
By default the size of dataUri is limited to 32KB (because IE8 has a 32KB limitation).
- Parameters:
dataUri - base64 encoded stream.
- Returns:
- true if dataUri should replace original image url.
- Throws:
UnsupportedEncodingException
isReplaceNeeded
protected boolean isReplaceNeeded(String url)
- Check if url must be replaced or not.
- Overrides:
isReplaceNeeded in class AbstractCssUrlRewritingProcessor
- Parameters:
url - to check.
- Returns:
- true if url needs to be replaced or remain unchanged.
Copyright © 2008-2011. All Rights Reserved.