Revision 4185
Added by daigle over 16 years ago
src/edu/ucsb/nceas/metacat/util/SystemUtil.java | ||
---|---|---|
266 | 266 |
} |
267 | 267 |
|
268 | 268 |
/** |
269 |
* Attempt to discover the Tomcat directory for this application. This is a
|
|
269 |
* Attempt to discover the deployment directory for this application. This is a
|
|
270 | 270 |
* best guess scenario. It is used by configuration routines before the |
271 |
* tomcat directory has been populated in metacat.properties. You should always |
|
272 |
* use getTomcatDir() instead of this method if possible. |
|
271 |
* deployment directory has been populated in metacat.properties. |
|
273 | 272 |
* |
274 | 273 |
* @param request |
275 | 274 |
* the http servlet request we will use to find the tomcat directory |
276 | 275 |
* |
277 | 276 |
* @return a string holding the tomcat directory |
278 | 277 |
*/ |
279 |
public static String discoverTomcatDir(HttpServletRequest request) {
|
|
278 |
public static String discoverDeployDir(HttpServletRequest request) {
|
|
280 | 279 |
ServletContext servletContext = request.getSession() |
281 | 280 |
.getServletContext(); |
282 | 281 |
String realPath = servletContext.getRealPath("."); |
282 |
String contextName = servletContext.getServletContextName(); |
|
283 |
String serverInfo = servletContext.getServerInfo(); |
|
284 |
String contextPath = request.getContextPath(); |
|
285 |
String servletPath = request.getServletPath(); |
|
286 |
|
|
287 |
logMetacat.debug("realPath: " + realPath); |
|
288 |
logMetacat.debug("contextName: " + contextName); |
|
289 |
logMetacat.debug("serverInfo: " + serverInfo); |
|
290 |
logMetacat.debug("contextPath: " + contextPath); |
|
291 |
logMetacat.debug("servletPath: " + servletPath); |
|
292 |
|
|
283 | 293 |
|
284 |
int webappIndex = realPath.indexOf("webapp"); |
|
294 |
return realPath; |
|
295 |
// int webappIndex = realPath.indexOf("webapp"); |
|
285 | 296 |
|
286 |
return realPath.substring(0, webappIndex - 1); |
|
297 |
// return realPath.substring(0, webappIndex - 1);
|
|
287 | 298 |
} |
288 | 299 |
|
289 | 300 |
} |
Also available in: Unified diff
Change discoverTomcatDir to discoverDeployDir