OpenSearch

- integrate Alfresco Web Client authentication (login page)
- small refactoring of api service initialisation

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4734 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2007-01-05 11:43:40 +00:00
parent 14b455eb62
commit 65389a8e03
8 changed files with 210 additions and 26 deletions

View File

@@ -17,7 +17,9 @@
package org.alfresco.web.api;
import java.io.IOException;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -52,7 +54,8 @@ public class APIServlet extends BaseServlet
// Retrieve all web api services and index by http url & http method
ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
apiServiceRegistry = new APIServiceRegistry(getServletContext(), context);
initContext(context);
apiServiceRegistry = new APIServiceRegistry(context);
}
@@ -109,4 +112,19 @@ public class APIServlet extends BaseServlet
}
}
/**
* Initialise any API beans that require a servlet context
*
* @param appContext application context
*/
private void initContext(ApplicationContext appContext)
{
ServletContext servletContext = getServletContext();
Map<String, APIContextAware> contextAwareMap = appContext.getBeansOfType(APIContextAware.class, false, false);
for (APIContextAware contextAware: contextAwareMap.values())
{
contextAware.setAPIContext(servletContext);
}
}
}