Alfresco Share - Develop a webscript in JAVA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2011 05:28 AM
I would try to create a new webscript in JAVA not in Javascript only in Alfreso Share.
I try to refer to the link below :
http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples
and especially about the locations files in Share :
.jar file in <tomcat>/webapps/share/WEB-INF/lib or .class files in <Alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/<class folder structure>
web-scripts-application-context.xml - <tomcat>/webapps/share/WEB-INF/classes/org/springframework/extensions/webscripts
simple.get.desc.xml - <tomcat>/webapps/share/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/demo
I realize that when I connect to the URL http://localhost:8080/share/service/index , I can't find again a new webscript in the list.
Could someone give me more informations ?
Thanks so much for your help.
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 03:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 06:08 AM
I have a jar file SimpleWebScript.jar in the folder "tomcat/webapps/share/WEB-INF/lib" where there's the JAVA class org.alfresco.module.demoscripts.SimpleWebScript.java with the following code :
public class SimpleWebScript extends DeclarativeWebScript { public SimpleWebScript() { } protected Map<String, Object> executeImpl(WebScriptRequest req, Status status) { Map<String, Object> model = new HashMap<String, Object>(); model.put("hello", "Hello World"); return model; } }
and then a file "simple.get.desc.xml" (in the folder tomcat/webapps/share/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/demo) :
<webscript> <shortname>The World's Simplest Webscript</shortname> <description>Hands back a little bit of JSON</description> <url>/demo/simple</url> <authentication>none</authentication> <format default="">argument</format> </webscript>
and to finish, the file "simple.get.html.ftl" (in the folder tomcat/webapps/share/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/demo) :
<html> <head> <title>Hello World</title> </head> <body> ${hello} </body> </html>
Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 06:21 AM
<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN 2.0//EN' 'http://www.springframework.org/dtd/spring-beans-2.0.dtd'><beans> <bean id="webscript.org.alfresco.demo.simple.get" class="org.alfresco.module.demoscripts.SimpleWebScript" parent="webscript" /></beans>
Thanks you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 12:25 PM
i have the same problem, the documentation is not very clear by this argument.
In my tomcat log say Class java.lang.ClassNotFoundException: org.alfresco.module.demoscripts.SimpleWebScript. Don't found class. Where i registering the bean?
you work?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2011 03:05 AM
Have you ever developed a webscript in JAVA ?
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2011 08:31 AM
Yes the jar file called JavaBeckedWebScript.jar is in tomcat/webapps/share/WEB-INF/lib, but not foundclass.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2011 09:16 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2011 10:11 AM
you can show me your build.xml file?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2011 10:30 AM
<?xml version="1.0"?><project name="Sample Module" default="package-amp" basedir="."> <property name="project.dir" value="." /> <property file="${project.dir}/build.properties" /> <property name="build.dir" value="${project.dir}/build" /> <property name="config.dir" value="${project.dir}/config" /> <property name="jar.file" value="${build.dir}/lib/SimpleWebScript.jar" /> <target name="mkdirs"> <mkdir dir="${build.dir}/dist" /> <mkdir dir="${build.dir}/lib" /> <mkdir dir="${build.dir}/classes" /> </target> <path id="class.path"> <dirset dir="${build.dir}" /> <fileset dir="${project.dir}/lib" includes="**/*.jar" /> </path> <target name="clean"> <delete dir="${build.dir}" /> </target> <target name="compile" depends="mkdirs"> <javac classpathref="class.path" debug="${debug}" srcdir="${project.dir}/src/org/alfresco/module/demoscripts" destdir="${build.dir}/classes" target="1.5" encoding="UTF-8" /> <copy todir="${build.dir}/classes"> <fileset dir="${project.dir}/src/org/alfresco/module/demoscripts" defaultexcludes="false"> <exclude name="**/*.java" /> <exclude name="**/.svn/**" /> <exclude name="**/CVS/**" /> </fileset> <fileset dir="${project.dir}/src/org/alfresco/module/demoscripts" defaultexcludes="false"> <exclude name="**/*.java" /> <exclude name="**/.svn/**" /> <exclude name="**/CVS/**" /> </fileset> </copy> </target> <target name="package-jar" depends="compile"> <jar destfile="${jar.file}" encoding="UTF-8"> <fileset dir="${build.dir}/classes" excludes="**/custom*,**/*Test*" defaultexcludes="false" /> </jar> </target> <target name="package-amp" depends="package-jar" description="Package the Module"> </target></project>
This code create a jar called /build/lib/SimpleWebScript.jar
