Allow a local resource to override js scripts

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@405482 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gregory John Wilkins 2006-05-09 17:40:11 +00:00
parent c4b11a6396
commit fedc03939c
1 changed files with 12 additions and 1 deletions

View File

@ -17,6 +17,7 @@ package org.apache.activemq.web;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@ -47,7 +48,17 @@ public class AjaxServlet extends MessageListenerServlet {
super.doGet(request, response);
}
protected void doJavaScript(HttpServletRequest request, HttpServletResponse response)throws IOException {
protected void doJavaScript(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException {
// Look for a local resource first.
URL url = getServletContext().getResource(request.getServletPath()+request.getPathInfo());
if (url!=null)
{
getServletContext().getRequestDispatcher(request.getServletPath()+request.getPathInfo()).forward(request,response);
return;
}
// Serve from the classpath resources
String resource="org/apache/activemq/web"+request.getPathInfo();
synchronized(jsCache){