Dirk,

Note that you can actually achieve this with just a little bit of work:

Write a simple context (extend context handler) that all it does is send a
503 with whatever message you want.
Deploy both that context and your context at the same context path.  The
503 context will handle all the requests as it is first.
Once your context is started, stop and/or remove the 503 context.





On Sat, 5 Oct 2019 at 00:48, Joakim Erdfelt <joa...@webtide.com> wrote:

> Sounds like the initial deployment on Server.start() is the reason you are
> experiencing this.
>
> Your environment would need to delay deployment until after the server has
> started up.
> That would be a new feature / configuration (and not that hard to
> implement either)
> Can you file an issue for a new feature at
> https://github.com/eclipse/jetty.project/issues
>
> And the extra requirement of a 503 before the webapp is available is a new
> feature that Jetty does not have.
> That would likely need to be a custom Handler at the end of your Handler
> tree (but before the DefaultHandler) to
> check the submitted context path and return 503 in those situations.
> (as if it reached that custom handler, that means the webapp isn't there
> yet)
> That can also be a new feature, submit the idea at
> https://github.com/eclipse/jetty.project/issues
>
> Joakim Erdfelt / joa...@webtide.com
>
>
> On Fri, Oct 4, 2019 at 9:02 AM Dirk Olmes <dirk.ol...@exentra.de> wrote:
>
>> Hi,
>>
>> I'm using an embedded Jetty to set up a servlet context. My code looks
>> quite similar to what's in the "Embedding ServletContexts" section of
>> the "Embedding Jetty" chapter of the Jetty docs.
>>
>> I noticed that the server (more correctly the ServerConnector) won't be
>> ready to accept connections unless my servlets have started up. Now I
>> have a ServletContextListener that takes a long time to start up.
>>
>> Would it be possible to configure Jetty in such a way that it already
>> accepts connections and answers e.g. with a 503 status until the servlet
>> context is finally up and running?
>>
>> -dirk
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
> _______________________________________________
> jetty-users mailing list
> jetty-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users



-- 
Greg Wilkins <gr...@webtide.com> CTO http://webtide.com
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to