From a26bd8cd98653d96ded3b75175ac3ffd15b22314 Mon Sep 17 00:00:00 2001 From: Chisu Yu Date: Tue, 13 Nov 2012 10:02:35 +0000 Subject: [PATCH] =?UTF-8?q?[=EC=9C=A0=EC=B9=98=EC=88=98]=20[NOBTS]=20add?= =?UTF-8?q?=20BLOC=20classpath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@860 84d0f5b1-2673-498c-a247-62c4ff18d310 --- .../java/com/profiler/TomcatProfiler.java | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/profiler/TomcatProfiler.java b/src/main/java/com/profiler/TomcatProfiler.java index 9fa8f6e71..488e0d5f2 100644 --- a/src/main/java/com/profiler/TomcatProfiler.java +++ b/src/main/java/com/profiler/TomcatProfiler.java @@ -47,19 +47,28 @@ public class TomcatProfiler implements ClassFileTransformer { String[] paths = getTomcatlibPath(); this.byteCodeInstrumentor = new JavaAssistByteCodeInstrumentor(paths); this.modifierRepository = createModifierRegistry(byteCodeInstrumentor); - } - private String[] getTomcatlibPath() { - String catalinaHome = System.getProperty("catalina.home"); - if (catalinaHome == null) { - return null; - } - if (logger.isLoggable(Level.INFO)) { - logger.info("CATALINA_HOME=" + catalinaHome); - } - return new String[] {catalinaHome + "/lib/servlet-api.jar", catalinaHome + "/lib/catalina.jar"}; - } + private String[] getTomcatlibPath() { + String catalinaHome = System.getProperty("catalina.home"); + + if (catalinaHome == null) { + return null; + } + + if (logger.isLoggable(Level.INFO)) { + logger.info("CATALINA_HOME=" + catalinaHome); + } + + // TODO This is draft. How can we support both Tomcat and BLOC without this configuration? + String type = System.getProperty("hippo.servertype", "tomcat"); + + if (type.equals("bloc")) { + return new String[] { catalinaHome + "/server/lib/catalina.jar", catalinaHome + "/common/lib/servlet-api.jar" }; + } else { + return new String[] { catalinaHome + "/lib/servlet-api.jar", catalinaHome + "/lib/catalina.jar" }; + } + } private ModifierRegistry createModifierRegistry(ByteCodeInstrumentor byteCodeInstrumentor) { DefaultModifierRegistry modifierRepository = new DefaultModifierRegistry(byteCodeInstrumentor, profilerConfig);