Show TOC Start of Content Area

Procedure documentation Redirectors  Locate the document in its SAP Library structure

The portal enables you to create redirectors that automatically translate all navigation targets with a specific prefix into different navigation targets.

For example, the roles connector includes a redirector (that is, a class that implements INavigationRedirector) that translates any navigation target with the pcd prefix into the same navigation target but with a ROLES prefix. This enables users or applications to navigate to role-based navigation nodes by specifying a target with a pcd prefix.

Note

You do not have to implement a redirector for your navigation connector. However, you can only register a redirector at the same time you register a navigation connector.

Procedure

The following describes how to write and deploy a redirector:

...

       1.      Create a new class that implements INavigationRedirector.

       2.      Implement the method redirect(), which has the following signature:

public INavigationRedirectorResult redirect(
        String atomicName, Hashtable hashtable) throws NamingException {

}

The original navigation target is passed as a string, without a prefix or separator.

The method provides the logic for translating this string into the new navigation target, including a prefix and separator. The method returns an object of type INavigationRedirectorResult. You must create a class that implements this interface.

       3.      Package this class with the PAR file that contains your navigation connector.

       4.      Register the redirector in the same call that registers your navigation connector, as follows

                            a.      Create an instance of your redirector.

                            b.      Create a Map for holding your redirectors.

                            c.      Register your redirector when registering your connector.

private myConnectorRedirector myConnectorRedirector;

 

// Create instance of redirector.

public void init(IServiceContext serviceContext) {

   myConnectorRedirector = new myConnectorRedirector();

}

 

// Register redirector.

public void afterInit() {

 

    INavigationConnectorRegistration service =
      
 (INavigationConnectorRegistration) getContext().
            getService(INavigationService.KEY);

    if (service != null) {

        Map redirectors = new HashMap();

        redirectors.put("myRedirectPrefix",myConnectorRedirector);

 

        service.registerConnector(
           
"myRedirectPrefix",myConnector,null,redirectors);

    }

}

 

End of Content Area