Class CatalinaBaseGenerator
java.lang.Object
io.github.rajendarreddyj.tomcat.config.CatalinaBaseGenerator
Generates a custom CATALINA_BASE directory with modified server.xml for port
configuration.
This allows running Tomcat with custom ports without modifying the original
installation.
- Since:
- 1.0.0
- Author:
- rajendarreddyj
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidGenerates a CATALINA_BASE directory with customized configuration.static booleanhasCorrectPort(Path catalinaBase, int expectedPort) Checks if a CATALINA_BASE has the correct HTTP port configured.static booleanisValidCatalinaBase(Path catalinaBase) Checks if a CATALINA_BASE already exists and appears valid.
-
Method Details
-
generate
public static void generate(Path catalinaHome, Path catalinaBase, int httpPort, String httpHost) throws IOException Generates a CATALINA_BASE directory with customized configuration.- Parameters:
catalinaHome- the CATALINA_HOME directory (original Tomcat installation)catalinaBase- the target CATALINA_BASE directory to createhttpPort- the HTTP port to configurehttpHost- the HTTP host/address to bind to- Throws:
IOException- if an I/O error occurs
-
isValidCatalinaBase
Checks if a CATALINA_BASE already exists and appears valid.- Parameters:
catalinaBase- the CATALINA_BASE path to check- Returns:
- true if the directory exists and has required structure
-
hasCorrectPort
Checks if a CATALINA_BASE has the correct HTTP port configured.- Parameters:
catalinaBase- the CATALINA_BASE path to checkexpectedPort- the expected HTTP port- Returns:
- true if the HTTP connector port matches the expected port
-