Class ScriptTagHandler
- java.lang.Object
-
- com.day.cq.wcm.designimporter.parser.taghandlers.ScriptTagHandler
-
- All Implemented Interfaces:
EntryTagHandler,HTMLContentProvider,TagHandler
public class ScriptTagHandler extends java.lang.Object implements TagHandler, EntryTagHandler, HTMLContentProvider
The script tag handler is used to extract the name of the scripts referenced within the input HTML document.This tag handler is registered against the markup of type < script src="myscript.js" >. That implies this tag handler will come into action whenever the design importer framework encounters an HTML tag matching the rule this handler is defined against.
Note: This tag handler does not handle inline script tags. {@see InlineScriptTagHandler}
- See Also:
ScriptTagHandlerFactory
-
-
Constructor Summary
Constructors Constructor Description ScriptTagHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginHandling(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)Callback to signal the start of handling giving the tag handler a chance for running intialization routines.voidcharacters(char[] ch, int start, int length)Callback to signal the encounter of character content within tags.voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)Callback to signal the encounter of a tag end.voidendHandling(java.lang.String uri, java.lang.String localName, java.lang.String qName)Callback to signal the end of handling giving the tag handler a chance for finalizing things.java.lang.ObjectgetContent(HTMLContentType htmlContentType)Gets the content of the typeHTMLContentTypejava.lang.StringgetScriptPath()voidsetDesignImporterContext(DesignImporterContext designImporterContext)Sets the design importer contextvoidsetTagHandlerProvider(TagHandlerProvider tagHandlerProvider)voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)Callback to signal the encounter of a tag start.booleansupportsContent(HTMLContentType htmlContentType)Indicates whether the passedHTMLContentTypeis supported or not
-
-
-
Method Detail
-
beginHandling
public void beginHandling(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)Description copied from interface:TagHandlerCallback to signal the start of handling giving the tag handler a chance for running intialization routines.TagHandlers are registered against tag+attribute combination and are invoked by theHTMLContentHandleras and when it encounters a tag matching the tag attribute combination the tag handler is registered with.- Specified by:
beginHandlingin interfaceTagHandler
-
characters
public void characters(char[] ch, int start, int length) throws DesignImportExceptionDescription copied from interface:TagHandlerCallback to signal the encounter of character content within tags.- Specified by:
charactersin interfaceTagHandler- Throws:
DesignImportException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws DesignImportExceptionDescription copied from interface:TagHandlerCallback to signal the encounter of a tag end.- Specified by:
endElementin interfaceTagHandler- Throws:
DesignImportException
-
endHandling
public void endHandling(java.lang.String uri, java.lang.String localName, java.lang.String qName)Description copied from interface:TagHandlerCallback to signal the end of handling giving the tag handler a chance for finalizing things.This is arguably the last callback a tag handler receives. After this, the current tag handler is popped out from the chain and the subsequent Tika events are directed to preceding tag handlers.
- Specified by:
endHandlingin interfaceTagHandler
-
getContent
public java.lang.Object getContent(HTMLContentType htmlContentType)
Description copied from interface:HTMLContentProviderGets the content of the typeHTMLContentType- Specified by:
getContentin interfaceHTMLContentProvider- Returns:
-
getScriptPath
public java.lang.String getScriptPath()
-
setDesignImporterContext
public void setDesignImporterContext(DesignImporterContext designImporterContext)
Description copied from interface:TagHandlerSets the design importer context- Specified by:
setDesignImporterContextin interfaceTagHandler
-
setTagHandlerProvider
public void setTagHandlerProvider(TagHandlerProvider tagHandlerProvider)
- Specified by:
setTagHandlerProviderin interfaceTagHandler
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws DesignImportExceptionDescription copied from interface:TagHandlerCallback to signal the encounter of a tag start.Once a tag handler begins handling, it receives the start tag events for all the nested tags within the purview of the tag this tag handler is registered against.
- Specified by:
startElementin interfaceTagHandler- Throws:
DesignImportException
-
supportsContent
public boolean supportsContent(HTMLContentType htmlContentType)
Description copied from interface:HTMLContentProviderIndicates whether the passedHTMLContentTypeis supported or not- Specified by:
supportsContentin interfaceHTMLContentProvider- Returns:
-
-