Question

I have a maven profile which starts up a Jetty server using jetty:run.

I'm trying to find an elegant way of informing the user that they need to visit a given URL after jetty:run has completed, e.g.

2012-03-06 10:49:14.513::INFO:  Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Please visit http://localhost:9321/

I've tried using a ServletContextListener to print the message, but this happens too early and the message is lost in the log noise.

Is there a way to hook into the lifecycle of the jetty plugin in such a way as to print this message right at the end of jetty:run?

Était-ce utile?

La solution

Easiest thing would be to open a bug and contribute a patch for that behavior.

https://jira.codehaus.org/browse/JETTY

Alternately you could define a context.xml file file via the configuration mechanism of the plugin and then add in some output that would inform the user of what you want. The xml that is processed in the context.xml is very much like java only in xml form so you could make use of system out at the end of that xml file....which would be pretty late in the plugin startup lifecycle. Truly though, patching that behavior into the plugin would be far easier and more maintainable.

cheers

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top