|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.util.AbstractLogEnabled org.apache.cocoon.xml.AbstractXMLProducer org.apache.cocoon.xml.AbstractXMLPipe org.apache.cocoon.transformation.AbstractTransformer org.apache.cocoon.transformation.AbstractSAXTransformer org.apache.cocoon.transformation.CIncludeTransformer
This transformer processes include
elements in the
http://apache.org/cocoon/include/1.0
namespace.
The src
attribute contains the url which points to
an xml resource which is included instead of the element.
With the attributes element
, ns
and
prefix
it is possible to specify an element
which surrounds the included content.
This transformer also supports a more verbose but flexible version:
<ci:includexml xmlns:ci="http://apache.org/cocoon/include/1.0" ignoreErrors="false"> <ci:src>THE SRC URI</ci:src> <!-- This is an optional configuration block --> <ci:configuration> <!-- For example if you want to make a HTTP POST --> <ci:parameter> <ci:name>method</ci:name> <ci:value>POST</ci:value> </ci:parameter> </ci:configuration> <!-- The following are optional parameters appended to the URI --> <ci:parameters> <ci:parameter> <ci:name>a name</ci:name> <ci:value>a value</ci:value> </ci:parameter> <!-- more can follow --> </ci:parameters> </ci:includexml>
This transformer also supports caching of the included content.
Caching is performed only when cached-include
element in the
http://apache.org/cocoon/include/1.0
namespace is used.
The src
attribute contains the url which points to
an xml resource which is include instead of the element.
First, it works like the usual include command. But it can be
configured with various parameters:
The most important one is the expires
parameter.
If (and only if) this is set to a value greater than zero,
all included content is cached for the given period of time.
So if any other request includes the same URI, the content
is fetched from the cache. The expires value is in seconds.
Usually the content is cached in the usual store, but you
can also define a writeable source with the source
parameter,
e.g. "file:/c:/temp". Then the cached content is written into this
directory.
With the optional purge
set to true
the cache is purged which means the cached content is regarded as
invalid nevertheless if it has expired or not.
With the optional parameter parallel
the various
included contents are processed (included) in parallel rather than
in a series.
With the optional parameter preemptive
set to true
a pre-emptive caching is activated. When a resource is requested with
pre-emptive caching, this transformer always attempts to get the
content from the cache. If the content is not in the cache, it is
of course retrieved from the original source and cached.
If the cached resource has expired, it is still provided. The cache
is updated by a background task. This task has to be started
beforehand.
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer |
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, removeOurNamespacePrefixes, request, resolver, response, source, stack |
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 | |
CIncludeTransformer()
Constructor Set the namespace |
Method Summary | |
void |
dispose()
|
protected Object |
endCompiledXMLRecording()
Stop recording of compiled XML. |
void |
endDocument()
|
void |
endTransformingElement(String uri,
String name,
String raw)
|
Serializable |
getKey()
|
SourceValidity |
getValidity()
|
protected String |
processCIncludeElement(String src,
String element,
String select,
String ns,
String prefix,
boolean stripRoot,
boolean cache)
|
void |
recycle()
Recycle the component |
void |
service(ServiceManager manager)
|
void |
setup(org.apache.cocoon.environment.SourceResolver resolver,
Map objectModel,
String source,
Parameters parameters)
Setup the component. |
protected void |
startCompiledXMLRecording()
Start recording of compiled xml. |
void |
startDocument()
|
void |
startTransformingElement(String uri,
String name,
String raw,
Attributes attr)
|
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer |
addRecorder, characters, comment, configure, endCDATA, endDTD, endElement, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, setDocumentLocator, setupTransforming, skippedEntity, startCDATA, startDTD, startElement, startEntity, startParametersRecording, startPrefixMapping, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
setConsumer, setContentHandler, setLexicalHandler |
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled |
getLogger, setLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.cocoon.xml.XMLProducer |
setConsumer |
Field Detail |
public static final String CINCLUDE_NAMESPACE_URI
public static final String CINCLUDE_INCLUDE_ELEMENT
public static final String CINCLUDE_INCLUDE_ELEMENT_SRC_ATTRIBUTE
public static final String CINCLUDE_INCLUDE_ELEMENT_ELEMENT_ATTRIBUTE
public static final String CINCLUDE_INCLUDE_ELEMENT_SELECT_ATTRIBUTE
public static final String CINCLUDE_INCLUDE_ELEMENT_NS_ATTRIBUTE
public static final String CINCLUDE_INCLUDE_ELEMENT_PREFIX_ATTRIBUTE
public static final String CINCLUDE_INCLUDE_ELEMENT_STRIP_ROOT_ATTRIBUTE
public static final String CINCLUDE_INCLUDEXML_ELEMENT
public static final String CINCLUDE_INCLUDEXML_ELEMENT_IGNORE_ERRORS_ATTRIBUTE
public static final String CINCLUDE_SRC_ELEMENT
public static final String CINCLUDE_CONFIGURATION_ELEMENT
public static final String CINCLUDE_PARAMETERS_ELEMENT
public static final String CINCLUDE_PARAMETER_ELEMENT
public static final String CINCLUDE_NAME_ELEMENT
public static final String CINCLUDE_VALUE_ELEMENT
public static final String CINCLUDE_CACHED_INCLUDE_ELEMENT
protected static final String CINCLUDE_CACHED_INCLUDE_PLACEHOLDER_ELEMENT
protected Parameters configurationParameters
protected SourceParameters resourceParameters
protected int state
protected IncludeCacheManager cacheManager
protected IncludeCacheManagerSession cachingSession
protected boolean compiling
protected org.apache.cocoon.xml.IncludeXMLConsumer filter
protected AttributesImpl srcAttributes
protected boolean supportCaching
protected long startTime
Constructor Detail |
public CIncludeTransformer()
Method Detail |
public void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws org.apache.cocoon.ProcessingException, SAXException, IOException
setup
in interface org.apache.cocoon.sitemap.SitemapModelComponent
org.apache.cocoon.ProcessingException
SAXException
IOException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)
public void dispose()
dispose
in interface Disposable
Disposable.dispose()
public void recycle()
recycle
in interface Recyclable
public void startTransformingElement(String uri, String name, String raw, Attributes attr) throws org.apache.cocoon.ProcessingException, IOException, SAXException
org.apache.cocoon.ProcessingException
IOException
SAXException
AbstractSAXTransformer.startTransformingElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endTransformingElement(String uri, String name, String raw) throws org.apache.cocoon.ProcessingException, IOException, SAXException
org.apache.cocoon.ProcessingException
IOException
SAXException
AbstractSAXTransformer.endTransformingElement(java.lang.String, java.lang.String, java.lang.String)
protected String processCIncludeElement(String src, String element, String select, String ns, String prefix, boolean stripRoot, boolean cache) throws SAXException, IOException
SAXException
IOException
protected void startCompiledXMLRecording() throws SAXException
SAXException
protected Object endCompiledXMLRecording() throws SAXException
SAXException
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
SAXException
ContentHandler.startDocument()
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
SAXException
ContentHandler.endDocument()
public Serializable getKey()
getKey
in interface org.apache.cocoon.caching.CacheableProcessingComponent
CacheableProcessingComponent.getKey()
public SourceValidity getValidity()
getValidity
in interface org.apache.cocoon.caching.CacheableProcessingComponent
CacheableProcessingComponent.getValidity()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |