Controller Configuration

From Plex-XML
Jump to: navigation, search

The Controller configuration defines the mapping between Handler implementation classes and request names. Details about each request name are defined in the request.xml.


To minimize annoying configuration you can specify a pattern to find a Handler class responsible for handling a request. An commented example is shown below. Once a Handler is found using the name pattern, the mapping is stored internally until next restart of the Application Server.

<?xml version="1.0" ?>
<controller-config>
  <!-- Name pattern to find Handlers. {0} will be replaced by the class name. -->
  <request-pattern>de.bodow.handler.{0}Handler</request-pattern>
</controller-config>


For a Plex-XML XML function that should have a request name that differs from the class name (Plex implementation name) a separate configuration element must be defined. See the example below where the call name is 'Employee_FB' and the request name that is used in the request.xml should be 'EmployeeFindBrowse'.

  <request-handler>
    <class>com.plexxml.xml.handler.Employee_FBHandler</class>
    <request>EmployeeFindBrowse</request>
  </request-handler>


Example with Comments

<?xml version="1.0" ?>
<controller-config>

  <!-- Name pattern to find Handlers. {0} will be replaced by the class name. -->
  <request-pattern>de.bodow.handler.{0}Handler</request-pattern>
  <!-- the above example would map an "Echo" request to "de.bodow.handler.EchoHandler" class -->

  <!-- request-handler element -->
  <!-- The attr. logenabled is optional and only useful with the LoggingRequestController implementation -->
  <request-handler logenabled="true|false" > 
    <!-- the Handler class to register -->
    <class>de.bodow.handler.EchoHandler</class> 
    <!-- name of the request which is mapped to the Handler class -->
    <request>simple</request> 
    <!-- you can add more request elements to map more than one request to the Hander class -->
    <request>another</request> 
  </request-handler>

  <request-handler>
    <class>com.plexxml.xml.handler.Employee_FBHandler</class>
    <request>EmployeeFB</request>
  </request-handler>

  <!-- OPTIONAL: alternative implementation which logs XML requests -->
  <implementation class="de.bodow.control.LoggingRequestController" > 
    <parameter name="log-directory">.</parameter>
    <parameter name="log-enabled">true</parameter>
  </implementation>

  <!-- OPTIONAL: import request mappings from another XML file -->
  <import url="/WEB-INF/security/controller.xml"/>

</controller-config>
Personal tools