Changeset 5746
- Timestamp:
- Sep 15, 2011, 1:42:31 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/misc/compiler/net/sf/basedb/clients/web/extensions/XJspCompiler.java
r4512 r5746 64 64 65 65 /** 66 The location where the extension system is looking for extensions.67 */68 public static final String EXTENSIONS_URL = "/WEB-INF/extensions";69 70 /**71 66 The location where the extensions resources are extracted. 72 67 */ … … 80 75 Pattern.compile(RESOURCES_URL + "/([^/]+)/(.+\\.xjsp)"); 81 76 77 // The path to the plug-ins directory 78 private File pluginsDir; 82 79 // If this JSP is an extensions JSP 83 80 private boolean isXJsp; … … 100 97 */ 101 98 @Override 102 public void init(JspCompilationContext ctxt, JspServletWrapper jsw) 103 { 99 public void init(JspCompilationContext ctxt, JspServletWrapper jsw) 100 { 101 super.init(ctxt, jsw); 104 102 String jspName = ctxt.getJspFile(); 103 if (log.isDebugEnabled()) 104 { 105 log.debug("Initialising XJSP compiler for file: " + jspName); 106 } 105 107 Matcher m = PATH_MATCH.matcher(jspName); 106 108 if (m.matches()) 107 109 { 108 110 String jarName = m.group(1); 109 String jarPath = ctxt.getRealPath(EXTENSIONS_URL + "/" + jarName);110 extensionsJar = new File( jarPath);111 File pluginsDir = getPluginsDir(); 112 extensionsJar = new File(pluginsDir, jarName); 111 113 isXJsp = extensionsJar.exists(); 112 } 113 if (log.isDebugEnabled()) 114 { 115 log.debug("Initialising XJSP compiler for file: " + jspName + 116 "; JAR=" + extensionsJar + "; isXJsp=" + isXJsp); 117 } 118 super.init(ctxt, jsw); 114 } 115 if (log.isDebugEnabled()) 116 { 117 log.debug("JAR=" + extensionsJar + "; isXJsp=" + isXJsp); 118 } 119 119 } 120 120 … … 201 201 protected ClassLoader getWebAppClassLoader() 202 202 { 203 return ctxt.getRuntimeContext().getParentClassLoader(); 204 } 205 203 return getCompilationContext().getRuntimeContext().getParentClassLoader(); 204 } 205 206 /** 207 Get the path to the plug-in directory from BASE. 208 @since 3.0 209 */ 210 protected File getPluginsDir() 211 { 212 if (pluginsDir == null) 213 { 214 try 215 { 216 ClassLoader webAppLoader = getWebAppClassLoader(); 217 Class<?> appClass = Class.forName("net.sf.basedb.core.Application", true, webAppLoader); 218 Method getPluginsDirectory = appClass.getMethod("getPluginsDirectory"); 219 pluginsDir = (File)getPluginsDirectory.invoke(null); 220 } 221 catch (Exception ex) 222 { 223 log.error("Could not get plug-ins directory", ex); 224 } 225 } 226 return pluginsDir; 227 } 206 228 207 229 }
Note: See TracChangeset
for help on using the changeset viewer.