org.apache.jasper.compiler.tagplugin.TagPlugin Java Examples

The following examples show how to use org.apache.jasper.compiler.tagplugin.TagPlugin. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TagPluginManager.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Invoke tag plugin for the given custom tag, if a plugin exists for
 * the custom tag's tag handler.
 * <p/>
 * The given custom tag node will be manipulated by the plugin.
 */
private void invokePlugin(Node.CustomTag n, PageInfo pageInfo) {
    TagPlugin tagPlugin = tagPlugins.get(n.getTagHandlerClass().getName());
    if (tagPlugin == null) {
        return;
    }

    TagPluginContext tagPluginContext = new TagPluginContextImpl(n, pageInfo);
    n.setTagPluginContext(tagPluginContext);
    tagPlugin.doTag(tagPluginContext);
}
 
Example #2
Source File: TagPluginManager.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Invoke tag plugin for the given custom tag, if a plugin exists for
 * the custom tag's tag handler.
 *
 * The given custom tag node will be manipulated by the plugin.
 */
private void invokePlugin(Node.CustomTag n, PageInfo pageInfo) {
    TagPlugin tagPlugin = tagPlugins.get(n.getTagHandlerClass().getName());
    if (tagPlugin == null) {
        return;
    }

    TagPluginContext tagPluginContext = new TagPluginContextImpl(n, pageInfo);
    n.setTagPluginContext(tagPluginContext);
    tagPlugin.doTag(tagPluginContext);
}
 
Example #3
Source File: TagPluginManager.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Invoke tag plugin for the given custom tag, if a plugin exists for
 * the custom tag's tag handler.
 *
 * The given custom tag node will be manipulated by the plugin.
 */
private void invokePlugin(Node.CustomTag n, PageInfo pageInfo) {
    TagPlugin tagPlugin = tagPlugins.get(n.getTagHandlerClass().getName());
    if (tagPlugin == null) {
        return;
    }

    TagPluginContext tagPluginContext = new TagPluginContextImpl(n, pageInfo);
    n.setTagPluginContext(tagPluginContext);
    tagPlugin.doTag(tagPluginContext);
}
 
Example #4
Source File: TagPluginManager.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
/**
    * Invoke tag plugin for the given custom tag, if a plugin exists for 
    * the custom tag's tag handler.
    *
    * The given custom tag node will be manipulated by the plugin.
    */
   private void invokePlugin(Node.CustomTag n) {
TagPlugin tagPlugin = tagPlugins.get(n.getTagHandlerClass().getName());
if (tagPlugin == null) {
    return;
}

TagPluginContext tagPluginContext = new TagPluginContextImpl(n, pageInfo);
n.setTagPluginContext(tagPluginContext);
tagPlugin.doTag(tagPluginContext);
   }
 
Example #5
Source File: TagPluginManager.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
private void init(ErrorDispatcher err) throws JasperException {
if (initialized)
    return;

InputStream is = ctxt.getResourceAsStream(TAG_PLUGINS_XML);
if (is == null)
    return;

TreeNode root = (new ParserUtils()).parseXMLDocument(TAG_PLUGINS_XML,
						     is);
if (root == null) {
    return;
}

if (!TAG_PLUGINS_ROOT_ELEM.equals(root.getName())) {
    err.jspError("jsp.error.plugin.wrongRootElement", TAG_PLUGINS_XML,
		 TAG_PLUGINS_ROOT_ELEM);
}

tagPlugins = new HashMap<String, TagPlugin>();
Iterator pluginList = root.findChildren("tag-plugin");
while (pluginList.hasNext()) {
    TreeNode pluginNode = (TreeNode) pluginList.next();
           TreeNode tagClassNode = pluginNode.findChild("tag-class");
    if (tagClassNode == null) {
	// Error
	return;
    }
    String tagClass = tagClassNode.getBody().trim();
    TreeNode pluginClassNode = pluginNode.findChild("plugin-class");
    if (pluginClassNode == null) {
	// Error
	return;
    }

    String pluginClassStr = pluginClassNode.getBody();
    TagPlugin tagPlugin = null;
    try {
	Class<? extends TagPlugin> pluginClass =
                   Class.forName(pluginClassStr).asSubclass(TagPlugin.class);
	tagPlugin =  pluginClass.newInstance();
    } catch (Exception e) {
	throw new JasperException(e);
    }
    if (tagPlugin == null) {
	return;
    }
    tagPlugins.put(tagClass, tagPlugin);
}
initialized = true;
   }