From b9873621d5384a70bba76afe0e1e3debe421f8fa Mon Sep 17 00:00:00 2001 From: kohsuke Date: Mon, 5 Nov 2007 18:59:23 +0000 Subject: [PATCH] adding error diagnostics as to where servlet API is loaded from. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5706 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/WebAppMain.java | 2 +- .../util/IncompatibleServletVersionDetected.java | 14 ++++++++++++++ .../IncompatibleServletVersionDetected/index.jelly | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java index f9862f8121..a98ebf9f96 100644 --- a/core/src/main/java/hudson/WebAppMain.java +++ b/core/src/main/java/hudson/WebAppMain.java @@ -75,7 +75,7 @@ public class WebAppMain implements ServletContextListener { try { ServletResponse.class.getMethod("setCharacterEncoding",String.class); } catch (NoSuchMethodException e) { - context.setAttribute(APP,new IncompatibleServletVersionDetected()); + context.setAttribute(APP,new IncompatibleServletVersionDetected(ServletResponse.class)); return; } diff --git a/core/src/main/java/hudson/util/IncompatibleServletVersionDetected.java b/core/src/main/java/hudson/util/IncompatibleServletVersionDetected.java index bfe9adf38c..539712e359 100644 --- a/core/src/main/java/hudson/util/IncompatibleServletVersionDetected.java +++ b/core/src/main/java/hudson/util/IncompatibleServletVersionDetected.java @@ -1,5 +1,10 @@ package hudson.util; +import hudson.remoting.Which; + +import java.io.File; +import java.io.IOException; + /** * Model object used to display the error top page if * we find out that the container doesn't support servlet 2.4. @@ -10,4 +15,13 @@ package hudson.util; * @author Kohsuke Kawaguchi */ public class IncompatibleServletVersionDetected { + private final Class servletClass; + + public IncompatibleServletVersionDetected(Class servletClass) { + this.servletClass = servletClass; + } + + public File getWhereServletIsLoaded() throws IOException { + return Which.jarFile(servletClass); + } } diff --git a/core/src/main/resources/hudson/util/IncompatibleServletVersionDetected/index.jelly b/core/src/main/resources/hudson/util/IncompatibleServletVersionDetected/index.jelly index 7995ed8f97..4227cb640f 100644 --- a/core/src/main/resources/hudson/util/IncompatibleServletVersionDetected/index.jelly +++ b/core/src/main/resources/hudson/util/IncompatibleServletVersionDetected/index.jelly @@ -5,9 +5,9 @@

[!]Error

- We detected that your servlet container does not support Servlet 2.4. + We detected that your servlet container does not support Servlet 2.4 + (servlet API is loaded from ${it.whereServletIsLoaded})

-
\ No newline at end of file -- GitLab