* Always immediately convert to absolute paths in ApplicationManager.
This commit is contained in:
parent
0eae6629ee
commit
32f5f25b9e
1 changed files with 19 additions and 14 deletions
|
@ -262,6 +262,17 @@ public class ApplicationManager implements XmlRpcHandler {
|
||||||
return mountpoint + "/*";
|
return mountpoint + "/*";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private File getAbsoluteFile(String path) {
|
||||||
|
// make sure our directory has an absolute path,
|
||||||
|
// see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4117557
|
||||||
|
File file = new File(path);
|
||||||
|
if (file.isAbsolute()) {
|
||||||
|
return file;
|
||||||
|
} else {
|
||||||
|
return file.getAbsoluteFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inner class that describes an application and its start settings.
|
* Inner class that describes an application and its start settings.
|
||||||
*/
|
*/
|
||||||
|
@ -322,9 +333,9 @@ public class ApplicationManager implements XmlRpcHandler {
|
||||||
debug = conf.getProperty("debug");
|
debug = conf.getProperty("debug");
|
||||||
encode = "true".equalsIgnoreCase(conf.getProperty("responseEncoding"));
|
encode = "true".equalsIgnoreCase(conf.getProperty("responseEncoding"));
|
||||||
String appDirName = conf.getProperty("appdir");
|
String appDirName = conf.getProperty("appdir");
|
||||||
appDir = (appDirName == null) ? null : new File(appDirName);
|
appDir = (appDirName == null) ? null : getAbsoluteFile(appDirName);
|
||||||
String dbDirName = conf.getProperty("dbdir");
|
String dbDirName = conf.getProperty("dbdir");
|
||||||
dbDir = (dbDirName == null) ? null : new File(dbDirName);
|
dbDir = (dbDirName == null) ? null : getAbsoluteFile(dbDirName);
|
||||||
|
|
||||||
// got ignore dirs
|
// got ignore dirs
|
||||||
ignoreDirs = conf.getProperty("ignore");
|
ignoreDirs = conf.getProperty("ignore");
|
||||||
|
@ -485,13 +496,10 @@ public class ApplicationManager implements XmlRpcHandler {
|
||||||
context.addHandler(handler);
|
context.addHandler(handler);
|
||||||
|
|
||||||
if (protectedStaticDir != null) {
|
if (protectedStaticDir != null) {
|
||||||
File protectedContent = new File(protectedStaticDir);
|
File protectedContent = getAbsoluteFile(protectedStaticDir);
|
||||||
if (!protectedContent.isAbsolute()) {
|
context.setResourceBase(protectedContent.getPath());
|
||||||
protectedContent = new File(server.getHopHome(), protectedStaticDir);
|
|
||||||
}
|
|
||||||
context.setResourceBase(protectedContent.getAbsolutePath());
|
|
||||||
server.getLogger().info("Serving protected static from " +
|
server.getLogger().info("Serving protected static from " +
|
||||||
protectedContent.getAbsolutePath());
|
protectedContent.getPath());
|
||||||
context.addHandler(new ResourceHandler());
|
context.addHandler(new ResourceHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,20 +508,17 @@ public class ApplicationManager implements XmlRpcHandler {
|
||||||
// if there is a static direcory specified, mount it
|
// if there is a static direcory specified, mount it
|
||||||
if (staticDir != null) {
|
if (staticDir != null) {
|
||||||
|
|
||||||
File staticContent = new File(staticDir);
|
File staticContent = getAbsoluteFile(staticDir);
|
||||||
if (!staticContent.isAbsolute()) {
|
|
||||||
staticContent = new File(server.getHopHome(), staticDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
server.getLogger().info("Serving static from " +
|
server.getLogger().info("Serving static from " +
|
||||||
staticContent.getAbsolutePath());
|
staticContent.getPath());
|
||||||
server.getLogger().info("Mounting static at " +
|
server.getLogger().info("Mounting static at " +
|
||||||
staticMountpoint);
|
staticMountpoint);
|
||||||
|
|
||||||
context = server.http.addContext(staticMountpoint);
|
context = server.http.addContext(staticMountpoint);
|
||||||
context.setWelcomeFiles(staticHome);
|
context.setWelcomeFiles(staticHome);
|
||||||
|
|
||||||
context.setResourceBase(staticContent.getAbsolutePath());
|
context.setResourceBase(staticContent.getPath());
|
||||||
|
|
||||||
ResourceHandler rhandler = new ResourceHandler();
|
ResourceHandler rhandler = new ResourceHandler();
|
||||||
rhandler.setDirAllowed(staticIndex);
|
rhandler.setDirAllowed(staticIndex);
|
||||||
|
|
Loading…
Add table
Reference in a new issue