On 4/19/2019 8:04 PM, Rémy Maucherat wrote:
On Fri, Apr 19, 2019 at 11:14 PM Garret Wilson <gar...@globalmentor.com>
wrote:
On 4/19/2019 3:24 PM, Rémy Maucherat wrote:
tomcat.getService().addConnector(new Connector()); works very well, etc,
just look at what getConnector() does, it's very simple.
I did look at that first; that's why I mentioned the magic strings such
as "HTTP/1.1". If I just use `new Connector()`, I may get something
different than if I say `new Connector("HTTP/1.1")`. The latter
potentially takes advantage of the APR connector if present; the former
does not. (And how would I know that without looking at the source code?)
I'm happy to call `tomcat.getSerivce().addConnector(defaultConnector)`,
but there needs to be some method for creating a connector with a
default configuration. Otherwise I'm copying more and more large hunks
of code from the Tomcat source code, which may break when things diverge
in the future (not to mention cutting down on reusability).
…
You can also use a server.xml (and some other important config files like
web.xml) for your embedded now, you can look at Tomcat.main(...) (it is
used by the Tomcat container image example). If your configuration becomes
complex, it could be better than using Java to configure Tomcat.
I don't want server.xml or web.xml. This is /not/ complex; I merely want
to serve static files in a directory. The irony is that I thought I was
simplifying things my removing JSP etc. support; it turns out that this
"simplification" complicated things greatly and required me to copy big
hunks of Tomcat code. This could and should be improved, and I'm happy
to help improve it.
Garret