mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
1) Consolidate creation of template image resolver in Web Scripts
2) Add Help to stand-alone Web Scripts test server 3) Add server-side JavaScript Debugger git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5385 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,13 +0,0 @@
|
|||||||
processDefinitionsList=Process Definitions List
|
|
||||||
searchProcessInstances=Search Process Instances
|
|
||||||
processDefinitions=Process Definitions
|
|
||||||
variableName=Variable Name
|
|
||||||
variableValue=Variable Value
|
|
||||||
search=Search
|
|
||||||
id=Id
|
|
||||||
name=Name
|
|
||||||
version=Version
|
|
||||||
instances=Instances
|
|
||||||
start=Start
|
|
||||||
end=End
|
|
||||||
value=Value
|
|
37
config/alfresco/messages/webscripts-test-help.txt
Normal file
37
config/alfresco/messages/webscripts-test-help.txt
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
##
|
||||||
|
## Meta commands
|
||||||
|
##
|
||||||
|
|
||||||
|
ok> help
|
||||||
|
|
||||||
|
List this help.
|
||||||
|
|
||||||
|
ok> r
|
||||||
|
|
||||||
|
Repeat last command.
|
||||||
|
|
||||||
|
ok> user [<userName>]
|
||||||
|
|
||||||
|
Switch to specified <userName>. If <userName> is omitted, the currently
|
||||||
|
selected user is shown.
|
||||||
|
|
||||||
|
ok> quit | exit
|
||||||
|
|
||||||
|
Quit this Web Script server.
|
||||||
|
|
||||||
|
##
|
||||||
|
## HTTP Requests
|
||||||
|
##
|
||||||
|
|
||||||
|
ok> get <path>
|
||||||
|
|
||||||
|
Issue a HTTP GET request to the Web Script located at <path>. The response
|
||||||
|
is dumped to the console.
|
||||||
|
|
||||||
|
<path> URL relative to /alfresco/service
|
||||||
|
|
||||||
|
e.g. get /blog/category?c=Web20
|
||||||
|
|
||||||
|
##
|
||||||
|
## end
|
||||||
|
##
|
1
config/alfresco/messages/webscripts.properties
Normal file
1
config/alfresco/messages/webscripts.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
testserver.help=alfresco/messages/webscripts-test-help.txt
|
@@ -14,6 +14,15 @@
|
|||||||
</bean>
|
</bean>
|
||||||
</property>
|
</property>
|
||||||
<property name="transactionService" ref="transactionComponent" />
|
<property name="transactionService" ref="transactionComponent" />
|
||||||
|
<property name="messages">
|
||||||
|
<bean class="org.springframework.context.support.ResourceBundleMessageSource">
|
||||||
|
<property name="basenames">
|
||||||
|
<list>
|
||||||
|
<value>alfresco/messages/webscripts</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -37,12 +37,10 @@ import org.alfresco.service.ServiceRegistry;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.ScriptLocation;
|
import org.alfresco.service.cmr.repository.ScriptLocation;
|
||||||
import org.alfresco.service.cmr.repository.TemplateExtensionImplementation;
|
import org.alfresco.service.cmr.repository.TemplateExtensionImplementation;
|
||||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
|
||||||
import org.alfresco.service.cmr.repository.TemplateNode;
|
import org.alfresco.service.cmr.repository.TemplateNode;
|
||||||
import org.alfresco.service.descriptor.DescriptorService;
|
import org.alfresco.service.descriptor.DescriptorService;
|
||||||
import org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication;
|
import org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication;
|
||||||
import org.alfresco.web.scripts.WebScriptDescription.RequiredTransaction;
|
import org.alfresco.web.scripts.WebScriptDescription.RequiredTransaction;
|
||||||
import org.alfresco.web.ui.common.Utils;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,6 +61,7 @@ public abstract class AbstractWebScript implements WebScript
|
|||||||
// Initialisation
|
// Initialisation
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param scriptContext
|
* @param scriptContext
|
||||||
*/
|
*/
|
||||||
@@ -246,15 +245,6 @@ public abstract class AbstractWebScript implements WebScript
|
|||||||
// create template model
|
// create template model
|
||||||
Map<String, Object> model = new HashMap<String, Object>(7, 1.0f);
|
Map<String, Object> model = new HashMap<String, Object>(7, 1.0f);
|
||||||
|
|
||||||
// create an image resolver
|
|
||||||
TemplateImageResolver imageResolver = new TemplateImageResolver()
|
|
||||||
{
|
|
||||||
public String resolveImagePathForName(String filename, boolean small)
|
|
||||||
{
|
|
||||||
return Utils.getFileTypeImage(getWebScriptRegistry().getContext(), filename, small);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// add repository context
|
// add repository context
|
||||||
if (getDescription().getRequiredAuthentication() != RequiredAuthentication.none &&
|
if (getDescription().getRequiredAuthentication() != RequiredAuthentication.none &&
|
||||||
getDescription().getRequiredTransaction() != RequiredTransaction.none)
|
getDescription().getRequiredTransaction() != RequiredTransaction.none)
|
||||||
@@ -286,7 +276,7 @@ public abstract class AbstractWebScript implements WebScript
|
|||||||
// the extensions include custom root helper objects and custom template method objects
|
// the extensions include custom root helper objects and custom template method objects
|
||||||
for (TemplateExtensionImplementation ext : serviceRegistry.getTemplateService().getExtensions())
|
for (TemplateExtensionImplementation ext : serviceRegistry.getTemplateService().getExtensions())
|
||||||
{
|
{
|
||||||
ext.setTemplateImageResolver(imageResolver);
|
ext.setTemplateImageResolver(getWebScriptRegistry().getTemplateImageResolver());
|
||||||
model.put(ext.getExtensionName(), ext);
|
model.put(ext.getExtensionName(), ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,9 +36,11 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||||
import org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication;
|
import org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication;
|
||||||
import org.alfresco.web.scripts.WebScriptDescription.RequiredTransaction;
|
import org.alfresco.web.scripts.WebScriptDescription.RequiredTransaction;
|
||||||
import org.alfresco.web.scripts.WebScriptDescription.URI;
|
import org.alfresco.web.scripts.WebScriptDescription.URI;
|
||||||
|
import org.alfresco.web.ui.common.Utils;
|
||||||
import org.aopalliance.intercept.MethodInterceptor;
|
import org.aopalliance.intercept.MethodInterceptor;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -49,6 +51,7 @@ import org.dom4j.io.SAXReader;
|
|||||||
import org.springframework.aop.framework.ProxyFactory;
|
import org.springframework.aop.framework.ProxyFactory;
|
||||||
import org.springframework.aop.support.RegexpMethodPointcutAdvisor;
|
import org.springframework.aop.support.RegexpMethodPointcutAdvisor;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.web.context.ServletContextAware;
|
import org.springframework.web.context.ServletContextAware;
|
||||||
@@ -59,7 +62,7 @@ import org.springframework.web.context.ServletContextAware;
|
|||||||
*
|
*
|
||||||
* @author davidc
|
* @author davidc
|
||||||
*/
|
*/
|
||||||
public class DeclarativeWebScriptRegistry implements WebScriptRegistry, ApplicationContextAware, ServletContextAware
|
public class DeclarativeWebScriptRegistry implements WebScriptRegistry, ApplicationContextAware, ServletContextAware, InitializingBean
|
||||||
{
|
{
|
||||||
// Logger
|
// Logger
|
||||||
private static final Log logger = LogFactory.getLog(DeclarativeWebScriptRegistry.class);
|
private static final Log logger = LogFactory.getLog(DeclarativeWebScriptRegistry.class);
|
||||||
@@ -72,6 +75,8 @@ public class DeclarativeWebScriptRegistry implements WebScriptRegistry, Applicat
|
|||||||
private MethodInterceptor serviceTransaction;
|
private MethodInterceptor serviceTransaction;
|
||||||
private FormatRegistry formatRegistry;
|
private FormatRegistry formatRegistry;
|
||||||
private WebScriptStorage storage;
|
private WebScriptStorage storage;
|
||||||
|
private TemplateImageResolver imageResolver;
|
||||||
|
|
||||||
|
|
||||||
// map of web scripts by id
|
// map of web scripts by id
|
||||||
// NOTE: The map is sorted by id (ascending order)
|
// NOTE: The map is sorted by id (ascending order)
|
||||||
@@ -161,7 +166,20 @@ public class DeclarativeWebScriptRegistry implements WebScriptRegistry, Applicat
|
|||||||
{
|
{
|
||||||
this.applicationContext = applicationContext;
|
this.applicationContext = applicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||||
|
*/
|
||||||
|
public void afterPropertiesSet() throws Exception
|
||||||
|
{
|
||||||
|
this.imageResolver = new TemplateImageResolver()
|
||||||
|
{
|
||||||
|
public String resolveImagePathForName(String filename, boolean small)
|
||||||
|
{
|
||||||
|
return Utils.getFileTypeImage(getContext(), filename, small);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise Web Scripts
|
* Initialise Web Scripts
|
||||||
@@ -516,6 +534,14 @@ public class DeclarativeWebScriptRegistry implements WebScriptRegistry, Applicat
|
|||||||
return this.storage.getTemplateProcessor();
|
return this.storage.getTemplateProcessor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.web.scripts.WebScriptRegistry#getTemplateImageResolver()
|
||||||
|
*/
|
||||||
|
public TemplateImageResolver getTemplateImageResolver()
|
||||||
|
{
|
||||||
|
return this.imageResolver;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.web.scripts.WebScriptRegistry#getScriptProcessor()
|
* @see org.alfresco.web.scripts.WebScriptRegistry#getScriptProcessor()
|
||||||
*/
|
*/
|
||||||
|
@@ -33,11 +33,11 @@ import java.io.PrintStream;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
import org.alfresco.i18n.I18NUtil;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.mock.web.MockHttpServletRequest;
|
import org.springframework.mock.web.MockHttpServletRequest;
|
||||||
@@ -64,6 +64,9 @@ public class TestWebScriptServer
|
|||||||
/** Current user */
|
/** Current user */
|
||||||
private String username = "admin";
|
private String username = "admin";
|
||||||
|
|
||||||
|
/** I18N Messages */
|
||||||
|
private MessageSource m_messages;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the transaction service
|
* Sets the transaction service
|
||||||
@@ -85,16 +88,27 @@ public class TestWebScriptServer
|
|||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Messages resource bundle
|
||||||
|
*
|
||||||
|
* @param messages
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void setMessages(MessageSource messages)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
this.m_messages = messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise the Test Web Script Server
|
* Initialise the Test Web Script Server
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void init() throws Exception
|
public void init()
|
||||||
{
|
{
|
||||||
registry.initWebScripts();
|
registry.initWebScripts();
|
||||||
fIn = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,10 +118,7 @@ public class TestWebScriptServer
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String[] CONFIG_LOCATIONS = new String[] { "classpath:alfresco/application-context.xml", "classpath:alfresco/web-scripts-application-context.xml", "classpath:alfresco/web-scripts-application-context-test.xml" };
|
TestWebScriptServer testServer = getTestServer();
|
||||||
ApplicationContext context = new ClassPathXmlApplicationContext(CONFIG_LOCATIONS);
|
|
||||||
TestWebScriptServer testServer = (TestWebScriptServer)context.getBean("webscripts.test");
|
|
||||||
testServer.init();
|
|
||||||
testServer.rep();
|
testServer.rep();
|
||||||
}
|
}
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
@@ -122,13 +133,54 @@ public class TestWebScriptServer
|
|||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve an instance of the TestWebScriptServer
|
||||||
|
*
|
||||||
|
* @return Test Server
|
||||||
|
*/
|
||||||
|
public static TestWebScriptServer getTestServer()
|
||||||
|
{
|
||||||
|
String[] CONFIG_LOCATIONS = new String[] { "classpath:alfresco/application-context.xml", "classpath:alfresco/web-scripts-application-context.xml", "classpath:alfresco/web-scripts-application-context-test.xml" };
|
||||||
|
ApplicationContext context = new ClassPathXmlApplicationContext(CONFIG_LOCATIONS);
|
||||||
|
TestWebScriptServer testServer = (TestWebScriptServer)context.getBean("webscripts.test");
|
||||||
|
testServer.init();
|
||||||
|
return testServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit a Web Script Request
|
||||||
|
*
|
||||||
|
* @param method http method
|
||||||
|
* @param uri web script uri (relative to /alfresco/service)
|
||||||
|
* @return response
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public MockHttpServletResponse submitRequest(String method, String uri)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
MockHttpServletRequest req = createRequest("get", uri);
|
||||||
|
MockHttpServletResponse res = new MockHttpServletResponse();
|
||||||
|
|
||||||
|
WebScriptMatch match = registry.findWebScript(req.getMethod(), uri);
|
||||||
|
if (match == null)
|
||||||
|
{
|
||||||
|
throw new WebScriptException("No service bound to uri '" + uri + "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
WebScriptRequest apiReq = new WebScriptRequest(req, match);
|
||||||
|
WebScriptResponse apiRes = new WebScriptResponse(res);
|
||||||
|
match.getWebScript().execute(apiReq, apiRes);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Read-Eval-Print loop.
|
* A Read-Eval-Print loop.
|
||||||
*/
|
*/
|
||||||
public void rep()
|
/*package*/ void rep()
|
||||||
{
|
{
|
||||||
// accept commands
|
// accept commands
|
||||||
|
fIn = new BufferedReader(new InputStreamReader(System.in));
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
System.out.print("ok> ");
|
System.out.print("ok> ");
|
||||||
@@ -160,12 +212,13 @@ public class TestWebScriptServer
|
|||||||
* @param line The unparsed command
|
* @param line The unparsed command
|
||||||
* @return The textual output of the command.
|
* @return The textual output of the command.
|
||||||
*/
|
*/
|
||||||
public String interpretCommand(final String line)
|
private String interpretCommand(final String line)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
// execute command in context of currently selected user
|
// execute command in context of currently selected user
|
||||||
return AuthenticationUtil.runAs(new RunAsWork<String>()
|
return AuthenticationUtil.runAs(new RunAsWork<String>()
|
||||||
{
|
{
|
||||||
|
@SuppressWarnings("synthetic-access")
|
||||||
public String doWork() throws Exception
|
public String doWork() throws Exception
|
||||||
{
|
{
|
||||||
return executeCommand(line);
|
return executeCommand(line);
|
||||||
@@ -181,7 +234,7 @@ public class TestWebScriptServer
|
|||||||
* @param line The unparsed command
|
* @param line The unparsed command
|
||||||
* @return The textual output of the command.
|
* @return The textual output of the command.
|
||||||
*/
|
*/
|
||||||
protected String executeCommand(String line)
|
private String executeCommand(String line)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
String[] command = line.split(" ");
|
String[] command = line.split(" ");
|
||||||
@@ -210,8 +263,7 @@ public class TestWebScriptServer
|
|||||||
// execute command
|
// execute command
|
||||||
if (command[0].equals("help"))
|
if (command[0].equals("help"))
|
||||||
{
|
{
|
||||||
// TODO:
|
String helpFile = m_messages.getMessage("testserver.help", null, null);
|
||||||
String helpFile = I18NUtil.getMessage("test_service.help");
|
|
||||||
ClassPathResource helpResource = new ClassPathResource(helpFile);
|
ClassPathResource helpResource = new ClassPathResource(helpFile);
|
||||||
byte[] helpBytes = new byte[500];
|
byte[] helpBytes = new byte[500];
|
||||||
InputStream helpStream = helpResource.getInputStream();
|
InputStream helpStream = helpResource.getInputStream();
|
||||||
@@ -247,18 +299,7 @@ public class TestWebScriptServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
String uri = command[1];
|
String uri = command[1];
|
||||||
MockHttpServletRequest req = createRequest("get", uri);
|
MockHttpServletResponse res = submitRequest("get", uri);
|
||||||
MockHttpServletResponse res = new MockHttpServletResponse();
|
|
||||||
|
|
||||||
WebScriptMatch match = registry.findWebScript(req.getMethod(), uri);
|
|
||||||
if (match == null)
|
|
||||||
{
|
|
||||||
throw new WebScriptException("No service bound to uri '" + uri + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
WebScriptRequest apiReq = new WebScriptRequest(req, match);
|
|
||||||
WebScriptResponse apiRes = new WebScriptResponse(res);
|
|
||||||
match.getWebScript().execute(apiReq, apiRes);
|
|
||||||
bout.write(res.getContentAsByteArray());
|
bout.write(res.getContentAsByteArray());
|
||||||
out.println();
|
out.println();
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,8 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web Scripts Registry
|
* Web Scripts Registry
|
||||||
@@ -81,6 +83,13 @@ public interface WebScriptRegistry
|
|||||||
*/
|
*/
|
||||||
public TemplateProcessor getTemplateProcessor();
|
public TemplateProcessor getTemplateProcessor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Template Image Resolver
|
||||||
|
*
|
||||||
|
* @return template image resolver
|
||||||
|
*/
|
||||||
|
public TemplateImageResolver getTemplateImageResolver();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Script Processor
|
* Gets the Script Processor
|
||||||
*
|
*
|
||||||
|
@@ -33,7 +33,6 @@ import java.util.Map;
|
|||||||
import org.alfresco.i18n.I18NUtil;
|
import org.alfresco.i18n.I18NUtil;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
|
||||||
import org.alfresco.service.cmr.repository.TemplateNode;
|
import org.alfresco.service.cmr.repository.TemplateNode;
|
||||||
import org.alfresco.service.cmr.search.ResultSet;
|
import org.alfresco.service.cmr.search.ResultSet;
|
||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
@@ -44,7 +43,6 @@ import org.alfresco.web.scripts.DeclarativeWebScript;
|
|||||||
import org.alfresco.web.scripts.WebScriptException;
|
import org.alfresco.web.scripts.WebScriptException;
|
||||||
import org.alfresco.web.scripts.WebScriptRequest;
|
import org.alfresco.web.scripts.WebScriptRequest;
|
||||||
import org.alfresco.web.scripts.WebScriptResponse;
|
import org.alfresco.web.scripts.WebScriptResponse;
|
||||||
import org.alfresco.web.ui.common.Utils;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
@@ -68,15 +66,6 @@ public class KeywordSearch extends DeclarativeWebScript
|
|||||||
// dependencies
|
// dependencies
|
||||||
protected SearchService searchService;
|
protected SearchService searchService;
|
||||||
|
|
||||||
// icon resolver
|
|
||||||
protected TemplateImageResolver iconResolver = new TemplateImageResolver()
|
|
||||||
{
|
|
||||||
public String resolveImagePathForName(String filename, boolean small)
|
|
||||||
{
|
|
||||||
return Utils.getFileTypeImage(getWebScriptRegistry().getContext(), filename, small);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param searchService
|
* @param searchService
|
||||||
*/
|
*/
|
||||||
@@ -364,7 +353,7 @@ public class KeywordSearch extends DeclarativeWebScript
|
|||||||
*/
|
*/
|
||||||
public SearchTemplateNode(NodeRef nodeRef, float score)
|
public SearchTemplateNode(NodeRef nodeRef, float score)
|
||||||
{
|
{
|
||||||
super(nodeRef, getServiceRegistry(), iconResolver);
|
super(nodeRef, getServiceRegistry(), getWebScriptRegistry().getTemplateImageResolver());
|
||||||
this.score = score;
|
this.score = score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user