| org.apache.lenya.cms.cocoon.transformation.AbstractLinkTransformer org.apache.lenya.cms.cocoon.transformation.UuidToUrlTransformer
UuidToUrlTransformer | public class UuidToUrlTransformer extends AbstractLinkTransformer implements Disposable(Code) | |
UUID to URL transformer.
This transformer is applied to an XHMTL document. It processes all links following the
LinkResolver syntax which are configured using <transform/> elements
(see below).
These links are resolved using the following rules:
- The current area (obtained from the page envelope) is used.
- A URL prefix is added depending on the proxy configuration of the publication.
- If the target document does not exist and is in the authoring area, the href attribute is
removed and a class="brokenlink" attribute is added to the
<a/> element.
- If the target document does not exist and is in the live area, the
<a/>
element is removed to disable the link.
You can add the query parameter uuid2url.extension to lenya-document:
URLs to set a specific link extension.
The resulting URLs are absolute web application URLs (without the servlet context path).
$Id: LinkRewritingTransformer.java,v 1.7 2004/03/16 11:12:16 gregor
|
Method Summary | |
public void | dispose() | protected Link | getAbsoluteLink(URLInformation info, String linkUri) The link is constructed from the linkUri string. | protected String | getExtension(Document targetDocument, String requiredExtension) Get the extension of a document. | protected LinkRewriter | getLinkRewriter() | protected void | handleLink(String linkUrl, AttributeConfiguration config, AttributesImpl newAttrs) | protected void | markBrokenLink(AttributesImpl newAttrs, String attrName, String brokenUrl) Marks a <a/> element as broken and removes href attribute. | public void | recycle() | protected void | rewriteLink(AttributesImpl newAttrs, String attributeName, Document targetDocument, String anchor, String queryString, String extension) Rewrites a link. | protected void | setAttribute(AttributesImpl attr, String name, String value) Sets the value of the href attribute. | public void | setup(SourceResolver _resolver, Map _objectModel, String _source, Parameters _parameters) |
BROKEN_ATTRIB | final protected static String BROKEN_ATTRIB(Code) | | |
BROKEN_VALUE | final protected static String BROKEN_VALUE(Code) | | |
EXTENSION_PARAM | final protected static String EXTENSION_PARAM(Code) | | |
dispose | public void dispose()(Code) | | See Also: org.apache.avalon.framework.activity.Disposable.dispose |
getAbsoluteLink | protected Link getAbsoluteLink(URLInformation info, String linkUri) throws MalformedURLException(Code) | | The link is constructed from the linkUri string. If it lacks the area or publication ID
information, these are obtained from the current URL information.
Parameters: info - The current URL information. Parameters: linkUri - The link URI to use. A link. throws: MalformedURLException - if the linkUri parameter is malformed. |
getExtension | protected String getExtension(Document targetDocument, String requiredExtension)(Code) | | Get the extension of a document. Caution: resolving the extension is expensive!
Parameters: targetDocument - The document. Parameters: requiredExtension - The required extension. The required extension or, if it is null, the document's default extension. |
markBrokenLink | protected void markBrokenLink(AttributesImpl newAttrs, String attrName, String brokenUrl) throws AccessControlException(Code) | | Marks a <a/> element as broken and removes href attribute.
Parameters: newAttrs - The new attributes. Parameters: attrName - The attribute name. Parameters: brokenUrl - The broken link URI. throws: AccessControlException - when something went wrong. |
recycle | public void recycle()(Code) | | See Also: org.apache.avalon.excalibur.pool.Recyclable.recycle |
rewriteLink | protected void rewriteLink(AttributesImpl newAttrs, String attributeName, Document targetDocument, String anchor, String queryString, String extension) throws AccessControlException(Code) | | Rewrites a link.
Parameters: newAttrs - The new attributes. Parameters: attributeName - The name of the attribute to rewrite. Parameters: targetDocument - The target document. Parameters: anchor - The anchor (the string after the # character in the URL). Parameters: queryString - The query string without question mark. Parameters: extension - The extension to use. throws: AccessControlException - when something went wrong. |
setAttribute | protected void setAttribute(AttributesImpl attr, String name, String value)(Code) | | Sets the value of the href attribute.
Parameters: attr - The attributes. Parameters: name - The attribute name. Parameters: value - The value. throws: IllegalArgumentException - if the href attribute is not contained in this attributes. |
Methods inherited from org.apache.lenya.cms.cocoon.transformation.AbstractLinkTransformer | public void configure(Configuration config) throws ConfigurationException(Code)(Java Doc) public void endElement(String uri, String name, String qname) throws SAXException(Code)(Java Doc) protected boolean existsMatchingConfiguration(String namespace, String localName)(Code)(Java Doc) protected String getCacheKey(String namespace, String localName)(Code)(Java Doc) abstract protected LinkRewriter getLinkRewriter()(Code)(Java Doc) protected Set getMatchingConfigurations(String namespace, String localName, Attributes attrs)(Code)(Java Doc) protected void handleLink(String linkUrl, AttributeConfiguration config, AttributesImpl newAttrs) throws Exception(Code)(Java Doc) protected void setAttribute(AttributesImpl attr, String name, String value)(Code)(Java Doc) public void startElement(String uri, String name, String qname, Attributes attrs) throws SAXException(Code)(Java Doc)
|
|
|