|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.xml.AbstractXMLPipe
org.apache.cocoon.transformation.AbstractTransformer
org.apache.cocoon.portal.transformation.LinkTransformer
public class LinkTransformer
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">
Field Summary | |
---|---|
protected String |
copletIdParamString
Used for appending a request parameter containing the coplet id |
protected CopletInstanceData |
copletInstanceData
The coplet instance data |
protected String |
documentBase
The html document base uri |
protected Stack |
elementStack
Used to store elements' name between startTransformingElement and endTransformingElement. |
protected boolean |
ignoreTargetSelf
Handle target self as no target? |
protected ServiceManager |
manager
The avalon service manager |
static String |
NAMESPACE_PREFIX
Namespace prefix usef vor NewEventLinkTransformer-Namespace |
protected String |
portalNameParamString
Used for appending a request parameter containing the portal name |
protected String |
prefix
The prefix |
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
---|
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer |
Fields inherited from interface org.apache.cocoon.transformation.Transformer |
---|
ROLE |
Constructor Summary | |
---|---|
LinkTransformer()
|
Method Summary | |
---|---|
protected String |
buildUrlString(String uri,
boolean applyPrefixAndPortalParams)
Retrieves and stores any session token, appends proxy reader prefix and parameters if necessary |
void |
endDocument()
Receive notification of the end of a document. |
void |
endElement(String uri,
String name,
String raw)
Receive notification of the end of an element. |
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. |
void |
recycle()
Recycle this component. |
void |
service(ServiceManager manager)
|
void |
setup(SourceResolver resolver,
Map objectModel,
String src,
Parameters par)
Set the SourceResolver , objectModel Map ,
the source and sitemap Parameters used to process the request. |
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startElement(String uri,
String name,
String raw,
Attributes attributes)
Receive notification of the beginning of an element. |
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. |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe |
---|
characters, comment, endCDATA, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity, startPrefixMapping |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
---|
setConsumer, setContentHandler, setLexicalHandler |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xml.sax.ContentHandler |
---|
characters, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping |
Methods inherited from interface org.xml.sax.ext.LexicalHandler |
---|
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity |
Methods inherited from interface org.apache.cocoon.xml.XMLProducer |
---|
setConsumer |
Field Detail |
---|
public static final String NAMESPACE_PREFIX
protected String copletIdParamString
protected String portalNameParamString
protected CopletInstanceData copletInstanceData
protected String documentBase
protected Stack elementStack
protected ServiceManager manager
protected String prefix
protected boolean ignoreTargetSelf
Constructor Detail |
---|
public LinkTransformer()
Method Detail |
---|
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException
SitemapModelComponent
SourceResolver
, objectModel Map
,
the source and sitemap Parameters
used to process the request.
setup
in interface SitemapModelComponent
ProcessingException
SAXException
IOException
SitemapModelComponent.setup(SourceResolver, Map, String, Parameters)
public void recycle()
null
.
recycle
in interface Recyclable
recycle
in class AbstractXMLProducer
public void startDocument() throws SAXException
AbstractXMLPipe
startDocument
in interface ContentHandler
startDocument
in class AbstractXMLPipe
SAXException
ContentHandler.startDocument()
public void endDocument() throws SAXException
AbstractXMLPipe
endDocument
in interface ContentHandler
endDocument
in class AbstractXMLPipe
SAXException
ContentHandler.endDocument()
public void startElement(String uri, String name, String raw, Attributes attributes) throws SAXException
AbstractXMLPipe
startElement
in interface ContentHandler
startElement
in class AbstractXMLPipe
uri
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace
processing is not being performed.name
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.raw
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.attributes
- The attributes attached to the element. If there are no
attributes, it shall be an empty Attributes object.
SAXException
ContentHandler.startElement(String, String, String, Attributes)
public void endElement(String uri, String name, String raw) throws SAXException
AbstractXMLPipe
endElement
in interface ContentHandler
endElement
in class AbstractXMLPipe
uri
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace
processing is not being performed.name
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.raw
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.
SAXException
ContentHandler.endElement(String, String, String)
public void handleTag(String attributeName, String uri, String elementName, String raw, Attributes attributes, boolean eventLink, boolean direct) throws SAXException
<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">
attributeName
- Name oft the attribute containing the link to be converteduri
- Namespace URIelementName
- Name of the element (tag)raw
- Raw name of the element (including namespace prefix)attributes
- Attributes of the elementeventLink
- True signals that the tag sould be converted to an event link tag.direct
- True signals that the uri should point directly to the external resource (no proxys)
SAXException
- if an invalid URL was detected.protected Attributes modifyLinkAttribute(String attribute, String remoteURI, Attributes attributes)
attribute
- Name of the attribute containing the linkremoteURI
- The new uriattributes
- List of attributes
protected void startEventLinkElement(String element, String attribute, Attributes attributes) throws SAXException
element
- Original name of the elementattribute
- Name of the attribute containing the linkattributes
- Original list of attributes
SAXException
protected String buildUrlString(String uri, boolean applyPrefixAndPortalParams)
uri
- the url to be convertedapplyPrefixAndPortalParams
- true signals that the url should be converted to call the proxy-reader
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |