Skip to content

Commit

Permalink
Issue #5451 - Allowing inversion of ${jetty.base}/work/ persistence
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
joakime committed Oct 16, 2020
1 parent 3cc549c commit 75e6aaf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions jetty-server/src/main/java/org/eclipse/jetty/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class Server extends HandlerWrapper implements Attributes
private final List<Connector> _connectors = new CopyOnWriteArrayList<>();
private SessionIdManager _sessionIdManager;
private String _tmpDirPosixPerms = "rwx------";
private boolean _workDirPersistent = true;
private boolean _stopAtShutdown;
private boolean _dumpAfterStart = false;
private boolean _dumpBeforeStop = false;
Expand Down Expand Up @@ -216,6 +217,11 @@ public String getTempDirectoryPosixPermissions()
return _tmpDirPosixPerms;
}

public boolean isWorkDirectoryPersistent()
{
return _workDirPersistent;
}

/**
* @return Returns the connectors.
*/
Expand Down Expand Up @@ -600,6 +606,11 @@ public void setTempDirectoryPosixPermissions(String perms)
_tmpDirPosixPerms = perms;
}

public void setWorkDirectoryPersistent(boolean flag)
{
_workDirPersistent = flag;
}

/*
* @see org.eclipse.util.AttributesMap#clearAttributes()
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,10 @@ public void resolveTempDirectory(WebAppContext context)
File work = new File(jettyBase, "work");
if (work.exists() && work.isDirectory() && work.canWrite())
{
context.setPersistTempDirectory(true);
if (context.getServer().isWorkDirectoryPersistent())
{
context.setPersistTempDirectory(true);
}
makeTempDirectory(work, context);
return;
}
Expand Down

0 comments on commit 75e6aaf

Please sign in to comment.