You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by James Selvakumar <ja...@mcruncher.com> on 2018/10/05 02:08:48 UTC

Displaying a Jenkins like "Getting ready to work" message in a web page when application is starting up

Hi all,

First of all I would like to thank the community for all the help offered
in the past. Thank you very much.

My application (Wicket + Spring + Hibernate) takes around 60 to 90 seconds
to startup and all the user has to see is an empty browser tab when the
application is starting up.
I've observed Jenkins displaying a familiar "Getting ready to work" message
when it starts up.
I've seen some Atlassian products even displaying what's happening behind
the hood during startup.
Can someone explain how to do something similar with Wicket?

Re: Displaying a Jenkins like "Getting ready to work" message in a web page when application is starting up

Posted by Tobias Gierke <to...@voipfuture.com>.
On 10/5/18 11:13 AM, James Selvakumar wrote:
> Hi Martin,
>
> Thank you very much for the response.
> I'll check that out.
>
> On Fri, Oct 5, 2018 at 3:02 PM Martin Grigorov <mg...@apache.org> wrote:
>
>> Hi,
>>
>> You are very welcome!
>>
>> Since you use Spring I'd recommend you to check this article+demo app:
>> https://github.com/nurkiewicz/spring-startup-progress
>> It should give you an idea how to do it.

Since I recently implemented the same for our application, here's two 
things I remember spending quite a lot of time on that were missing from 
the article:

1.) Valve operational way too late in the startup cycle

If you want the Valve to work from the very beginning of Tomcat startup 
you need to configure "deployOnStartup" and "backgroundProcessorDelay" 
inside server.xml like so:

       <Host name="localhost"  appBase="webapps" deployOnStartup="false" 
backgroundProcessorDelay="1"
             unpackWARs="true" autoDeploy="true">

2.) At least with Tomcat 9.0.5, requests to unmapped endpoints will flag 
the response OutputBuffer as 'suspended' and this will silently ignore 
whatever you're writing to it so the progress page will not work


To fix this, you need to check for a suspended response and call 
setSuspended(false) like this:

     @Override
     public void invoke(Request request, Response response) throws 
IOException, ServletException
     {
         final String requestURI = request.getRequestURI();
         if ( "/progress".equals( requestURI ) )
         {

             if ( response.isSuspended() )
             {
                 // Dirty hack to work around the fact that if Tomcat 
decided the request endpoint
                 // doesn't exist it already prepares sending a 404 and 
this in turn
                 // invokes OutputBuffer#setSuspended(true) which would
                 // silently drop the bytes we're about to write to the 
output stream
                 response.setSuspended( false );
             }

             // do your thing

        }
    }


Cheers,
Tobias

>>
>> On Fri, Oct 5, 2018 at 5:09 AM James Selvakumar <ja...@mcruncher.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> First of all I would like to thank the community for all the help offered
>>> in the past. Thank you very much.
>>>
>>> My application (Wicket + Spring + Hibernate) takes around 60 to 90
>> seconds
>>> to startup and all the user has to see is an empty browser tab when the
>>> application is starting up.
>>> I've observed Jenkins displaying a familiar "Getting ready to work"
>> message
>>> when it starts up.
>>> I've seen some Atlassian products even displaying what's happening behind
>>> the hood during startup.
>>> Can someone explain how to do something similar with Wicket?
>>>
-- 
Tobias Gierke
Software Developer

Voipfuture GmbH   Wendenstr. 4   20097 Hamburg   Germany
Phone +49 40 688 9001 64   Fax +49 40 688 9001 99   www.voipfuture.com
Managing Directors   Jan Bastian   Eyal Ullert
Commercial Court AG Hamburg   HRB 109896   VAT ID DE263738086



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying a Jenkins like "Getting ready to work" message in a web page when application is starting up

Posted by James Selvakumar <ja...@mcruncher.com>.
Hi Martin,

Thank you very much for the response.
I'll check that out.

On Fri, Oct 5, 2018 at 3:02 PM Martin Grigorov <mg...@apache.org> wrote:

> Hi,
>
> You are very welcome!
>
> Since you use Spring I'd recommend you to check this article+demo app:
> https://github.com/nurkiewicz/spring-startup-progress
> It should give you an idea how to do it.
>
> On Fri, Oct 5, 2018 at 5:09 AM James Selvakumar <ja...@mcruncher.com>
> wrote:
>
> > Hi all,
> >
> > First of all I would like to thank the community for all the help offered
> > in the past. Thank you very much.
> >
> > My application (Wicket + Spring + Hibernate) takes around 60 to 90
> seconds
> > to startup and all the user has to see is an empty browser tab when the
> > application is starting up.
> > I've observed Jenkins displaying a familiar "Getting ready to work"
> message
> > when it starts up.
> > I've seen some Atlassian products even displaying what's happening behind
> > the hood during startup.
> > Can someone explain how to do something similar with Wicket?
> >
>

Re: Displaying a Jenkins like "Getting ready to work" message in a web page when application is starting up

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You are very welcome!

Since you use Spring I'd recommend you to check this article+demo app:
https://github.com/nurkiewicz/spring-startup-progress
It should give you an idea how to do it.

On Fri, Oct 5, 2018 at 5:09 AM James Selvakumar <ja...@mcruncher.com> wrote:

> Hi all,
>
> First of all I would like to thank the community for all the help offered
> in the past. Thank you very much.
>
> My application (Wicket + Spring + Hibernate) takes around 60 to 90 seconds
> to startup and all the user has to see is an empty browser tab when the
> application is starting up.
> I've observed Jenkins displaying a familiar "Getting ready to work" message
> when it starts up.
> I've seen some Atlassian products even displaying what's happening behind
> the hood during startup.
> Can someone explain how to do something similar with Wicket?
>