This is an automated email from the ASF dual-hosted git repository.

matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c7caf101c Ensure tomcat basedirectory is configured and in a 
writeable location
     new 51ef8c6ebd Merge pull request #5993 from matthiasblaesing/github-5990
8c7caf101c is described below

commit 8c7caf101c60bcd313e8f518c3fb19252102e879
Author: Matthias Bläsing <[email protected]>
AuthorDate: Fri May 26 20:24:26 2023 +0200

    Ensure tomcat basedirectory is configured and in a writeable location
    
    Tomcat by default places its working directory in the current working
    directory. This clutters the directory tree and is problematic if the
    current working directory is not writeable.
    
    Closes: #5990
---
 .../src/org/netbeans/modules/httpserver/HttpServerModule.java       | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/ide/httpserver/src/org/netbeans/modules/httpserver/HttpServerModule.java 
b/ide/httpserver/src/org/netbeans/modules/httpserver/HttpServerModule.java
index 3087e31ab9..4a1cd7999c 100644
--- a/ide/httpserver/src/org/netbeans/modules/httpserver/HttpServerModule.java
+++ b/ide/httpserver/src/org/netbeans/modules/httpserver/HttpServerModule.java
@@ -174,7 +174,10 @@ public class HttpServerModule extends ModuleInstall 
implements Externalizable {
     
 
     private static void buildServer() throws Exception {
+        File httpwork = Places.getCacheSubdirectory("httpwork");
+        File httpworkBase = Places.getCacheSubdirectory("httpwork-base");
         tomcat = new Tomcat();
+        tomcat.setBaseDir(httpworkBase.getAbsolutePath());
         tomcat.setPort(httpserverSettings().getPort());
         tomcat.getServer().setUtilityThreads(1);
         tomcat.getConnector().setXpoweredBy(false);
@@ -185,8 +188,7 @@ public class HttpServerModule extends ModuleInstall 
implements Externalizable {
        ThreadPoolExecutor tf  = new ThreadPoolExecutor(0, 3, 60, 
TimeUnit.SECONDS, tq);
        tomcat.getConnector().getProtocolHandler().setExecutor(tf);
 
-        File wd = Places.getCacheSubdirectory("httpwork");
-        Context ctx = tomcat.addContext("", wd.getAbsolutePath());
+        Context ctx = tomcat.addContext("", httpwork.getAbsolutePath());
 
         if(ctx instanceof StandardContext) {
             ((StandardContext) ctx).setClearReferencesRmiTargets(false);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to