How to disable the jetty icon in Jetty11

Viewed 98

I am updating Jetty9 to Jetty11 and need to know that how to disable the server icon in Jetty11. I used to do the below changes on the etc\jetty.XML for Jetty9.

<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
            <Set name="serveIcon">false</Set>
</New>
1 Answers

The easiest solution is just to make your own favicon.ico and put in in your ROOT context as a static file to serve.

Otherwise, if you want to tweak the existing id="DefaultHandler" component with your ${jetty.base} take a look at this example ${jetty.base} ...

$ tree -F no-favico-base/
no-favico-base/
├── etc/
│   └── tweak-defaulthandler.xml
├── resources/
│   └── jetty-logging.properties
├── start.d/
│   ├── deploy.ini
│   ├── http.ini
│   └── tweaks.ini
└── webapps/

4 directories, 5 files

It has 2 files that are used to accomplish this.

etc/tweak-defaulthandler.xml

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
          "http://www.eclipse.org/jetty/configure_10.dtd">
<Configure id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
  <Set name="serveIcon">false</Set>
</Configure>

Which configures the existing id="DefaultHandler" that was previously defined in the ${jetty.home}/etc/jetty.xml.

And an ini to add this xml to the configuration. This name can be anything you want, I just chose "tweak" as I like to put all of the tweaks I make in this one ini.

start.d/tweak.ini

etc/tweak-defaulthandler.xml

You can see the order of the XML's being executed using --list-config

$ java -jar /opt/jetty/jetty-home-10.0.6/start.jar --list-config
...(snip)...
Jetty Active XMLs:
------------------
 ${jetty.home}/etc/jetty-bytebufferpool.xml
 ${jetty.home}/etc/jetty-threadpool.xml
 ${jetty.home}/etc/jetty.xml
 ${jetty.home}/etc/jetty-webapp.xml
 ${jetty.home}/etc/jetty-deploy.xml
 ${jetty.home}/etc/jetty-http.xml
 ${jetty.base}/etc/tweak-defaulthandler.xml

Related