cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Share - Develop a webscript in JAVA

allen87
Champ in-the-making
Champ in-the-making
Hi everybody,

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.
25 REPLIES 25

need
Champ in-the-making
Champ in-the-making
Thanks,

this is mine:

<?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>

there is a way to create a generic structure of the eclipse for webscript written in Java instead of JavaScript? I found this link http://code.google.com/p/share-extras/wiki/SampleProject but does not speak of java becked webscripts.

Thanks…

allen87
Champ in-the-making
Champ in-the-making
Thanks for the link. Have you found another thing about webscript in JAVA ?

need
Champ in-the-making
Champ in-the-making
Hi,

no don't work for me webscript in java. Can you give me the your project? I try with your java sample project.

The ideal thing would be to find a sort of skeleton for the eclipse, which could represent a generic structure for java becked webscript can apply for any customization.

Then you should be able to build a generic build.xml file that generates the jar to be included in tomcat/shared/lib.

You have the documentation to do this for Alfresco Share 3.4+? I have found out only documents dated and confusing.

Thanks.

allen87
Champ in-the-making
Champ in-the-making
All i have is a Java class, a .ftl and a .xml file, no more.
Look at my first posts at the beginning.

Thanks

need
Champ in-the-making
Champ in-the-making
hi,
thanks, you do not have a jar file? you have only java class?

need
Champ in-the-making
Champ in-the-making
Hi Allen,

now I have no errors but if I go into page share webscript and I refresh do not load the new webscripts. what wrong?

Thanks!

allen87
Champ in-the-making
Champ in-the-making
I have the same problem, there's no new webscripts and I don't know why…

need
Champ in-the-making
Champ in-the-making
hi,

you have resolved your ptoblem?

thanks

dejal33t
Champ in-the-making
Champ in-the-making
Hi,

Have you resolved the problem with the webscript in Alfresco Share?
I have the same problem in version 4.0.

Thanks.

ddraper
World-Class Innovator
World-Class Innovator
Hi,

I just wanted to check that you've seen the documentation at: http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples ? The bean name starting with "webscript." is important and the following package structure needs to match the package structure of the other files associated with the WebScript, you also need to ensure that it ends in the appropriate REST method (e.g. ".get" or ".post").

For example a bean with the id "webscript.org.springframework.extensions.webscripts.index.get" will map to the WebScript "<store-home>/org/springframework/extensions/webscripts/index.get.desc.xml" (where <store-home> it the location at which the WebScript is found).

Hopefully this answers your question,

Regards,
Dave
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.