JBoss.orgCommunity Documentation

XMLProccessor Component

This service processes the input texts in the system by pushing it through a filter (plugin) chain and returns a result as the diagram below:

Each filter is responsible for enriching the content of the input texts. For example, highlight usernames existing in a user's connection or remove the forbidden HTML tags.

The XMLProcessor component is configured in the config/src/main/java/conf/social/common-configuration.xml file:



<component>
    <key>org.exoplatform.social.common.xmlprocessor.XMLProcessor</key>
    <type>org.exoplatform.social.common.xmlprocessor.XMLProcessorImpl</type>
</component>

To manage the chain of the filters in XMLProcessor, you can use the addFilterPlugin() and removeFilterPlugin() methods. XMLProcessor is initialized by IOC (Invesion of Control) via the configuration files defined in the /demo/war/src/main/webapp/WEB-INF/conf/socialdemo/social/component-plugins-configuration.xml path.

Sample code:



  <external-component-plugins>
    <target-component>org.exoplatform.social.common.xmlprocessor.XMLProcessor</target-component>
    <component-plugin>
      <name>URLConverterFilterPlugin</name>
      <set-method>addFilterPlugin</set-method>
      <type>org.exoplatform.social.common.xmlprocessor.filters.URLConverterFilterPlugin</type>
      <init-params>
        <value-param>
          <name>urlMaxLength</name>
          <description>the max length of URL</description>
          <value>-1</value>
        </value-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>