Accessing WCM repository from JSP or JS scripts?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2008 06:30 PM
Hi, I am developing a WCM site in Alfresco 2.1.2. It is apparently not possible to access the repository directly from JSP scripts, without writing custom Java code (e.g. the press releases class in the alfrescodemo project). So I am trying to use a Web Script (Javascript) instead to access the repository.
As I understand it, this method of using Web Scripts is also recommended in this thread http://forums.alfresco.com/viewtopic.php?f=29&t=12424&p=41109
I have used Web Scripts before to access the Alfresco repository; it works fine. However it is not working in this WCM context. Please advise what am I doing wrong here? I have a WCM Web project named "update". In the web client, it is listed in Company Home / Web Projects / update. There is a sub-folder named "articles". In Data Dictionary/Web Scripts I have put a test script to access the repository:
article.get.desc.xml :
I get a 500 error indicating that childByNamePath could not locate the space in the repository and returned null. Where are the repository spaces, then, for WCM Web Projects ? Should the guest access work as well?
As I understand it, this method of using Web Scripts is also recommended in this thread http://forums.alfresco.com/viewtopic.php?f=29&t=12424&p=41109
I have used Web Scripts before to access the Alfresco repository; it works fine. However it is not working in this WCM context. Please advise what am I doing wrong here? I have a WCM Web project named "update". In the web client, it is listed in Company Home / Web Projects / update. There is a sub-folder named "articles". In Data Dictionary/Web Scripts I have put a test script to access the repository:
article.get.desc.xml :
<webscript> <shortname>SFI Update article (xml)</shortname> <description>Fetch an article from the repository</description> <url>/update/article?guest=true</url> <authentication>guest</authentication> <format default="xml"></format></webscript>
article.get.js: var tArticlesSpace = companyhome.childByNamePath( "Web Projects/update/articles" ); if(tArticlesSpace == null) { throw "not found: Web Projects/update/articles"; }
When I hit the web script in my browser http://myserver:8080/alfresco/service/update/article?guest=trueI get a 500 error indicating that childByNamePath could not locate the space in the repository and returned null. Where are the repository spaces, then, for WCM Web Projects ? Should the guest access work as well?
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2008 11:42 AM
OK progress!
How to access the repo from Freemarker and XSLT:
http://wiki.alfresco.com/wiki/WCM_Forms_Rendering
How to access the repo from JSP **. Thanks to Scott Ashcraft for pointing to this resource:
http://www.rivetlogic.com/content/view/34/59/
** by inlining Java function into the JSP . This is preferable to a pre-compiled Java bean class, as shown in the press releases demo, in my opinion.
How to access the repo from Freemarker and XSLT:
http://wiki.alfresco.com/wiki/WCM_Forms_Rendering
How to access the repo from JSP **. Thanks to Scott Ashcraft for pointing to this resource:
http://www.rivetlogic.com/content/view/34/59/
** by inlining Java function into the JSP . This is preferable to a pre-compiled Java bean class, as shown in the press releases demo, in my opinion.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2008 12:40 PM
