John Rickett commented on Aug 29, 2012

Re: How to create a servlet to use WCM API to serve File Resource Component Files

Wouldn't hurt to add endWorkspace(). At this Infocenter URL:

http://publib.boulder.ibm.com/infocenter/wpdoc/v6r1/topic/com.ibm.wp.zos.doc_v615/wcm/wcm_dev_api_using.html

It says:

You must call endWorkspace() when finished with the workspace item.

webContentService.getRepository().endWorkspace();

Note: You don't need to call endWorkspace() when using a JSP component as rendering and session management is handled by Web Content Management.

James Gan commented on Aug 28, 2012

Re: How to create a servlet to use WCM API to serve File Resource Component Files

Shouldn't we use endWorspace() before finishing?

Soren Mogensen commented on Jan 4, 2011

Re: How to create a servlet to use WCM API to serve File Resource Component Files

Instead of hard-coding file extension to mime type mappings, it might be better to rely on something like the MimetypesFileTypeMap.

Also, should use getWorkspace() rather than getSystemWorkspace() if you want to support ACL. System workspace will have access to all resources, whereas getWorkspace() will use the current user's credentials (depending on deployment) and otherwise default to an anonymous workspace.