This documentation is for WSO2 API Manager 1.8.0 View documentation for the latest release.
Page Comparison - Writing Custom Handlers (v.6 vs v.7) - API Manager 1.8.0 - WSO2 Documentation

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Engaging the custom handler

You can engage the a custom handler per API or to all APIs at once . To or only to selected APIs. 

To engage to all APIs, the recommended approach is to add it to the <APIM_HOME>/repository/resources/api_templates/velocity_template.xml fileFor example, the following code segment adds the custom authentication handler that you wrote earlier to the velocity_template.xml file while making sure that it skips the default APIAuthenticationHandler implementation:

Code Block
<handler class="org.wso2.carbon.apimgt.custom.authentication.handler.CustomAPIAuthenticationHandler" />
       #foreach($handler in $handlers)
          #if(!($handler.className == ""))
           <handler xmlns="" class="$handler.className">
                #set ($map = $handler.getProperties() )
                #foreach($property in $map.entrySet())
                    <property name="$!property.key" value="$!property.value"/>

 Given below is how to engage handlers to a single API, by editing its source view.