and then in the configure method I fetch the language value from the "COUNTRY" env var:
factory.setCreator(new WordsCreator(this, mBundle.getString(STR_DATABASE_URL)));
}
Then I have the following 6 scripts on my Rocky Linux 8.8 to start the Jetty instances
/etc/systemd/system/jetty-de.service
/etc/systemd/system/jetty-en.service
/etc/systemd/system/jetty-fr.service
/etc/systemd/system/jetty-nl.service
/etc/systemd/system/jetty-pl.service
/etc/systemd/system/jetty-ru.service
And the only differences the scripts have is the port and the "COUNTRY" env var:
[Unit]
Description=Jetty
After=network-online.target
[Service]
Environment=COUNTRY=de
Type=simple
User=jetty
Group=jetty
ExecStart=/usr/bin/java -Djdbc.drivers=org.postgresql.Driver -jar /usr/share/java/jetty-home-10.0.16/start.jar jetty.home=/usr/share/java/jetty-home-10.0.16 jetty.base=/var/www/jetty-base-de jetty.http.host=127.0.0.1 jetty.http.port=8081
SuccessExitStatus=143
Restart=always
RestartSec=180
PrivateTmp=true
[Install]
WantedBy=multi-user.target
In the /etc/haproxy/haproxy.cfg I look at the request path and forward the request to one of the ports:
backend jetty_de
backend jetty_en
backend jetty_fr
backend jetty_nl
backend jetty_pl
backend jetty_ru
frontend wordsbyfarber_com
redirect scheme https if !{ ssl_fc }
use_backend jetty_de if { path_beg /de }
use_backend jetty_en if { path_beg /en }
use_backend jetty_fr if { path_beg /fr }
use_backend jetty_nl if { path_beg /nl }
use_backend jetty_pl if { path_beg /pl }
use_backend jetty_ru if { path_beg /ru }
default_backend jetty_en
Finaly my config XML files look like this to "bind" the servlet to a certain context path:
# cat /var/www/jetty-base-de/webapps/de.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/de</Set>
<Set name="war">/var/www/words-5.0.war</Set>
</Configure>
Thank you for reading my mail, it is a bit longer, because I am trying to provide enough details.
My question is, if it is possible to handle my task with a single Jetty instance?
Could I set the env var in the /var/www/jetty-base-de/webapps/de.xml file?
Or maybe alternatively access the value of "contextPath" from the configure() method?
Thank you for any suggestions