mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Activity Service - for template store, move "path" arg to be URL extension (SLNG-777)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9832 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
<webscript>
|
<webscript>
|
||||||
<shortname>Activity Type Template</shortname>
|
<shortname>Activity Type Template</shortname>
|
||||||
<description>Get the activity type template.</description>
|
<description>Get the activity type template.</description>
|
||||||
<url>/api/activities/template?p={path}</url>
|
<url>/api/activities/template/{path}</url>
|
||||||
<url>/api/activities/template?p={path}&format=text</url>
|
<url>/api/activities/template/{path}?format=text</url>
|
||||||
<format default="text"/>
|
<format default="text">argument</format>
|
||||||
<authentication>admin</authentication>
|
<authentication>admin</authentication>
|
||||||
<transaction>required</transaction>
|
<transaction>required</transaction>
|
||||||
</webscript>
|
</webscript>
|
@@ -2,10 +2,10 @@
|
|||||||
<shortname>Activity Template Paths</shortname>
|
<shortname>Activity Template Paths</shortname>
|
||||||
<description>Get a collection of the template paths.</description>
|
<description>Get a collection of the template paths.</description>
|
||||||
<url>/api/activities/templates</url>
|
<url>/api/activities/templates</url>
|
||||||
<url>/api/activities/templates?p={path}&format=json</url>
|
<url>/api/activities/templates?format=json</url>
|
||||||
<url>/api/activities/templates?p={path}</url>
|
<url>/api/activities/templates/{path}</url>
|
||||||
<url>/api/activities/templates?p={path}&format=json</url>
|
<url>/api/activities/templates/{path}?format=json</url>
|
||||||
<format default="json"/>
|
<format default="json">argument</format>
|
||||||
<authentication>admin</authentication>
|
<authentication>admin</authentication>
|
||||||
<transaction>required</transaction>
|
<transaction>required</transaction>
|
||||||
</webscript>
|
</webscript>
|
@@ -31,6 +31,7 @@ import java.io.InputStreamReader;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.web.scripts.DeclarativeWebScript;
|
import org.alfresco.web.scripts.DeclarativeWebScript;
|
||||||
import org.alfresco.web.scripts.SearchPath;
|
import org.alfresco.web.scripts.SearchPath;
|
||||||
import org.alfresco.web.scripts.Status;
|
import org.alfresco.web.scripts.Status;
|
||||||
@@ -61,10 +62,16 @@ public class TemplateWebScript extends DeclarativeWebScript
|
|||||||
{
|
{
|
||||||
Map<String, Object> model = new HashMap<String, Object>();
|
Map<String, Object> model = new HashMap<String, Object>();
|
||||||
|
|
||||||
// process arguments
|
// process extension
|
||||||
String path = req.getParameter("p"); // required
|
String path = req.getExtensionPath(); // required
|
||||||
|
|
||||||
if ((path != null) && (path.length() != 0))
|
if ((path == null) || (path.length() == 0))
|
||||||
|
{
|
||||||
|
String msg = "Failed to getTemplate: missing {path}";
|
||||||
|
logger.error(msg);
|
||||||
|
throw new AlfrescoRuntimeException(msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (path.endsWith(".ftl"))
|
if (path.endsWith(".ftl"))
|
||||||
{
|
{
|
||||||
|
@@ -29,6 +29,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.web.scripts.DeclarativeWebScript;
|
import org.alfresco.web.scripts.DeclarativeWebScript;
|
||||||
import org.alfresco.web.scripts.SearchPath;
|
import org.alfresco.web.scripts.SearchPath;
|
||||||
import org.alfresco.web.scripts.Status;
|
import org.alfresco.web.scripts.Status;
|
||||||
@@ -53,12 +54,12 @@ public class TemplatesWebScript extends DeclarativeWebScript
|
|||||||
@Override
|
@Override
|
||||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
|
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
|
||||||
{
|
{
|
||||||
// process arguments
|
|
||||||
String p = req.getParameter("p"); // optional
|
|
||||||
|
|
||||||
String path = "/";
|
String path = "/";
|
||||||
String templatePattern = "*.ftl";
|
String templatePattern = "*.ftl";
|
||||||
|
|
||||||
|
// process extension
|
||||||
|
String p = req.getExtensionPath(); // optional
|
||||||
|
|
||||||
if ((p != null) && (p.length() > 0))
|
if ((p != null) && (p.length() > 0))
|
||||||
{
|
{
|
||||||
int idx = p.lastIndexOf("/");
|
int idx = p.lastIndexOf("/");
|
||||||
|
Reference in New Issue
Block a user