Java Backed Web Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2012 05:25 AM
Where i can see a full tutorial how to create and deploy Java Backed Web Scripts in Alfresco 4?
I made that in Alfresco 3, but now i know there are changes!
Can anyone provide a good tutorial please?
thanks in advance!
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2012 03:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2012 03:44 AM
CreateFoldersMigration.get.json
If I'm not wrong the response file name should be in the form CreateFoldersMigration.<HTTP method>.<response format>, so try naming the response file as CreateFoldersMigration.get.json.ftl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2012 04:33 AM
I have the description file. I need other file? In what location?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2012 04:43 AM
1) a desc xml field that contains configuration
2) a js file with doing the backend work (like a controller that provides you the filled model)
3) a ftl file that helps you to show the results
When you build up a Java backed webscript, you replace the point 2) with a Java implementation but you still need to have the other two files.
Look at https://wiki.alfresco.com/wiki/Web_Scripts#How_Do_I_Create_a_Web_Script.3F for more info.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2012 03:20 PM
http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples
There's no mention of an ftl template. It gives the impression that none is needed, and that the web script will simply return json. Can someone clarify? Also, can someone tell me how to structure the AMP file? The tutorial tells me where the files should end up, but shouldn't that happen by way of the amping process? I don't want to edit files in the webapps/alfresco directory. Also, the tutorial has me editing the existing web-scripts-application-context.xml file, but isn't that in alfresco.war? I don't want to modify that except by amping. Any help is appreciated. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2012 03:56 PM
http://code.google.com/p/alfresco-java-backed-webscripts-demo/
This is the same project mentioned in the wiki page here:
http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples#The_Demo_Web_Scripts
There's no mention of an ftl template. It gives the impression that none is needed, and that the web script will simply return json. Can someone clarify?If you don't want to define an FTL template in output, because you have a Java library that can generate the output, then you have to implement an AbstractWebScript that allows you to manage directly the response object of the HTTP request without defining any FTL template.
So you have two types of Java-Backed WebScripts: AbstractWebScript and DeclarativeWebScript.
The AbstractWebScript, as described above, allows you to manage the response in the execute method like any other MVC framework. For this type of implementation you only need to provide the descriptor and the Java controller class that in this case will also manage the output.
The DeclarativeWebScript follows all the pattern defined, this means that you need to define the descriptor, the Java controller and the FTL template.
Also, can someone tell me how to structure the AMP file? The tutorial tells me where the files should end up, but shouldn't that happen by way of the amping process?You can take a look at the Google Code project to understand how to build your own amp simply using the same approach.
Hope this helps :wink:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2012 08:33 PM
It's true that you don't need an ftl file.
Here's the structure of the amp file:
- config
- alfresco
- extension
- templates
- webscripts
- org
- alfresco
- demo
- simple.get.desc.xml
- extension
- module
- mymoduleid
- log4j.properties
- module-context.xml
- lib
- mymodule.jar
- module.properties
There's a lot here that isn't mentioned in the tutorial. In some places, the tutorial has you directly editing files in the deployed alfresco/webapps directory, which I think should be avoided.
Note that the bean definition goes in module-context.xml.
"mymoduleid" is whatever you put in module.id in the module.properties file (no mention of this in the tutorial).
The structure of mymodule.jar is:
- META-INF
- MANIFEST.MF
- org
- alfresco
- module
- demoscripts
- SimpleWebScript.class
I hope this is helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2012 02:28 AM
Refer http://wiki.alfresco.com/wiki/AMP_Files for AMP help.
You can independently also deploy webscript.
1. Create custom-webscript-context.xml file and add your webscript bean there.
2. You can create ftl file and keep it blank if you don't want to use webscript for presentation.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2012 05:37 AM
in order to have more info about webscripts in general and about java backed ones, you could refer to this useful doc by jpotts
http://ecmarchitect.com/images/articles/alfresco-webscripts/web-script-article.pdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2012 08:28 AM
I am trying to deploy the amp with all the examples but I am having some problems as I am using:
Alfresco Enterprise v4.0.1
(897) schema 5028
Spring Surf and Spring WebScripts - v1.0.0
(Release 1044)
The error message that I am getting when executing the ./apply_amps.sh is "07310000 The module (Alfresco Java-Backed WebScripts Samples) cannot be installed on a repo version greater than 2.1"
I know I can change the module.properties inside the .amp and add some comments in:
# The following optional properties can be used to prevent the module from being added
# to inappropriate versions of the WAR file.
#module.repo.version.min=2.0
#module.repo.version.max=2.1
so the amp will be deployed but I am not sure it will work properly.
Is there any updated version of the .amp? If not can you please help me to change the .amp so it will works with my Alfresco version?
Many thanks,
