mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
OpenSearch:
- cosmetic changes as suggested by marketing eyes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4958 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -21,10 +21,10 @@ import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.web.app.servlet.BaseServlet;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -36,7 +36,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class APIServlet extends BaseServlet
|
||||
public class APIServlet extends HttpServlet
|
||||
{
|
||||
private static final long serialVersionUID = 4209892938069597860L;
|
||||
|
||||
|
@@ -22,6 +22,7 @@ import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.repository.TemplateException;
|
||||
import org.alfresco.web.api.APIException;
|
||||
import org.alfresco.web.api.APIRequest;
|
||||
@@ -114,17 +115,25 @@ public abstract class APIServiceTemplateImpl extends APIServiceImpl
|
||||
/**
|
||||
* Simple test that can be executed outside of web context
|
||||
*/
|
||||
/*package*/ void test(String format)
|
||||
/*package*/ void test(final String format)
|
||||
throws IOException
|
||||
{
|
||||
// create test model
|
||||
Map<String, Object> model = createTestModel();
|
||||
|
||||
// render service template to string
|
||||
StringWriter rendition = new StringWriter();
|
||||
PrintWriter writer = new PrintWriter(rendition);
|
||||
renderTemplate(null, format, model, writer);
|
||||
System.out.println(rendition.toString());
|
||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||
{
|
||||
public Object doWork()
|
||||
{
|
||||
// create test model
|
||||
Map<String, Object> model = createTestModel();
|
||||
|
||||
// render service template to string
|
||||
StringWriter rendition = new StringWriter();
|
||||
PrintWriter writer = new PrintWriter(rendition);
|
||||
renderTemplate(null, format, model, writer);
|
||||
System.out.println(rendition.toString());
|
||||
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -43,14 +43,14 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Alfresco Text (simple) Search Service
|
||||
* Alfresco Keyword (simple) Search Service
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class TextSearch extends APIServiceTemplateImpl
|
||||
public class KeywordSearch extends APIServiceTemplateImpl
|
||||
{
|
||||
// Logger
|
||||
private static final Log logger = LogFactory.getLog(TextSearch.class);
|
||||
private static final Log logger = LogFactory.getLog(KeywordSearch.class);
|
||||
|
||||
// search parameters
|
||||
// TODO: allow configuration of search store
|
||||
@@ -409,7 +409,7 @@ public class TextSearch extends APIServiceTemplateImpl
|
||||
public static void main(String[] args)
|
||||
throws Exception
|
||||
{
|
||||
TextSearch service = (TextSearch)APIServiceImpl.getMethod("web.api.TextSearch");
|
||||
KeywordSearch service = (KeywordSearch)APIServiceImpl.getMethod("web.api.KeywordSearch");
|
||||
service.test(APIResponse.HTML_FORMAT);
|
||||
}
|
||||
|
@@ -25,11 +25,11 @@ import org.alfresco.web.api.APIRequest.RequiredAuthentication;
|
||||
|
||||
|
||||
/**
|
||||
* Provide OpenSearch Description for an Alfresco Text (simple) Search
|
||||
* Provide OpenSearch Description for an Alfresco Keyword (simple) Search
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class TextSearchDescription extends APIServiceTemplateImpl
|
||||
public class KeywordSearchDescription extends APIServiceTemplateImpl
|
||||
{
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -79,7 +79,7 @@ public class TextSearchDescription extends APIServiceTemplateImpl
|
||||
public static void main(String[] args)
|
||||
throws Exception
|
||||
{
|
||||
TextSearchDescription service = (TextSearchDescription)APIServiceImpl.getMethod("web.api.TextSearchDescription");
|
||||
KeywordSearchDescription service = (KeywordSearchDescription)APIServiceImpl.getMethod("web.api.KeywordSearchDescription");
|
||||
service.test(APIResponse.OPENSEARCH_DESCRIPTION_FORMAT);
|
||||
}
|
||||
|
@@ -144,8 +144,11 @@ public class SearchEngines extends APIServiceTemplateImpl
|
||||
String labelId = engineConfig.getLabelId();
|
||||
if (labelId != null && labelId.length() > 0)
|
||||
{
|
||||
String i18nLabel = I18NUtil.getMessage(labelId);
|
||||
label = (i18nLabel == null) ? "$$" + labelId + "$$" : i18nLabel;
|
||||
String i18nLabel = I18NUtil.getMessage(labelId);
|
||||
if (i18nLabel == null && label == null)
|
||||
{
|
||||
label = (i18nLabel == null) ? "$$" + labelId + "$$" : i18nLabel;
|
||||
}
|
||||
}
|
||||
urls.add(new UrlTemplate(label, type, url));
|
||||
}
|
||||
|
Reference in New Issue
Block a user