Show TOC Start of Content Area

Procedure documentation Registering and Unregistering Handlers  Locate the document in its SAP Library structure

After creating a handler class, register the handler with the portal.

Registration assigns a string, or type, to the handler. The author of an XML script can reference the handler by specifying the type in the objectClass attribute of a <Context> tag or the idattribute of an <Action> tag.

Procedure

Registering Handlers

...

       1.      Create a portal service, which will be used to register the handler.

       2.      Make the service start automatically when deployed by setting the startup property in the service-config section of the portalapp.xml file to true.

       3.      In the init() method of the service, register the handler as follows:

public voidinit(IServiceContext serviceContext) {

    mm_serviceContext = serviceContext;

   

    IGenericCreatorRegister myRegisterService = (IGenericCreatorRegister)
        PortalRuntime.getRuntimeResources()
            .getService(IGenericCreatorRegister.
KEY);

    myRegisterService.registerHandler("myHandlerType", MyHandler.class);

}

In the above example, myHandlerType is the handler’s type, which is added as an attribute in <Context> and <Action> tags to specify this handler.

Unregistering Handlers

...

       1.      In the destroy method of the service used for registration, unregister the handler, as follows:

public voiddestroy() {

    IGenericCreatorRegister myRegisterService = (IGenericCreatorRegister)
        PortalRuntime.getRuntimeResources()
            .getService(IGenericCreatorRegister.
KEY);

    myRegisterService.unRegisterHandler("myHandlerKey");

}

 

End of Content Area