| org.apache.cocoon.transformation.AbstractTransformer org.apache.cocoon.portal.transformation.LinkTransformer
LinkTransformer | public class LinkTransformer extends AbstractTransformer implements Serviceable(Code) | | This Transformer deals with tags containing links to external applications that need to be converted so
that not the external application will be called directly but the request gets routed via the cocoon portal
(either via proxy transformer or proxy reader).
The link transformer therefore cooperates with the event link transformer.
Tags that include a link for which a link event needs to be generated will be converted to
<eventlink> elements.
Examples:
<img src="images/logo.jpg"> will be converted to use the proxy reader:
<img src="proxy-images/logo.jpg&cocoon-portal-copletid=xxx&cocoon-portal-portalname=yyy
<form action="/submitted.jsp"> will be converted to be processed by the event link transformer
<eventlink action="/submitted.jsp" attribute="action" element="form">
author: Gernot Koller author: Friedrich Klenner version: CVS $Id: LinkTransformer.java 433543 2006-08-22 06:22:54Z crossley $ |
Method Summary | |
protected String | buildUrlString(String uri, boolean applyPrefixAndPortalParams) | public void | endDocument() | public void | endElement(String uri, String name, String raw) | public void | handleTag(String attributeName, String uri, String elementName, String raw, Attributes attributes, boolean eventLink, boolean direct) The handleTag method is responsible for preparing tags so that they can either be conveted to
link events by the event link transformer or that the proxy reader is called directly. | protected Attributes | modifyLinkAttribute(String attribute, String remoteURI, Attributes attributes) Replaces the link of given attribute whith the new uri. | public void | recycle() Recycle this component. | public void | service(ServiceManager manager) | public void | setup(SourceResolver resolver, Map objectModel, String src, Parameters par) | public void | startDocument() | public void | startElement(String uri, String name, String raw, Attributes attributes) | protected void | startEventLinkElement(String element, String attribute, Attributes attributes) Replaces the given element with an eventlink element adding the attribute and element attribute within
the SAX stream. |
NAMESPACE_PREFIX | final public static String NAMESPACE_PREFIX(Code) | | Namespace prefix usef vor NewEventLinkTransformer-Namespace
|
copletIdParamString | protected String copletIdParamString(Code) | | Used for appending a request parameter containing the coplet id
|
documentBase | protected String documentBase(Code) | | The html document base uri
|
elementStack | protected Stack elementStack(Code) | | Used to store elements' name between startTransformingElement and endTransformingElement.
|
ignoreTargetSelf | protected boolean ignoreTargetSelf(Code) | | Handle target self as no target?
|
manager | protected ServiceManager manager(Code) | | The avalon service manager
|
portalNameParamString | protected String portalNameParamString(Code) | | Used for appending a request parameter containing the portal name
|
buildUrlString | protected String buildUrlString(String uri, boolean applyPrefixAndPortalParams)(Code) | | Retrieves and stores any session token, appends proxy reader prefix and parameters if necessary
Parameters: uri - the url to be converted Parameters: applyPrefixAndPortalParams - true signals that the url should be converted to call the proxy-reader the converted uriFIXME: anchors (#) should be treated right! |
handleTag | public void handleTag(String attributeName, String uri, String elementName, String raw, Attributes attributes, boolean eventLink, boolean direct) throws SAXException(Code) | | The handleTag method is responsible for preparing tags so that they can either be conveted to
link events by the event link transformer or that the proxy reader is called directly.
Tags with absolute links (starting with "http://", "ftp://", etc.) will not be touched.
Tags which contain a target attribute will be modified to call the uri directly
(no proxy reader or proxy transformer involved).
Tags (like <a href="uri"&ht; or <form action="uri">, etc.) that require a link event will be converted to
<eventlink> elements, so that the event link transformer can create the necessary link event
and the proxy transformer will be used.
Tags (like <img src="uri">) that shoud call the proxy reader will be converted to do so.
Examples:
<a href="http://www.somewhere.com"> will not be converted because of absolute url
<img src="images/logo.jpg"> will be converted to use the proxy reader:
<img src="proxy-images/logo.jpg&cocoon-portal-copletid=xxx&cocoon-portal-portalname=yyy
<form action="/submitted.jsp"> will be converted to use proxy transformer:
<eventlink action="/submitted.jsp" attribute="action" element="form">
Parameters: attributeName - Name oft the attribute containing the link to be converted Parameters: uri - Namespace URI Parameters: elementName - Name of the element (tag) Parameters: raw - Raw name of the element (including namespace prefix) Parameters: attributes - Attributes of the element Parameters: eventLink - True signals that the tag sould be converted to an event link tag. Parameters: direct - True signals that the uri should point directly to the external resource (no proxys) throws: SAXException - if an invalid URL was detected. |
modifyLinkAttribute | protected Attributes modifyLinkAttribute(String attribute, String remoteURI, Attributes attributes)(Code) | | Replaces the link of given attribute whith the new uri.
Parameters: attribute - Name of the attribute containing the link Parameters: remoteURI - The new uri Parameters: attributes - List of attributes The modified List of attributes |
recycle | public void recycle()(Code) | | Recycle this component.
All instance variables are set to null .
|
service | public void service(ServiceManager manager) throws ServiceException(Code) | | |
startEventLinkElement | protected void startEventLinkElement(String element, String attribute, Attributes attributes) throws SAXException(Code) | | Replaces the given element with an eventlink element adding the attribute and element attribute within
the SAX stream.
Parameters: element - Original name of the element Parameters: attribute - Name of the attribute containing the link Parameters: attributes - Original list of attributes throws: SAXException - |
|
|