ResourceTransformer implementation that modifies links in a CSS
file to match the public URL paths that should be exposed to clients (e.g.
with an MD5 content-based hash inserted in the URL).
The implementation looks for links in CSS @import statements and
also inside CSS url() functions. All links are then passed through the
ResourceResolverChain and resolved relative to the location of the
containing CSS file. If successfully resolved, the link is modified, otherwise
the original link is preserved.
| Modifier and Type | Class and Description |
|---|---|
| protected abstract static class | CssLinkResourceTransformer.
Abstract base class for |
| private static class | |
| private static class | |
| protected static interface | CssLinkResourceTransformer.
Extract content chunks that represent links. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final Charset | |
| private final List | |
| private static final Log |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| public Resource | transform(HttpServletRequest
the current request request, Resource the resource to transform resource, ResourceTransformerChain the chain of remaining transformers to delegate to transformerChain)Implements org. Transform the given resource. |
| DEFAULT_CHARSET | back to summary |
|---|---|
| private static final Charset DEFAULT_CHARSET | |
| linkParsers | back to summary |
|---|---|
| private final List<CssLinkResourceTransformer. | |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| CssLinkResourceTransformer | back to summary |
|---|---|
| public CssLinkResourceTransformer() | |
| hasScheme | back to summary |
|---|---|
| private boolean hasScheme(String link) | |
| transform | back to summary |
|---|---|
| public Resource transform(HttpServletRequest request, Resource resource, ResourceTransformerChain transformerChain) throws IOException Implements org. Doc from org. Transform the given resource.
| |
LinkParser implementations.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected int | extractLink(int index, String endKey, String content, SortedSet<CssLinkResourceTransformer.
|
| protected abstract int | extractLink(int index, String content, SortedSet<CssLinkResourceTransformer.
Invoked after a keyword match, after whitespace has been removed, and when the next char is neither a single nor double quote. |
| protected abstract String | |
| public void |
| AbstractLinkParser | back to summary |
|---|---|
| protected AbstractLinkParser() | |
| extractLink | back to summary |
|---|---|
| protected int extractLink(int index, String endKey, String content, SortedSet<CssLinkResourceTransformer. | |
| extractLink | back to summary |
|---|---|
| protected abstract int extractLink(int index, String content, SortedSet<CssLinkResourceTransformer. Invoked after a keyword match, after whitespace has been removed, and when the next char is neither a single nor double quote. | |
| getKeyword | back to summary |
|---|---|
| protected abstract String getKeyword() Return the keyword to use to search for links, e.g. "@import", "url(" | |
| parse | back to summary |
|---|---|
| public void parse(String content, SortedSet<CssLinkResourceTransformer. Implements org.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(CssLinkResourceTransformer.
the object to be compared. otherImplements java. Compares this object with the specified object for order. |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public int | |
| public int |
| ContentChunkInfo | back to summary |
|---|---|
| pack-priv ContentChunkInfo(int start, int end) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(CssLinkResourceTransformer. Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getEnd | back to summary |
|---|---|
| public int getEnd() | |
| getStart | back to summary |
|---|---|
| public int getStart() | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected int | extractLink(int index, String content, SortedSet<CssLinkResourceTransformer.
Implements abstract org. Invoked after a keyword match, after whitespace has been removed, and when the next char is neither a single nor double quote. |
| protected String | getKeyword()
Implements abstract org. Return the keyword to use to search for links, e.g. "@import", "url(" |
| ImportStatementLinkParser | back to summary |
|---|---|
| private ImportStatementLinkParser() | |
| extractLink | back to summary |
|---|---|
| protected int extractLink(int index, String content, SortedSet<CssLinkResourceTransformer. Implements abstract org. Doc from org. Invoked after a keyword match, after whitespace has been removed, and when the next char is neither a single nor double quote.
| |
| getKeyword | back to summary |
|---|---|
| protected String getKeyword() Implements abstract org. Doc from org. Return the keyword to use to search for links, e.g. "@import", "url("
| |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| parse | back to summary |
|---|---|
| public void parse(String content, SortedSet<CssLinkResourceTransformer. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected int | extractLink(int index, String content, SortedSet<CssLinkResourceTransformer.
Implements abstract org. Invoked after a keyword match, after whitespace has been removed, and when the next char is neither a single nor double quote. |
| protected String | getKeyword()
Implements abstract org. Return the keyword to use to search for links, e.g. "@import", "url(" |
| UrlFunctionLinkParser | back to summary |
|---|---|
| private UrlFunctionLinkParser() | |
| extractLink | back to summary |
|---|---|
| protected int extractLink(int index, String content, SortedSet<CssLinkResourceTransformer. Implements abstract org. Doc from org. Invoked after a keyword match, after whitespace has been removed, and when the next char is neither a single nor double quote.
| |
| getKeyword | back to summary |
|---|---|
| protected String getKeyword() Implements abstract org. Doc from org. Return the keyword to use to search for links, e.g. "@import", "url("
| |