[opencms-dev] API question - how can i access preview content?

Thomas Maerz thomasmaerz at gmx.de
Wed Oct 13 20:25:14 CEST 2004


"Andy Kriger" <akriger at greaterthanone.com> writes:

> How would I retrieve offline content from OpenCMS (preferably through the
> API, but via URL could also work)?

| CmsJspActionElement cms = new CmsJspActionElement( context, request, response );
| CmsObject cmsObject = cms.getCmsObject();
| 
| cms.getRequestContext().setCurrentProject( cmsObject.readProject( "Offline" ) );
| 
| String uri = cms.getRequestContext().getUri();
| String content = cms.getContent( uri, "body", "en" );


And maybe take a look 

    at org.opencms.main.OpenCms#initCmsObject(String)
   and org.opencms.file.CmsObject#loginUser(String username, String password)

Regards,
Thomas




More information about the opencms-dev mailing list