[opencms-dev] Retrieve Files from Repository
Sean C
seanlon11 at gmail.com
Tue Feb 15 15:57:04 CET 2011
Is there a way to directly access files from the Repository via a link?
(e.g. file located at C:\files\clientA\proposal.doc could be accessed via:
http:\\fileserver:800\files\clientA\proposal.doc)
Thanks,
Sean
On Fri, Feb 11, 2011 at 9:05 AM, Sean C <seanlon11 at gmail.com> wrote:
> Is this done via a Web Service?
>
> Currently, users are on one site, and click on a link to a simple
> (external) file server. The problem here is that the files on this external
> server lack versioning capabilities, along with other key aspects of OpenCMS
> that are desired to manage these files.
>
> What I envision is if I can't directly reference the files within OpenCMS
> (directly via a url), I would instead simply pass the desired file to a
> Servlet who would retrieve the file from our OpenCMS server. Is there a
> better design?
>
> Thanks for the quick response Michael.
>
> - Sean
>
>
> On Fri, Feb 11, 2011 at 8:40 AM, Michael Emmerich <m.emmerich at alkacon.com>wrote:
>
>> Sean,
>>
>> Am 11.02.2011 15:27, schrieb Sean C:
>> > Does OpenCMS have the capability to programmaticly retrieve files from
>> > the repository? For example, is there an API exposed that has a
>> > function such as getDocument(pathToDoc)?
>>
>> Everything you need is in the org.opencms.file.CmsObject.
>>
>> There you have
>>
>> public CmsResource readResource(String resourcename) throws CmsException
>>
>> which retunes a CmsResource object, containing everything of a resource
>> in OpenCms except the content itself.
>>
>> And you have
>>
>> public CmsFile readFile(String resourcename) throws CmsException
>>
>> which returns a CmsFile that has everything of a CmsResource plus the
>> file content.
>>
>> You should take a closer look to the JavaDocs of the CmsObject, what you
>> can do there with files, users, etc.
>>
>>
>>
>> Form a JSP, you can get the required CmsObject with this code:
>>
>> CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
>> response);
>> CmsObject cmsObject = cms.getCmsObject();
>>
>>
>> --
>> Kind Regards,
>> Michael.
>>
>> -------------------
>> Michael Emmerich
>>
>> Visit OpenCms Days 2011 Conference and Expo
>> May 9 to May 10 2011 in Cologne, Germany
>> http://www.opencms-days.org
>>
>> Alkacon Software GmbH - The OpenCms Experts
>> http://www.alkacon.com - http://www.opencms.org
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/mailman/listinfo/opencms-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20110215/62975fab/attachment.htm>
More information about the opencms-dev
mailing list