You are here: Foswiki>IN Web>Jetty (25 Jan 2023, ChristophHandel)Edit Attach

Jetty

default (since 2022) servlet container for user managed services (ClusterAcc9).

Installation

INN will install Jetty by user request on service hosts. It will listen on port 80 and 443. It has a hostbased certificate signed by ACC-CA.

Deployment and Context

If an application needs no further configuration it can be dropped into /var/lib/jetty/webapps and jetty will deploy it under it's name. special name ROOT.war will deploy under the url "slash".

If an application needs configuration (for example jdbc database links) an xml can be deployed in the same location referencing a war in a different folder. If both an application.war and an application.xml are in the folder only the xml is deployed. But one must be careful to first create the xml and then the war, it is recommended to keep such wars in a different folder.

context.xml must be a valid xml including full doctype. A simple xml that deploys a war file to a custom url

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/show/me/here</Set>
  <Set name="war">/some/crazy/path/application.war</Set>
</Configure>

Static content

Jetty can serve static folders. Here is a fragment that can be placed in /var/lib/jetty/webapps

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">  
  <Set name="contextPath">/this/is/static</Set>
  <Set name="handler">
    <New class="org.eclipse.jetty.server.handler.ResourceHandler">
      <Set name="resourceBase">/home/bob/htdocs</Set>
      <Set name="directoriesListed">true</Set>
    </New>
  </Set>
</Configure>

Logfiles

jetty logs to the systemd journal. User bob can run sudo /usr/bin/journalctl -u jetty

-- ChristophHandel - 11 May 2022
Topic revision: r3 - 25 Jan 2023, ChristophHandel
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback