package com.mycompany;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.repo.model.Repository;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.ScriptLogger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class SimpleServiceJava extends DeclarativeWebScript {
private Repository repository;
// http://www.abstractive.ca/home/blog/~/blog/tim.frith/better_alfresco_script_logging
protected static final Log logger = LogFactory.getLog(ScriptLogger.class);
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) throws org.springframework.extensions.webscripts.WebScriptException
{
// get parameter verbose={verbose?}
String verboseArg = req.getParameter("verbose");
Boolean verbose = Boolean.parseBoolean(verboseArg);
// get parameter /simpleservicejava/{folderpath}
Map<String, String> templateArgs = req.getServiceMatch().getTemplateVars();
String folderPath = templateArgs.get("folderpath");
logger.error("Test under Java-backed Controller -> " + req.getParameter("verbose") + " " + templateArgs.get("folderpath"));
// construct model for response template to render
Map<String, Object> model = new HashMap<String, Object>();
model.put("verbose", verbose);
model.put("folder", folderPath);
return model;
}
public void setRepository(Repository repository)
{
this.repository = repository;
}
}
Archive content from product discussions in Italian.
This group is now closed and content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.