From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 14:50, 24 December 2020 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A protocol handler needs configuration entries, which provide the framework with the necessary information to find the handler. The schema of the configuration branch org.openoffice.Office.ProtocolHandler defines how to bind handler instances to their URL schemas:
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE oor:component-schema SYSTEM "../../../../component-schema.dtd">
  <oor:component-schema xmlns:oor="" 
          <group oor:name="Handler">
              <prop oor:name="Protocols" oor:type="oor:string-list"/>
              <set oor:name="HandlerSet" oor:node-type="Handler"/>

Each set node entry specifies one protocol handler, using its UNO implementation name. The only property it has is the Protocols item. Its type must be [string-list] and it contains a list of URL schemas bound to the handler. Wildcards are allowed, otherwise the entire string must match the dispatched URL.

Configuration for

The following example ProtocolHandler.xcu contains the protocol handler configuration for the example's Java protocol handler:

  <?xml version='1.0' encoding='UTF-8'?>
  <oor:component-data oor:name="ProtocolHandler" 
      <node oor:name="HandlerSet">
          <node oor:name="" oor:op="replace">
              <prop oor:name="Protocols">
                  <value>myProtocol_1://* myProtocol_2://*</value>

The example adds two new URL protocols using wildcards:


Both protocols are bound to the handler implementation Note that this must be the implementation name of the handler, not the name of the service it implements. Because all implementations of the service share the same UNO service name, you cannot use this name in the configuration files.

To prevent ambiguous implementation names, the following naming schema for implementation names is frequently used:



<namespace_of_implementation>= framework
<class_name>= ExampleHandler 

An alternative would be the naming convention proposed in XServiceInfo:


e.g. org.openoffice.comp.framework.OProtocolHandler

All of these conventions are proposals; what matters is:

  • use the implementation name in the configuration file, not the general service name ""
  • be careful to choose an implementation name that is likely to be unique, and be aware that your handler ceases to function when another developer adds a handler with the same name.

Configuration for org.openoffice.Office.addon.example

The following ProtocolHandler.xcu file configures the example's C++ protocol handler with the implementation name org.openoffice.Office.addon.example in the configuration branch org.openoffice.Office.ProtocolHandler following the same schema.

  <?xml version="1.0" encoding="UTF-8"?>
  <oor:component-data xmlns:oor="" xmlns:xs="" oor:name="ProtocolHandler" oor:package="org.openoffice.Office"> 
      <node oor:name="HandlerSet"> 
          <node oor:name="org.openoffice.Office.addon.example" oor:op="replace"> 
              <prop oor:name="Protocols" oor:type="oor:string-list">

The configuration adds one new URL protocol using wildcards:


Based on this URL protocol, the C++ protocol handler can route, for example, a dispatched URL


to the corresponding target routine. See the implementation of the dispatch() method in the XDispatch interface of the C++ source fragment above.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages