Understand rendering contexts

Until we provide a Lunch Bytes screencast tutorial on this topic, you may find the following study notes useful.

Study Notes

IBM WebSphere Portal 6.1 InfoCenter Documentation related to this topic

The InfoCenter documentation does not appear to provide any information about RenderingContext. However, this is an Interface described in the JavaDoc API documentation as follows:

A rendering context contains all the information required to render a renderable object. This includes information such as the path to the object to be rendered and any request parameters.

Here is an example of how to create a RenderingContext, adding to the context, and then using the context to render a piece of content:

// Get the workspace
Workspace workspace = Repository.getWorkspace("myUser", "myPassword");

// Create the rendering context
RenderingContext context =  workspace.createRenderingContext(servletOrPortletRequest,
                                  servletOrPortletResponse,
                                  new HashMap(),
                                  "http://[HOSTNAME]:[PORT]/[CONTEXT]",
                                  "connect");

// Set the path to the content to be rendered
context.setRenderedContent("/Library1/SiteA/SiteArea1/SiteArea1-1/myContent");

// Get the rendered string
String renderedContent = workspace.render(context);

WCM API JavaDocs
The Javadoc HTML files are located in your WebSphere Portal installation under the was_profile_root\installedApps\nodename\wcm.ear\ilwwcm.war\webinterface\api-javadoc. Open index.html.