From fedc03939cc1d5f4746991a457abdba6e2b402d7 Mon Sep 17 00:00:00 2001 From: Gregory John Wilkins Date: Tue, 9 May 2006 17:40:11 +0000 Subject: [PATCH] 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 --- .../java/org/apache/activemq/web/AjaxServlet.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/activemq-web/src/main/java/org/apache/activemq/web/AjaxServlet.java b/activemq-web/src/main/java/org/apache/activemq/web/AjaxServlet.java index 7b6d572443..8e127e5aec 100644 --- a/activemq-web/src/main/java/org/apache/activemq/web/AjaxServlet.java +++ b/activemq-web/src/main/java/org/apache/activemq/web/AjaxServlet.java @@ -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){