From c7fddafa1e87172db4932c77ef38bd680f6aa894 Mon Sep 17 00:00:00 2001 From: David Caruana Date: Wed, 6 Jun 2007 11:57:42 +0000 Subject: [PATCH] Web Scripts: - addition of extension paths for web script customisations - updated "delete ticket" web script to return appropriate response on success git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5867 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/bootstrap-context.xml | 4 +++ .../bootstrap/webScriptsExtensions.xml | 34 +++++++++++++++++++ .../alfresco/bootstrap/webscripts/readme.html | 2 +- .../bootstrap/webscripts/readmeExtension.html | 1 + .../messages/patch-service.properties | 1 + .../alfresco/patch/patch-services-context.xml | 18 ++++++++++ config/alfresco/version.properties | 2 +- 7 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 config/alfresco/bootstrap/webScriptsExtensions.xml create mode 100644 config/alfresco/bootstrap/webscripts/readmeExtension.html diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml index cded220fcb..eea9358eca 100644 --- a/config/alfresco/bootstrap-context.xml +++ b/config/alfresco/bootstrap-context.xml @@ -187,6 +187,10 @@ /${spaces.company_home.childname}/${spaces.dictionary.childname} alfresco/bootstrap/webScripts.xml + + /${spaces.company_home.childname}/${spaces.dictionary.childname} + alfresco/bootstrap/webScriptsExtensions.xml + diff --git a/config/alfresco/bootstrap/webScriptsExtensions.xml b/config/alfresco/bootstrap/webScriptsExtensions.xml new file mode 100644 index 0000000000..76b4c5bd91 --- /dev/null +++ b/config/alfresco/bootstrap/webScriptsExtensions.xml @@ -0,0 +1,34 @@ + + + + + + + + Customized Web Scripts + space-icon-default + URL addressable Web Service Extensions + Web Scripts Extensions + + + + + + + + + + + true + How to customize an existing Web Script + contentUrl=classpath:alfresco/bootstrap/webscripts/readmeExtension.html|mimetype=text/html|size=|encoding=UTF-8|locale=en_US_ + + + readme.html + + + + + + + \ No newline at end of file diff --git a/config/alfresco/bootstrap/webscripts/readme.html b/config/alfresco/bootstrap/webscripts/readme.html index 360ce3e90c..84bacba322 100644 --- a/config/alfresco/bootstrap/webscripts/readme.html +++ b/config/alfresco/bootstrap/webscripts/readme.html @@ -1 +1 @@ -

Web Scripts  

Documentation on how to develop a Web Script may be found here.

Web Scripts allow you to bind new Alfresco-based functionality to a HTTP method and custom URL. A library of URLs may be built up to provide a complete API accessible via HTTP.  They are ideal for building data access & update APIs and simple UI components such as Portlets.  Development of Web Scripts may be performed within Alfresco.  Knowledge of Java is not required.

For example, you could create the following API for your particular application...

Execute a search

GET http://<host>:<port>/alfresco/service/blog/category?c=Web20

Retrieve meta-data for an item in the repository

GET http://<host>:<port>/alfresco/service/blog/2007/03/04/new-release

Update meta-data for an item in the repository

POST http://<host>:<port>/alfresco/service/blog/2007/03/04/new-release?status=Draft

Delete an item in the repository

DELETE http://<host>:<port>/alfresco/service/blog/2007/03/04/new-release

\ No newline at end of file +

Web Scripts

Documentation on how to develop a Web Script may be found here.

Web Scripts allow you to bind new Alfresco-based functionality to a HTTP method and custom URL. A library of URLs may be built up to provide a complete API accessible via HTTP.  They are ideal for building data access & update APIs and simple UI components such as Portlets.  Development of Web Scripts may be performed within Alfresco.  Knowledge of Java is not required.

For example, you could create the following API for your particular application...

Execute a search

GET http://<host>:<port>/alfresco/service/blog/category?c=Web20

Retrieve meta-data for an item in the repository

GET http://<host>:<port>/alfresco/service/blog/2007/03/04/new-release

Update meta-data for an item in the repository

POST http://<host>:<port>/alfresco/service/blog/2007/03/04/new-release?status=Draft

Delete an item in the repository

DELETE http://<host>:<port>/alfresco/service/blog/2007/03/04/new-release

\ No newline at end of file diff --git a/config/alfresco/bootstrap/webscripts/readmeExtension.html b/config/alfresco/bootstrap/webscripts/readmeExtension.html new file mode 100644 index 0000000000..bd41188310 --- /dev/null +++ b/config/alfresco/bootstrap/webscripts/readmeExtension.html @@ -0,0 +1 @@ +

How to Customize a Web Script

Documentation on how to develop a Web Script may be found here.

Any part of a Web Script (i.e. its description, "execute" javascript, or "response" template) may be overridden.   This is achieved by copying the original part to this extension folder.  The folder within which the part lives must be replicated in this extension area too.

e.g. to override the html output of the "Keyword search" script...

copy

/Data Dictionary/Web Scripts/org/alfresco/repository/keywordsearch.get.html.ftl

to

/Data Dictionary/Web Scripts Extensions/org/alfresco/repository/keywordsearch.get.html.ftl

Once copied, you can make your changes to the copy.

To ensure your override is registered, go to /alfresco/service/ and click on the "Refresh List of Web Scripts" button.  The next invocation of the web script will include your override.

\ No newline at end of file diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties index 126913bd5f..dd6d909591 100644 --- a/config/alfresco/messages/patch-service.properties +++ b/config/alfresco/messages/patch-service.properties @@ -150,3 +150,4 @@ patch.AVMLayeredSnapshotPatch.description=Set indirectionVersion on Layered Node patch.AVMLayeredSnapshotPatch.result=Layered Node indirectionVersions set. patch.webscripts.description=Adds Web Scripts to Data Dictionary. +patch.webscriptsExtension.description=Adds Web Scripts Extension to Data Dictionary. diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml index 157f6ec0d1..16f5a50861 100644 --- a/config/alfresco/patch/patch-services-context.xml +++ b/config/alfresco/patch/patch-services-context.xml @@ -764,5 +764,23 @@ classpath:alfresco/dbscripts/upgrade/2.1/${db.script.dialect}/AlfrescoSchemaUpdate-2.1-VersionColumns.sql + + + patch.webscriptsExtension + patch.webscriptsExtension.description + 0 + 54 + 55 + + + + + + + /${spaces.company_home.childname}/${spaces.dictionary.childname} + alfresco/bootstrap/webScriptsExtensions.xml + + + diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties index 05f7fb9b83..e722b2790c 100644 --- a/config/alfresco/version.properties +++ b/config/alfresco/version.properties @@ -19,4 +19,4 @@ version.build=@build-number@ # Schema number -version.schema=54 +version.schema=55