-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Garret,
On 4/19/19 19:18, Garret Wilson wrote: > 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). > It also seems reasonable to be able to create two connectors with the default configuration where the only difference is the port number. Something like: Connector connector = tomcat.createDefaultConnector(); connector.setPort(8443); tomcat.getService().addConnector(connector); connector = tomcat.createDefaultConnector(); connector.setPort(8444); tomcat.getService().addConnector(connector); This is not currently possible unless the Connector is (unlikely) cloneable. >> 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. Patches are always welcome. I'd submit separate patches each step of the way instead of one huge patch that makes the Tomcat class look the way you want it. I'd start with refactoring the code that creates a default connector into a separate method and then wiring it into the getConnector() method where it creates a default connector. That may be all you really need. - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAly9wq4ACgkQHPApP6U8 pFhnqw//eAo1s52+6XN60iFiMpbVgPEU0UjFFQeYIvelk9B/kb61gZafD9+PNNMh AixE1NC+RUymUSByFg3kSjiiDn8S5rmlEcpe0q1j/v0rlrU+hdnEAhHf4QqtKgXV anT24kKhOoavI2GHAq8b+AeiAOcCpqxFNFKmlpIXORALzBN2Loks7FGMmet/O9vd WuCeqLwBMU61szbXvzndMt157XOodhcAL77GjCeK25EC/LUC3o0YMq/ZVJGZwKV3 OXxR8pbCsPN1SNySEEX5eMPWAKcqwYskBg3Up2gKXnrgbRDq4k1SQ+Wv0qqnrzJC MuJ+IcmUTxbZ9UL4lG1SXGQbZAnwrUCbIK9RKYVdE3h9ak46eXbUJRK79nmBhqlT 33dplH5rvK0A3RY230GX0z3XTyQbJT3qA6fjTs00wEr5onQNIzluvtYEIQVy6/gz l41LgD9+QVMaPTSY+LGmoYhydNN/Lyb9z5VYeff56m9fPTBIVsmxK+bpauM0UQnW tapVujRNfbqA0fvTKkrGJPkbzdYP59woWRyEMLPE5j6Ice+c1QHNmRSW+zDB716q oEWq/ihHrkyK8GUWiUcgam/3zhehVdDFsfwTgFatPKdVYtRUxoG4AyHYnoEA7OWG tXmgPrHrj4LThSDOrtnb4MKzh4Tp5JNOrVerPpfzaMxtjaLWQ1I= =Zi/P -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org