diff --git a/config/alfresco/templates/webscripts/org/alfresco/index.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/index.get.desc.xml
index 3564ad84f6..ed8b75f368 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/index.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/index.get.desc.xml
@@ -1,6 +1,6 @@
Web Scripts Documentation
Web Scripts Documentation
-
-
+ /
+ /index
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/index.post.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/index.post.desc.xml
index ba22aefe9a..d4fb788e03 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/index.post.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/index.post.desc.xml
@@ -1,5 +1,6 @@
Web Script Maintenance
Maintain index of Web Scripts
-
+ /index?reset={reset?}
+ /?reset={reset?}
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/indexall.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/indexall.get.desc.xml
index 237c2f6274..24202c551c 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/indexall.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/indexall.get.desc.xml
@@ -1,6 +1,6 @@
All Web Scripts Index
Retrieve an index of all Web Scripts
-
-
+ /index/all
+ /index/all.mediawiki
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/indexall.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/indexall.get.html.ftl
index 1409cd417b..13760d50a3 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/indexall.get.html.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/indexall.get.html.ftl
@@ -27,7 +27,7 @@
${desc.shortName}
@@ -36,6 +36,7 @@
Authentication: | ${desc.requiredAuthentication}
|
Transaction: | ${desc.requiredTransaction}
|
Format Style: | ${desc.formatStyle}
+ |
Default Format: | ${desc.defaultFormat!"Determined at run-time"}
|
|
Id: | ${desc.id}
|
Description: | ${desc.storePath}/${desc.descPath}
diff --git a/config/alfresco/templates/webscripts/org/alfresco/indexall.get.mediawiki.ftl b/config/alfresco/templates/webscripts/org/alfresco/indexall.get.mediawiki.ftl
index 89924a9b7b..b8e42bc492 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/indexall.get.mediawiki.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/indexall.get.mediawiki.ftl
@@ -28,13 +28,14 @@ The following reference provides a list of all available Web Scripts organised b
<#if desc.description??><#if desc.description?ends_with(".")>${desc.description}<#else>${desc.description}.#if><#else>#if>
<#list desc.URIs as uri>
- [http://localhost:8080/${url.serviceContext}${uri.URI} ${desc.method} ${url.serviceContext}${uri.URI}] => ${uri.format}<#if uri.format = desc.defaultFormat> (default)#if>
+ [http://localhost:8080/${url.serviceContext}${uri} ${desc.method} ${url.serviceContext}${uri}]
#list>
Requirements:
* Authentication: ${desc.requiredAuthentication}
* Transaction: ${desc.requiredTransaction}
* Format Style: ${desc.formatStyle}
+* Default Format: ${desc.defaultFormat!"Determined at run-time"}
Definition:
* Id: ${desc.id}
diff --git a/config/alfresco/templates/webscripts/org/alfresco/indexpackage.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/indexpackage.get.desc.xml
index acf14e1a17..e9ec17f38f 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/indexpackage.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/indexpackage.get.desc.xml
@@ -1,5 +1,5 @@
Web Script Package Index
Provide an index of Web Scripts for the specified Web Script package
-
+ /index/package/{package}
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/indexpackage.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/indexpackage.get.html.ftl
index ec09465dc5..cc085a5cbb 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/indexpackage.get.html.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/indexpackage.get.html.ftl
@@ -41,7 +41,7 @@
${desc.shortName}
@@ -50,6 +50,7 @@
|
Authentication: | ${desc.requiredAuthentication}
|
Transaction: | ${desc.requiredTransaction}
|
Format Style: | ${desc.formatStyle}
+ |
Default Format: | ${desc.defaultFormat!"Determined at run-time"}
|
|
Id: | ${desc.id}
|
Description: | ${desc.storePath}/${desc.descPath}
diff --git a/config/alfresco/templates/webscripts/org/alfresco/indexuri.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/indexuri.get.desc.xml
index bb252805f9..59b373972d 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/indexuri.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/indexuri.get.desc.xml
@@ -1,6 +1,6 @@
Web Script URI Index
Provide an index of Web Scripts for the specified Web Script URI
-
+ /index/uri/{uri}
argument
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/indexuri.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/indexuri.get.html.ftl
index 3d868eb476..481e1bb85f 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/indexuri.get.html.ftl
+++ b/config/alfresco/templates/webscripts/org/alfresco/indexuri.get.html.ftl
@@ -41,7 +41,7 @@
${desc.shortName}
@@ -50,6 +50,7 @@
|
Authentication: | ${desc.requiredAuthentication}
|
Transaction: | ${desc.requiredTransaction}
|
Format Style: | ${desc.formatStyle}
+ |
Default Format: | ${desc.defaultFormat!"Determined at run-time"}
|
|
Id: | ${desc.id}
|
Description: | ${desc.storePath}/${desc.descPath}
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.desc.xml
index 124b43ee1f..a2aa0c797b 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/docActions.get.desc.xml
@@ -1,7 +1,7 @@
Document Actions (Office Add-In)
Used by the Office Add-In to perform actions on managed documents
-
+ /office/docActions
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.desc.xml
index 52d7d109cc..25198cab30 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/documentDetails.get.desc.xml
@@ -1,7 +1,7 @@
Document Details (Office Add-In)
Generate the Office Add-In Document Details page
-
+ /office/documentDetails?p={path?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.desc.xml
index 4e3c0337b4..9c77b25cc1 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/getUsers.get.desc.xml
@@ -1,7 +1,7 @@
Get Users (Office Add-In)
Used by the Office Add-In to query for users
-
+ /office/getUsers?s={searchTerm}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.desc.xml
index 77b9c76578..f2000610ec 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/myAlfresco.get.desc.xml
@@ -1,7 +1,7 @@
My Alfresco (Office Add-In)
Generate the Office Add-In My Alfresco page
-
+ /office/myAlfresco?p={path?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.desc.xml
index b1ae5ea0e5..385f9f7d32 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/myTasks.get.desc.xml
@@ -1,7 +1,7 @@
My Tasks (Office Add-In)
Generate the Office Add-In My Tasks page
-
+ /office/myTasks?p={path}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.desc.xml
index 709eb59b4f..2ee8920464 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/myTasksDetail.get.desc.xml
@@ -1,7 +1,7 @@
My Tasks Detail (Office Add-In)
Generate the Office Add-In Task Detail page
-
+ /office/myTasksDetail?t={taskId}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.desc.xml
index cf02239da3..5119b2295a 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/navigation.get.desc.xml
@@ -1,7 +1,7 @@
Navigation (Office Add-In)
Generate the Office Add-In Navigation page
-
+ /office/navigation?p={path?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/search.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/search.get.desc.xml
index 64ce3cb8cb..3fb3f797db 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/search.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/search.get.desc.xml
@@ -1,7 +1,7 @@
Search (Office Add-In)
Generate the Office Add-In Search page
-
+ /office/search?p={path?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/office/searchResults.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/office/searchResults.get.desc.xml
index 932e5fc90f..b0abc57e6b 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/office/searchResults.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/office/searchResults.get.desc.xml
@@ -1,7 +1,7 @@
Search Results (Office Add-In)
Generate the Office Add-In Search Results page
-
+ /office/searchResults?search={searchString?}&maxresults={maxresults?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist.get.desc.xml
index f65d0c9b54..ec902634cc 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/doclist.get.desc.xml
@@ -1,7 +1,7 @@
Document List
Generate the Document list portlet page
-
+ /doclist?f={filter?}&p={path?}&q={query?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.desc.xml
index 40c61baec2..e45411f9d5 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.desc.xml
@@ -1,7 +1,7 @@
My Spaces
Generate the My Spaces portlet page
-
+ /myspaces?f={filter?}&p={path?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel.get.desc.xml
index 5b728da5af..e352b709de 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel.get.desc.xml
@@ -1,7 +1,7 @@
My Spaces Panel
Generate the inner panel for the My Spaces portlet page
-
+ /myspacespanel?f={filter}&p={path}&h={home}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mytasks.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/portlets/mytasks.get.desc.xml
index 52ffd55d68..c6ba362657 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mytasks.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mytasks.get.desc.xml
@@ -1,7 +1,7 @@
My Tasks
Generate the My Tasks portlet page
-
+ /mytasks?f={filter?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mytaskspanel.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/portlets/mytaskspanel.get.desc.xml
index efcc2a2a3d..1d21a8c46a 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mytaskspanel.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mytaskspanel.get.desc.xml
@@ -1,7 +1,7 @@
My Tasks Panel
Generate the Generate the inner panel for the My Tasks portlet page
-
+ /mytaskspanel?f={filter?}
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms.get.desc.xml
index 1a11b00267..83657ae268 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/mywebforms.get.desc.xml
@@ -1,7 +1,7 @@
My Web Forms
Generate the My Web Forms portlet page
-
+ /mywebforms
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/keywordsearch.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/keywordsearch.get.desc.xml
index b9a0c3b652..3e76e68de9 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/keywordsearch.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/keywordsearch.get.desc.xml
@@ -1,12 +1,12 @@
Alfresco Keyword Search (OpenSearch Enabled)
Execute Keyword Search against Alfresco Repository (Company Home and below)
-
-
-
-
-
-
-
+ /api/search/keyword.html?q={searchTerms}&p={startPage?}&c={count?}&l={language?}
+ /search/keyword.html?q={searchTerms}&p={startPage?}&c={count?}&l={language?}
+ /api/search/keyword.atom?q={searchTerms}&p={startPage?}&c={count?}&l={language?}
+ /search/keyword.atom?q={searchTerms}&p={startPage?}&c={count?}&l={language?}
+ /api/search/keyword.rss?q={searchTerms}&p={startPage?}&c={count?}&l={language?}
+ /search/keyword.rss?q={searchTerms}&p={startPage?}&c={count?}&l={language?}
+ /api/search/keyword.portlet?q={searchTerms}&p={startPage?}&c={count?}&l={language?}
guest
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/keywordsearchdescription.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/keywordsearchdescription.get.desc.xml
index cf444b8841..24cb2de83b 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/keywordsearchdescription.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/keywordsearchdescription.get.desc.xml
@@ -1,7 +1,7 @@
Keyword Search Description
OpenSearch description document for Alfresco Repository keyword search
-
-
- argument
+ /api/search/keyword/description.xml
+ /search/keyword/description.xml
+ argument
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/login.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/login.get.desc.xml
index b9bb227d1b..ba0dd31b19 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/login.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/login.get.desc.xml
@@ -1,7 +1,8 @@
Login
Establish a ticket
-
+ /api/login?u={username}&pw={password?}
+
none
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/loginticket.delete.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/loginticket.delete.desc.xml
index 244e8c1738..ec244e7a39 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/loginticket.delete.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/loginticket.delete.desc.xml
@@ -1,7 +1,8 @@
Delete Login Ticket
Delete Login Ticket
-
+ /api/login/ticket/{ticket}
+
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/loginticket.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/loginticket.get.desc.xml
index 6f5e4d2c25..7329ba1f4e 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/loginticket.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/loginticket.get.desc.xml
@@ -1,7 +1,8 @@
Get Login Ticket
Get Login Ticket
-
+ /api/login/ticket/{ticket}
+
user
required
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/searchengines.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/searchengines.get.desc.xml
index 5bbe57522d..8cb46a5e5e 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/searchengines.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/searchengines.get.desc.xml
@@ -1,8 +1,8 @@
Search Engines
Lists "search engines" registered with this Alfresco Repository
-
-
-
-
+ /api/search/engines?type={type?}
+ /search/engines?type={type?}
+ /api/search/engines.atom?type={type?}
+ /search/engines.atom?type={type?}
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/searchproxy.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/searchproxy.get.desc.xml
index 750e674a1f..8db1f02538 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/searchproxy.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/searchproxy.get.desc.xml
@@ -1,6 +1,7 @@
Proxied (OpenSearch) Search
Search engine proxy for issuing a search against a remote search engine
-
-
+ /api/search/engine/{engine}/{format}
+ /search/engine/{engine}/{format}
+
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/scriptdescription.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/scriptdescription.get.desc.xml
index 13ac8aa079..4818b090c9 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/scriptdescription.get.desc.xml
+++ b/config/alfresco/templates/webscripts/org/alfresco/scriptdescription.get.desc.xml
@@ -1,6 +1,6 @@
Web Script Description
Retrieve description document for identified Web Script
-
+ /description/{serviceId}
argument
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/xml.status.ftl b/config/alfresco/templates/webscripts/xml.status.ftl
index d7328eeddc..fac7cf5bf6 100644
--- a/config/alfresco/templates/webscripts/xml.status.ftl
+++ b/config/alfresco/templates/webscripts/xml.status.ftl
@@ -23,9 +23,8 @@
<#list exception.stackTrace as element>
${element}
#list>
- <#else>
- ${exception}
- ${exception.stackTrace[0]}
- #if>
- |
|
+ <#else>
+ ${exception}
+ ${exception.stackTrace[0]}
+ #if>
#macro>
diff --git a/source/java/org/alfresco/web/scripts/DeclarativeWebScriptRegistry.java b/source/java/org/alfresco/web/scripts/DeclarativeWebScriptRegistry.java
index c21520dff6..f2c52b42bd 100644
--- a/source/java/org/alfresco/web/scripts/DeclarativeWebScriptRegistry.java
+++ b/source/java/org/alfresco/web/scripts/DeclarativeWebScriptRegistry.java
@@ -43,7 +43,6 @@ import org.alfresco.util.AbstractLifecycleBean;
import org.alfresco.web.scripts.WebScriptDescription.FormatStyle;
import org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication;
import org.alfresco.web.scripts.WebScriptDescription.RequiredTransaction;
-import org.alfresco.web.scripts.WebScriptDescription.URI;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -151,9 +150,18 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
*/
public void reset()
{
- getTemplateProcessor().resetCache();
- getScriptProcessor().resetCache();
- initWebScripts();
+ long startTime = System.currentTimeMillis();
+ try
+ {
+ getTemplateProcessor().resetCache();
+ getScriptProcessor().resetCache();
+ initWebScripts();
+ }
+ finally
+ {
+ if (logger.isInfoEnabled())
+ logger.info("Registered " + webscriptsById.size() + " Web Scripts " + webscriptsByURL.size() + ", URLs (in " + (System.currentTimeMillis() - startTime) + "ms)");
+ }
}
/* (non-Javadoc)
@@ -162,7 +170,7 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
@Override
protected void onBootstrap(ApplicationEvent event)
{
- initWebScripts();
+ reset();
}
/* (non-Javadoc)
@@ -178,7 +186,7 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
*
* Note: Each invocation of this method resets the list of the services
*/
- public void initWebScripts()
+ private void initWebScripts()
{
if (logger.isDebugEnabled())
logger.debug("Initialising Web Scripts");
@@ -250,17 +258,16 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
if (logger.isDebugEnabled())
logger.debug("Found Web Script " + id + " (desc: " + serviceDescPath + ", impl: " + serviceImplName + ", auth: " +
- serviceDesc.getRequiredAuthentication() + ", trx: " + serviceDesc.getRequiredTransaction() + ", format: " +
- serviceDesc.getFormatStyle() + ")");
+ serviceDesc.getRequiredAuthentication() + ", trx: " + serviceDesc.getRequiredTransaction() + ", format style: " +
+ serviceDesc.getFormatStyle() + ", default format: " + serviceDesc.getDefaultFormat() + ")");
// register service and its urls
webscriptsById.put(id, serviceImpl);
- for (URI uri : serviceDesc.getURIs())
+ for (String uriTemplate : serviceDesc.getURIs())
{
// establish static part of url template
boolean wildcard = false;
boolean extension = true;
- String uriTemplate = uri.getURI();
int queryArgIdx = uriTemplate.indexOf('?');
if (queryArgIdx != -1)
{
@@ -309,9 +316,6 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
registerURIs(serviceImpl);
}
}
-
- if (logger.isDebugEnabled())
- logger.debug("Registered " + webscriptsById.size() + " Web Scripts; " + webscriptsByURL.size() + " URLs");
}
/**
@@ -347,10 +351,10 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
private void registerURIs(WebScript script)
{
WebScriptDescription desc = script.getDescription();
- for (URI uri : desc.getURIs())
+ for (String uri : desc.getURIs())
{
Path path = uriByPath.get("/");
- String[] parts = uri.getURI().split("/");
+ String[] parts = uri.split("/");
for (String part : parts)
{
if (part.indexOf("?") != -1)
@@ -429,32 +433,25 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
{
throw new WebScriptException("Expected at least one element");
}
- List uris = new ArrayList();
+ List uris = new ArrayList();
Iterator iterElements = urlElements.iterator();
while(iterElements.hasNext())
{
// retrieve url element
Element urlElement = (Element)iterElements.next();
- // retrieve url mimetype
- String format = urlElement.attributeValue("format");
- if (format == null)
- {
- // default to unspecified format
- format = "";
- }
-
// retrieve url template
- String template = urlElement.attributeValue("template");
+ String template = urlElement.getTextTrim();
if (template == null || template.length() == 0)
{
- throw new WebScriptException("Expected template attribute on element");
+ // NOTE: for backwards compatibility only
+ template = urlElement.attributeValue("template");
+ if (template == null || template.length() == 0)
+ {
+ throw new WebScriptException("Expected element value");
+ }
}
-
- WebScriptDescriptionImpl.URIImpl uriImpl = new WebScriptDescriptionImpl.URIImpl();
- uriImpl.setFormat(format);
- uriImpl.setUri(template);
- uris.add(uriImpl);
+ uris.add(template);
}
// retrieve authentication
@@ -492,11 +489,18 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
}
// retrieve format
- String defaultFormat = uris.get(0).getFormat();
+ String defaultFormat = "html";
FormatStyle formatStyle = FormatStyle.any;
Element formatElement = rootElement.element("format");
if (formatElement != null)
{
+ // establish if default is set explicitly
+ String attrDefaultValue = formatElement.attributeValue("default");
+ if (attrDefaultValue != null)
+ {
+ defaultFormat = (attrDefaultValue.length() == 0) ? null : attrDefaultValue;
+ }
+ // establish format declaration style
String formatStyleStr = formatElement.getTextTrim();
if (formatStyleStr != null && formatStyleStr.length() > 0)
{
@@ -506,11 +510,6 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
throw new WebScriptException("Format Style '" + formatStyle + "' is not a valid value");
}
}
- String defaultFormatStr = formatElement.attributeValue("default");
- if (defaultFormatStr != null && defaultFormatStr.length() > 0)
- {
- defaultFormat = defaultFormatStr;
- }
}
// construct service description
@@ -524,7 +523,7 @@ public class DeclarativeWebScriptRegistry extends AbstractLifecycleBean
serviceDesc.setRequiredAuthentication(reqAuth);
serviceDesc.setRequiredTransaction(reqTrx);
serviceDesc.setMethod(method);
- serviceDesc.setUris(uris.toArray(new WebScriptDescription.URI[uris.size()]));
+ serviceDesc.setUris(uris.toArray(new String[uris.size()]));
serviceDesc.setDefaultFormat(defaultFormat);
serviceDesc.setFormatStyle(formatStyle);
return serviceDesc;
diff --git a/source/java/org/alfresco/web/scripts/WebScriptDescription.java b/source/java/org/alfresco/web/scripts/WebScriptDescription.java
index f276f6666d..4c43e33ebc 100644
--- a/source/java/org/alfresco/web/scripts/WebScriptDescription.java
+++ b/source/java/org/alfresco/web/scripts/WebScriptDescription.java
@@ -140,7 +140,7 @@ public interface WebScriptDescription
*
* @return array of URIs in order specified in service description document
*/
- public URI[] getURIs();
+ public String[] getURIs();
/**
* Gets the style of Format discriminator supported by this web script
@@ -149,45 +149,14 @@ public interface WebScriptDescription
*/
public FormatStyle getFormatStyle();
- /**
- * Gets a URI by format
- *
- * @param format the format
- * @return the URI (or null, if no URI registered for the format)
- */
- public URI getURI(String format);
-
/**
* Gets the default response format
*
* Note: the default response format is the first listed in the service
* description document
*
- * @return default response format
+ * @return default response format (or null, if format not known until run-time)
*/
public String getDefaultFormat();
-
- /**
- * Web Script URL
- *
- * @author davidc
- */
- public interface URI
- {
- /**
- * Gets the URI response format
- *
- * @return format
- */
- public String getFormat();
-
- /**
- * Gets the URI
- *
- * @return uri
- */
- public String getURI();
- }
-
}
diff --git a/source/java/org/alfresco/web/scripts/WebScriptDescriptionImpl.java b/source/java/org/alfresco/web/scripts/WebScriptDescriptionImpl.java
index 5832b51205..09b93f13c5 100644
--- a/source/java/org/alfresco/web/scripts/WebScriptDescriptionImpl.java
+++ b/source/java/org/alfresco/web/scripts/WebScriptDescriptionImpl.java
@@ -26,8 +26,6 @@ package org.alfresco.web.scripts;
import java.io.IOException;
import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
/**
@@ -47,9 +45,8 @@ public class WebScriptDescriptionImpl implements WebScriptDescription
private RequiredTransaction requiredTransaction;
private FormatStyle formatStyle;
private String httpMethod;
- private URI[] uris;
+ private String[] uris;
private String defaultFormat;
- private Map uriByFormat;
/**
@@ -246,32 +243,19 @@ public class WebScriptDescriptionImpl implements WebScriptDescription
*
* @param uris
*/
- public void setUris(URI[] uris)
+ public void setUris(String[] uris)
{
- this.uriByFormat = new HashMap(uris.length);
- for (URI uri : uris)
- {
- this.uriByFormat.put(uri.getFormat(), uri);
- }
this.uris = uris;
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.WebScriptDescription#getURIs()
*/
- public URI[] getURIs()
+ public String[] getURIs()
{
return this.uris;
}
- /* (non-Javadoc)
- * @see org.alfresco.web.scripts.WebScriptDescription#getURI(java.lang.String)
- */
- public URI getURI(String format)
- {
- return this.uriByFormat.get(format);
- }
-
/**
* Sets the default response format
*
@@ -290,52 +274,4 @@ public class WebScriptDescriptionImpl implements WebScriptDescription
return this.defaultFormat;
}
-
- /**
- * Web Script URL Implementation
- *
- * @author davidc
- */
- public static class URIImpl implements WebScriptDescription.URI
- {
- private String format;
- private String uri;
-
- /**
- * Sets the URI response format
- *
- * @param format
- */
- public void setFormat(String format)
- {
- this.format = format;
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.web.scripts.WebScriptDescription.URI#getFormat()
- */
- public String getFormat()
- {
- return this.format;
- }
-
- /**
- * Sets the URI
- *
- * @param uri
- */
- public void setUri(String uri)
- {
- this.uri = uri;
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.web.scripts.WebScriptDescription.URI#getURI()
- */
- public String getURI()
- {
- return this.uri;
- }
- }
-
}
|