[opencms-dev] acces the internal cms files extrenally

Alexander Langer al at al-arenal.de
Fri Jan 23 13:08:02 CET 2004


With help from Olli Aro I was able to write a simple JSP, which takes
a HTML file as a parameter and prints it out. This is an easy way to
access content in the VFS externally.

Just access the xxx.jsp?file=page.html to display page.html.
Shouldn't be a problem to use this as input source in each and every
programming language with network support.

Heres the complete sourcecode:

<jsp:useBean id="cms" class="com.opencms.flex.jsp.CmsJspActionElement">
  <%cms.init(pageContext,request, response);%>
</jsp:useBean>

<%

String file="";

if (request.getParameter("file") != null) {
  file = request.getParameter("file");
}

String fileURI=file;

com.opencms.file.CmsFile reqFile=cms.getCmsObject().readFile(fileURI);
com.opencms.template.CmsXmlControlFile ctl=new com.opencms.template.CmsXmlControlFile(cms.getCmsObject(),reqFile);
com.opencms.template.cache.CmsElementDefinitionCollection collection=ctl.getElementDefinitionCollection();
com.opencms.template.cache.CmsElementDefinition def=collection.get("body");
com.opencms.template.CmsXmlTemplateFile template=new com.opencms.template.CmsXmlTemplateFile(cms.getCmsObject(),def.getTemplateName());
String content=template.getProcessedDataValue("TEMPLATE");
%>

<%=content%>




> Sort of.... Look at the code for CmsShell. It basically involves 
> starting up a separate OpenCms instance.

> Alternatively, you could try to implement things over URL/XML 
> connections or something.

> Matt

> Jonathan Roberts wrote:
>> Hi All,
>>  
>> Is it possible to acces the internal cms files extrenally.
>>  
>> Internally you may use :
>> 
>> cms.getContent(cms.link(   filename  )).
>> 
>> How can this be used externally get the file?
>> 
>> Regards
>> 
>> Jonathan
>> 
>> ------------------------------------------------------------------------
>> * Yahoo! Messenger* 
>> <http://uk.rd.yahoo.com/mail/tagline_messenger/*http://uk.messenger.yahoo.com> 
>> - Communicate instantly..."Ping" your friends today! *Download Messenger 
>> Now* 
>> <http://uk.rd.yahoo.com/mail/tagline_messenger/*http://uk.messenger.yahoo.com/download/index.html> 
>> 

> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev



al

-- 
Alexander Langer
homepage: http://www.al-arenal.de
mailto: langer at al-arenal.de





More information about the opencms-dev mailing list