As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
.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/webscriptssimple.get.desc.xml - <tomcat>/webapps/share/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/demo
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; } }
<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>
<html> <head> <title>Hello World</title> </head> <body> ${hello} </body> </html>
<?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>
<?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>
<?xml version="1.0"?> <project name="Sample Module" default="package-amp" basedir="."> <property name="project.dir" value="." /> <property file="${project.dir}/build.properties" /> <property file="${project.dir}/module.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/${module.id}.jar" /> <property name="amp.file" value="${build.dir}/dist/${module.id}.amp" /> <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}/source" destdir="${build.dir}/classes" target="1.6" encoding="UTF-8" includeantruntime="false" /> <copy todir="${build.dir}/classes"> <fileset dir="${project.dir}/source" 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>
<?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.springframework.extensions.webscripts.simple.get" class="org.alfresco.module.demoscripts.SimpleWebScript" parent="webscript" /> </beans>
<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="html"/> </webscript>
<html> <head> <title>Hello World</title> </head> <body> ${hello} </body> </html>
package org.alfresco.module.demoscripts; import java.util.HashMap; import java.util.Map; import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptRequest; 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; } }