IBM®
Skip to main content
    Country/region [select]      Terms of use
 
 
    
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerworks > Dashboard > IBM Composite Applications > ... > Building NSF Components > Pass Context to Components when opening Composite Applications
developerWorks
Log In   View a printable version of the current page.
Overview Spaces Forums Blogs Podcasts Wikis Exchange
Pass Context to Components when opening Composite Applications
Added by niklasheidloff, last edited by niklasheidloff on May 06, 2008  (view change)
Labels: 
(None)

You can pass context to Eclipse and NSF components using component preferences that are defined in the CA XML. This allows passing composite application specific context to the components. As an extension to this there is another mechanism so that you can pass context to composite applications when you open them via URL. So you can open one and the same composite application with different input parameters.

There is a new type of URL, the CAI URLs. With CAI URLs you can point to composite applications and pages in composite applications no matter whether they are NSF based composite apps or Portal based composite apps.

CAI URL format (square brackets [ ] denote optional parts)
cai:///appInstanceID[/pageID]?[hint]
where:
o    cai:// is the start of the CAI URL format
o    appInstanceID is the unique identifier for the application
o    [/pageID] is an optional unique identifier for a page in the application
o    [hint] is the URL for retrieving the application if it is not already available in the client. Although this piece is optional, if it is not used and the application is not already installed in the client, then the application will fail to open. This hint can either be a HTTP URL when Portal based apps are used or a NRPC URL for NSF based composite applications

Opening a connection to a CAI URL will cause the corresponding application to be projected to the client or updated if already on the client, and then opened in the user interface to the specified page. If no page is specified, the first page in the application is opened.

The CAI URL is used by Notes internally in the UI when you've opened a composite application and want to copy a link to the application or a page of the current application.
 
For the Notes mail composite application this is not sufficient. In mail you want to be able to bookmark not only the mail page, but also a specific folder in the mail page as you can do it today with Notes 7. So there is a mechanism to pass context (in the sample the current Notes folder/view of the Mail Inbox View component view) to the components in the composite application when it is opened.

You can add your own parameters to the CAI URL. In the little sample '&NiklasTest=NiklasTestValue' was added to the bookmark in the document. Here is the orginal url as generated by Edit-Copy As-Application URL:
cai:///CFB7535080ECD4C270FDD126C5DD9E27_11_5JMPDRH1000980269G784H2GO4?
hint=nrpc%3A%2F__8525729D0030946C%2Fcomposite.xml%3Ffile%3DMyCompApp.nsf%26name%3DCompAppMain
%26clnk%3Dt
And here is my changed URL:
cai:///CFB7535080ECD4C270FDD126C5DD9E27_11_5JMPDRH1000980269G784H2GO4?
hint=nrpc%3A%2F__8525729D0030946C%2Fcomposite.xml%3Ffile%3DMyCompApp.nsf%26name%3DCompAppMain
%26clnk%3Dt&NiklasTest=NiklasTestValue

When the composite application is now opened additional 'dynamic' preferences are added for all components. So the parameter 'NiklasTest' is made available to every Eclipse component in the composite application. The Eclipse components can access this information as every other component preference. So you can to use the topology manager. As you can see the URL parameters can be accessed via 'com.ibm.portal.app.input.' plus your URL parameter name.
String[] values = data.getPreference("com.ibm.portal.app.input.NiklasTest");


    About IBM Privacy Contact