|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectro.isdc.wro.model.resource.processor.impl.css.AbstractCssUrlRewritingProcessor
ro.isdc.wro.model.resource.processor.impl.css.CssUrlRewritingProcessor
public class CssUrlRewritingProcessor
CssUrlRewritingProcessor.
The algorithm requires two types of UriLocator objects, one for resolving url resources & one for
classpathresources. Both need to be injected using IoC when creating the instance of CssUrlRewritingProcessor
class.
Rewrites background images url of the provided css content. This implementation takes care of most common cases such as those described bellow:
| Css resource URI | Image URL | Computed Image URL |
|---|---|---|
| ANY | [URL]/1.jpg | [URL]/1.jpg |
| /1.css | /a/1.jpg | /a/1.jpg |
| /1.jpg | /1.jpg | |
| 1.jpg | ../1.jpg | |
| ../1.jpg | ../../1.jpg | |
| /WEB-INF/1.css | /a/1.jpg | /a/1.jpg |
| /1.jpg | /1.jpg | |
| 1.jpg | [WRO-PREFIX]?id=/WEB-INF/1.jpg | |
| ../1.jpg | [WRO-PREFIX]?id=/WEB-INF/../1.jpg | |
| [X]/1.css where [X] is URL or a classpath resource where [WRO-PREFIX] is a servletContext prefix which will map WRO filter to the result url. |
/a/1.jpg | [WRO-PREFIX]?id=[X]/a/1.jpg |
| /1.jpg | [WRO-PREFIX]?id=[X]/1.jpg | |
| 1.jpg | [WRO-PREFIX]?id=[X]/1.jpg | |
| ../1.jpg | [WRO-PREFIX]?id=[X]/../1.jpg |
| Field Summary | |
|---|---|
static String |
ALIAS
|
static String |
PARAM_RESOURCE_ID
The name of resource id parameter. |
static String |
PATH_RESOURCES
Resources mapping path. |
| Fields inherited from class ro.isdc.wro.model.resource.processor.impl.css.AbstractCssUrlRewritingProcessor |
|---|
PATTERN |
| Constructor Summary | |
|---|---|
CssUrlRewritingProcessor()
|
|
| Method Summary | |
|---|---|
protected String |
getUrlPrefix()
This method has protected modifier in order to be accessed by unit test class. |
boolean |
isUriAllowed(String uri)
|
protected void |
onProcessCompleted()
Invoked when the process operation is completed. |
protected void |
onUrlReplaced(String replacedUrl)
Invoked when an url is replaced. |
protected String |
replaceImageUrl(String cssUri,
String imageUrl)
Replace provided url with the new url if needed. |
| Methods inherited from class ro.isdc.wro.model.resource.processor.impl.css.AbstractCssUrlRewritingProcessor |
|---|
cleanImageUrl, isReplaceNeeded, process, process |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ALIAS
public static final String PATH_RESOURCES
public static final String PARAM_RESOURCE_ID
| Constructor Detail |
|---|
public CssUrlRewritingProcessor()
| Method Detail |
|---|
protected void onProcessCompleted()
onProcessCompleted in class AbstractCssUrlRewritingProcessorprotected void onUrlReplaced(String replacedUrl)
onUrlReplaced in class AbstractCssUrlRewritingProcessorreplacedUrl - the newly computed url created as a result of url rewriting.
protected String replaceImageUrl(String cssUri,
String imageUrl)
replaceImageUrl in class AbstractCssUrlRewritingProcessorcssUri - Uri of the parsed css.imageUrl - to replace.
public final boolean isUriAllowed(String uri)
uri - to check if is allowed.
protected String getUrlPrefix()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||