Anyone else using Groovy?

View: New views
18 Messages — Rating Filter:   Alert me  

Anyone else using Groovy?

by Tim Fennell-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

So I tried out Groovy again last night.  I'd tried it before,  
somewhere around the 1.0 release, and wrote it off at that time for  
Stripes development (and JPA/hibernate development too) due to the  
lack of support for generics and annotations - which are fairly  
critical to making programming in Stripes easy and fun.  Anyway I  
figured it was time to check back in and see what progress the Groovy  
devs have made, and I have to say I'm really impressed!

The Groovy 1.5 release supports annotations and generics (and enums  
and other things too) well enough that it's easy to start writing  
ActionBeans in Stripes.  As a challenge I took our nastiest bean  
(essentially an agglomeration of all the admin actions in our  
application - it's only ever seen/used by developers) with about 20  
different handlers in it and converted it to Groovy.  It went  
surprisingly well, and cut down on quite a bit of junk - most  
noticably getting rid of 2-3 pages of getter/setter methods.  But it  
also allowed me to tidy up in other places as I tried out some of the  
groovy idioms like using closures to iterate over lists.

Groovy 1.5 also contains a "joint compiler" called groovyc which is  
essentially a drop in replacement for javac that compiles both groovy  
and java at the same time.  As a result it took me about 5 minutes to  
modify our build process to include groovy source.  And to give me  
favorite IDE a plug, the IntelliJ Groovy plugin is excellent.  It's  
not quite as good as writing Java yet, but it's close enough and  
completion works 99% of the time.

So is anyone else on the list using groovy to write ActionBeans or  
other things?  If you're not, I'd encourage you to check it out.  I  
think now that it supports the major Java 5 features it's a great  
language to work in.

-t

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Anyone else using Groovy?

by VANKEISBELCK Remi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Tim, folks,

Not action beans (I don't write a lot of them any more), but yeah, I
use Groovy quite a lot in Woko... even to write code right inside the
browser !

Also I love it in replacement of shell scripts (no jokes).

Haven't yet integrated the latest version, but played a bit and yikes,
the annots and generics support is great !

I also dig the IDEA plugin... It has a few quirks but it's pretty cool overall !

And finally they relooked the Groovy console, one of my favorites for
quick and dirty hacks :)

Cheers

Remi - Groovy "ftw" :-D

On Jan 24, 2008 1:43 PM, Tim Fennell <tfenne@...> wrote:

> Hi All,
>
> So I tried out Groovy again last night.  I'd tried it before,
> somewhere around the 1.0 release, and wrote it off at that time for
> Stripes development (and JPA/hibernate development too) due to the
> lack of support for generics and annotations - which are fairly
> critical to making programming in Stripes easy and fun.  Anyway I
> figured it was time to check back in and see what progress the Groovy
> devs have made, and I have to say I'm really impressed!
>
> The Groovy 1.5 release supports annotations and generics (and enums
> and other things too) well enough that it's easy to start writing
> ActionBeans in Stripes.  As a challenge I took our nastiest bean
> (essentially an agglomeration of all the admin actions in our
> application - it's only ever seen/used by developers) with about 20
> different handlers in it and converted it to Groovy.  It went
> surprisingly well, and cut down on quite a bit of junk - most
> noticably getting rid of 2-3 pages of getter/setter methods.  But it
> also allowed me to tidy up in other places as I tried out some of the
> groovy idioms like using closures to iterate over lists.
>
> Groovy 1.5 also contains a "joint compiler" called groovyc which is
> essentially a drop in replacement for javac that compiles both groovy
> and java at the same time.  As a result it took me about 5 minutes to
> modify our build process to include groovy source.  And to give me
> favorite IDE a plug, the IntelliJ Groovy plugin is excellent.  It's
> not quite as good as writing Java yet, but it's close enough and
> completion works 99% of the time.
>
> So is anyone else on the list using groovy to write ActionBeans or
> other things?  If you're not, I'd encourage you to check it out.  I
> think now that it supports the major Java 5 features it's a great
> language to work in.
>
> -t
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@...
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Anyone else using Groovy?

by Evgeny Shepelyuk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

24.01.08 в 14:43 Tim Fennell в своём письме писал(а):

> Hi All,
>
> So I tried out Groovy again last night.  I'd tried it before,
> somewhere around the 1.0 release, and wrote it off at that time for
> Stripes development (and JPA/hibernate development too) due to the
> lack of support for generics and annotations - which are fairly
> critical to making programming in Stripes easy and fun.  Anyway I
> figured it was time to check back in and see what progress the Groovy
> devs have made, and I have to say I'm really impressed!
>
> The Groovy 1.5 release supports annotations and generics (and enums
> and other things too) well enough that it's easy to start writing
> ActionBeans in Stripes.  As a challenge I took our nastiest bean
> (essentially an agglomeration of all the admin actions in our
> application - it's only ever seen/used by developers) with about 20
> different handlers in it and converted it to Groovy.  It went
> surprisingly well, and cut down on quite a bit of junk - most
> noticably getting rid of 2-3 pages of getter/setter methods.  But it
> also allowed me to tidy up in other places as I tried out some of the
> groovy idioms like using closures to iterate over lists.
>
> Groovy 1.5 also contains a "joint compiler" called groovyc which is
> essentially a drop in replacement for javac that compiles both groovy
> and java at the same time.  As a result it took me about 5 minutes to
> modify our build process to include groovy source.  And to give me
> favorite IDE a plug, the IntelliJ Groovy plugin is excellent.  It's
> not quite as good as writing Java yet, but it's close enough and
> completion works 99% of the time.
>
> So is anyone else on the list using groovy to write ActionBeans or
> other things?  If you're not, I'd encourage you to check it out.  I
> think now that it supports the major Java 5 features it's a great
> language to work in.
>
> -t
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


Yes. I've been writing grovvy last month and found it very contagious.
Havent' tried using it with stripes but working on grails project is a fun  
:))
The only issue that disturbs me is a perfomance of compiled groovy code  
comparing to compiled java code.
Have you tried to to some benchmarks in Stripes environment ?

--
Best Regards
Evgeny K. Shepelyuk


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Anyone else using Groovy?

by Freddy D. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the info. Like you, I tried Groovy pre-1.5 support and
really liked what I saw. Especially being able to use closures in
mappings and iterations, which I love (and why I wrote
FunctionalJ to tide me over until something better would become
available).

I always thought Groovy+Stripes would be a very nice
combination. So thanks for confirming that now with the 1.5
support, it is indeed a workable solution.

Cheers,
Freddy

Re: Anyone else using Groovy?

by Gregg Bolinger-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Seems like Remi and I had a discussion about this a few weeks ago.  I've
been kind of waiting for someone else to give it a go before I dove in.  
I'd suspect Tim's crazy admin action bean is a rare case.  The only
thing I see that would make using Groovy over straight Java a non-issue
is that a good ActionBean isn't that complicated and getters/setters can
be generated by the IDE.  So can anyone make a *real* case for why
Groovy would be worthwhile in this case?

Don't get me wrong. I love gant and I like using Groovy for quick and
dirty prototypes and like Remi enjoy it more than shell scripts.  But
outside of Grails considering everything else Grails does, I'm not
sure.  Unless we moved the Stripes annotations into something more like
Grails constraints I just don't see the pay off.

Gregg

Freddy D. wrote:

> Thanks for the info. Like you, I tried Groovy pre-1.5 support and
> really liked what I saw. Especially being able to use closures in
> mappings and iterations, which I love (and why I wrote
> FunctionalJ to tide me over until something better would become
> available).
>
> I always thought Groovy+Stripes would be a very nice
> combination. So thanks for confirming that now with the 1.5
> support, it is indeed a workable solution.
>
> Cheers,
> Freddy
>
>  

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Anyone else using Groovy?

by Tim Fennell-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, for me there are a couple of things.  I actually really like  
some of the groovy language idioms.  I find that I'm often taking a  
list of objects and making a list of IDs or vice versa.  In Java this  
is a bit verbose, but I like groovy's style:

List<Long> ids = foos.collect { it.getId(); }

And for me, getting rid of getters/setters is actually significant.  
I don't like the clutter, and more importantly it makes it much more  
obvious when you have a non-standard getter or setter (lazy loader,  
or something) mixed in with the rest - because there is no rest of  
them any more.

The other thing I've been wondering about is that if there were  
enough demand for it we could try adding "improved" groovy support.  
E.g. throw your groovy actions under WEB-INF and we'll use groovy's  
built in stuff to do auto-reloading etc.

My 2c.

-t


On Jan 24, 2008, at 9:37 AM, Gregg Bolinger wrote:

> Seems like Remi and I had a discussion about this a few weeks ago.  
> I've
> been kind of waiting for someone else to give it a go before I dove  
> in.
> I'd suspect Tim's crazy admin action bean is a rare case.  The only
> thing I see that would make using Groovy over straight Java a non-
> issue
> is that a good ActionBean isn't that complicated and getters/
> setters can
> be generated by the IDE.  So can anyone make a *real* case for why
> Groovy would be worthwhile in this case?
>
> Don't get me wrong. I love gant and I like using Groovy for quick and
> dirty prototypes and like Remi enjoy it more than shell scripts.  But
> outside of Grails considering everything else Grails does, I'm not
> sure.  Unless we moved the Stripes annotations into something more  
> like
> Grails constraints I just don't see the pay off.
>
> Gregg
>
> Freddy D. wrote:
>> Thanks for the info. Like you, I tried Groovy pre-1.5 support and
>> really liked what I saw. Especially being able to use closures in
>> mappings and iterations, which I love (and why I wrote
>> FunctionalJ to tide me over until something better would become
>> available).
>>
>> I always thought Groovy+Stripes would be a very nice
>> combination. So thanks for confirming that now with the 1.5
>> support, it is indeed a workable solution.
>>
>> Cheers,
>> Freddy
>>
>>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@...
> https://lists.sourceforge.net/lists/listinfo/stripes-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Anyone else using Groovy?

by marijan milicevic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

fyi, Rick alreday made some stripes/groovy samples :

http://www.learntechnology.net/content/stripes/stripes-crud-groovy.jsp

-m

Tim Fennell wrote:
Well, for me there are a couple of things.  I actually really like  
some of the groovy language idioms.  I find that I'm often taking a  
list of objects and making a list of IDs or vice versa.  In Java this  
is a bit verbose, but I like groovy's style:

List<Long> ids = foos.collect { it.getId(); }

And for me, getting rid of getters/setters is actually significant.   
I don't like the clutter, and more importantly it makes it much more  
obvious when you have a non-standard getter or setter (lazy loader,  
or something) mixed in with the rest - because there is no rest of  
them any more.

The other thing I've been wondering about is that if there were  
enough demand for it we could try adding "improved" groovy support.   
E.g. throw your groovy actions under WEB-INF and we'll use groovy's  
built in stuff to do auto-reloading etc.

My 2c.

-t


On Jan 24, 2008, at 9:37 AM, Gregg Bolinger wrote:

  
Seems like Remi and I had a discussion about this a few weeks ago.   
I've
been kind of waiting for someone else to give it a go before I dove  
in.
I'd suspect Tim's crazy admin action bean is a rare case.  The only
thing I see that would make using Groovy over straight Java a non- 
issue
is that a good ActionBean isn't that complicated and getters/ 
setters can
be generated by the IDE.  So can anyone make a *real* case for why
Groovy would be worthwhile in this case?

Don't get me wrong. I love gant and I like using Groovy for quick and
dirty prototypes and like Remi enjoy it more than shell scripts.  But
outside of Grails considering everything else Grails does, I'm not
sure.  Unless we moved the Stripes annotations into something more  
like
Grails constraints I just don't see the pay off.

Gregg

Freddy D. wrote:
    
Thanks for the info. Like you, I tried Groovy pre-1.5 support and
really liked what I saw. Especially being able to use closures in
mappings and iterations, which I love (and why I wrote
FunctionalJ to tide me over until something better would become
available).

I always thought Groovy+Stripes would be a very nice
combination. So thanks for confirming that now with the 1.5
support, it is indeed a workable solution.

Cheers,
Freddy


      
---------------------------------------------------------------------- 
---
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users
    


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users
  

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Anyone else using Groovy?

by Gregg Bolinger-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It would be really cool if Stripes could automatically discover and load
changes to action beans (including new ones) without the entire app
restarting, regardless of what the action bean is written in.  But I
realize that is a pretty tall order. :)

Gregg

Tim Fennell wrote:

> Well, for me there are a couple of things.  I actually really like  
> some of the groovy language idioms.  I find that I'm often taking a  
> list of objects and making a list of IDs or vice versa.  In Java this  
> is a bit verbose, but I like groovy's style:
>
> List<Long> ids = foos.collect { it.getId(); }
>
> And for me, getting rid of getters/setters is actually significant.  
> I don't like the clutter, and more importantly it makes it much more  
> obvious when you have a non-standard getter or setter (lazy loader,  
> or something) mixed in with the rest - because there is no rest of  
> them any more.
>
> The other thing I've been wondering about is that if there were  
> enough demand for it we could try adding "improved" groovy support.  
> E.g. throw your groovy actions under WEB-INF and we'll use groovy's  
> built in stuff to do auto-reloading etc.
>
> My 2c.
>
> -t
>
>
> On Jan 24, 2008, at 9:37 AM, Gregg Bolinger wrote:
>
>  
>> Seems like Remi and I had a discussion about this a few weeks ago.  
>> I've
>> been kind of waiting for someone else to give it a go before I dove  
>> in.
>> I'd suspect Tim's crazy admin action bean is a rare case.  The only
>> thing I see that would make using Groovy over straight Java a non-
>> issue
>> is that a good ActionBean isn't that complicated and getters/
>> setters can
>> be generated by the IDE.  So can anyone make a *real* case for why
>> Groovy would be worthwhile in this case?
>>
>> Don't get me wrong. I love gant and I like using Groovy for quick and
>> dirty prototypes and like Remi enjoy it more than shell scripts.  But
>> outside of Grails considering everything else Grails does, I'm not
>> sure.  Unless we moved the Stripes annotations into something more  
>> like
>> Grails constraints I just don't see the pay off.
>>
>> Gregg
>>
>> Freddy D. wrote:
>>    
>>> Thanks for the info. Like you, I tried Groovy pre-1.5 support and
>>> really liked what I saw. Especially being able to use closures in
>>> mappings and iterations, which I love (and why I wrote
>>> FunctionalJ to tide me over until something better would become
>>> available).
>>>
>>> I always thought Groovy+Stripes would be a very nice
>>> combination. So thanks for confirming that now with the 1.5
>>> support, it is indeed a workable solution.
>>>
>>> Cheers,
>>> Freddy
>>>
>>>
>>>      
>> ----------------------------------------------------------------------
>> ---
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Stripes-users mailing list
>> Stripes-users@...
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>    
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@...
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>  

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

actions that take long time

by Leonard Gestrin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
I was wondering if anything in Stripes exists to support time-consuming
operation. Let's say, user hits an action that might take considerable
amount of time. In such cases, application should probably display
progress bar, spinner or something to tell user that operation is in
progress. It would be nice if it could show progress status and allow
user to cancel.

it appears that this could probably be done with custom dispatcher
servlet, which would spawn new thread for every action that implements
certain interface (DelayedAction for example), so that servlet would
check on the
status and send back to the browser special page that would check back
after some time with a servlet.  We've done something like with Strut's
actions and it worked pretty well.

It sounds like pretty common problem that people should face. It would
be interesting to know what people think - if it is reasonable approach
and how other folks solving this issue.

Thanks
Leonard







-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: actions that take long time

by Aaron Porter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nothing exists now but that does sound like an interesting idea and Stripe's Resolutions could make
it work really well. It would probably be an annotation on the ActionBean's event method, maybe
@DelayedAction("/your_wait_page.jsp"). When the event was going to be invoked it would spawn a new
thread to do the processing and do a forward to the wait page. The wait page could use JavaScript to
check if the processing was complete or fallback to a <meta http-equiv="refresh" content="2"> inside
of a <noscript>.

I'll have to play around with that idea!

Aaron

Leonard Gestrin wrote:

> Hello,
> I was wondering if anything in Stripes exists to support time-consuming
> operation. Let's say, user hits an action that might take considerable
> amount of time. In such cases, application should probably display
> progress bar, spinner or something to tell user that operation is in
> progress. It would be nice if it could show progress status and allow
> user to cancel.
>
> it appears that this could probably be done with custom dispatcher
> servlet, which would spawn new thread for every action that implements
> certain interface (DelayedAction for example), so that servlet would
> check on the
> status and send back to the browser special page that would check back
> after some time with a servlet.  We've done something like with Strut's
> actions and it worked pretty well.
>
> It sounds like pretty common problem that people should face. It would
> be interesting to know what people think - if it is reasonable approach
> and how other folks solving this issue.
>
> Thanks
> Leonard
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: actions that take long time

by Leonard Gestrin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That would cause the browser to always go to wait_page even if
processing takes less than acceptable wait time, which is not desirable.

We also ended up storing original request's attributes and setting them
back once action is processed for the next forward and the way we tied
running thread to user  via it's http session, so it would be possible
to lookup running task once wait page comes back. Wait page could be
customized for different actions with timeout delays, messages, progress
bar, etc. (by having baseDelayedAction every action had it for free but
could overwrite).

If all this complexity can be hidden in annotation, it might work;
otherwise it might need to be done on the Dispatcher level.

In struts, everything was going through 'perform' or 'execute' method,
so it was easy to intercept calls and put them in threads. In case of
Stripes, dispatcher calls actionbeans directly. I think it would fall
into Dispatcher responsibility to figure out if this ongoing task
(thread containing action needs to be retrieved status checked, and
appropriate action performed).

I think it would be very nice addition to stripes framework. I don't
know of any framework that has this feature of the box.
-----Original Message-----
From: stripes-users-bounces@...
[mailto:stripes-users-bounces@...] On Behalf Of Aaron
Porter
Sent: Thursday, January 24, 2008 4:09 PM
To: stripes-users@...
Subject: Re: [Stripes-users] actions that take long time

Nothing exists now but that does sound like an interesting idea and
Stripe's Resolutions could make
it work really well. It would probably be an annotation on the
ActionBean's event method, maybe
@DelayedAction("/your_wait_page.jsp"). When the event was going to be
invoked it would spawn a new
thread to do the processing and do a forward to the wait page. The wait
page could use JavaScript to
check if the processing was complete or fallback to a <meta
http-equiv="refresh" content="2"> inside
of a <noscript>.

I'll have to play around with that idea!

Aaron

Leonard Gestrin wrote:
> Hello,
> I was wondering if anything in Stripes exists to support
time-consuming

> operation. Let's say, user hits an action that might take considerable
> amount of time. In such cases, application should probably display
> progress bar, spinner or something to tell user that operation is in
> progress. It would be nice if it could show progress status and allow
> user to cancel.
>
> it appears that this could probably be done with custom dispatcher
> servlet, which would spawn new thread for every action that implements
> certain interface (DelayedAction for example), so that servlet would
> check on the
> status and send back to the browser special page that would check back
> after some time with a servlet.  We've done something like with
Strut's
> actions and it worked pretty well.
>
> It sounds like pretty common problem that people should face. It would
> be interesting to know what people think - if it is reasonable
approach

> and how other folks solving this issue.
>
> Thanks
> Leonard
>
>
>
>
>
>
>
>
------------------------------------------------------------------------
-
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: actions that take long time

by Aaron Porter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm actually working on an Interceptor to do it right now. I can add in a delay that would wait x
seconds for the event to complete before forwarding on to the wait page. I might have the initial
code done tonight but no promises. :)

Aaron

Leonard Gestrin wrote:

> That would cause the browser to always go to wait_page even if
> processing takes less than acceptable wait time, which is not desirable.
>
> We also ended up storing original request's attributes and setting them
> back once action is processed for the next forward and the way we tied
> running thread to user  via it's http session, so it would be possible
> to lookup running task once wait page comes back. Wait page could be
> customized for different actions with timeout delays, messages, progress
> bar, etc. (by having baseDelayedAction every action had it for free but
> could overwrite).
>
> If all this complexity can be hidden in annotation, it might work;
> otherwise it might need to be done on the Dispatcher level.
>
> In struts, everything was going through 'perform' or 'execute' method,
> so it was easy to intercept calls and put them in threads. In case of
> Stripes, dispatcher calls actionbeans directly. I think it would fall
> into Dispatcher responsibility to figure out if this ongoing task
> (thread containing action needs to be retrieved status checked, and
> appropriate action performed).
>
> I think it would be very nice addition to stripes framework. I don't
> know of any framework that has this feature of the box.
> -----Original Message-----
> From: stripes-users-bounces@...
> [mailto:stripes-users-bounces@...] On Behalf Of Aaron
> Porter
> Sent: Thursday, January 24, 2008 4:09 PM
> To: stripes-users@...
> Subject: Re: [Stripes-users] actions that take long time
>
> Nothing exists now but that does sound like an interesting idea and
> Stripe's Resolutions could make
> it work really well. It would probably be an annotation on the
> ActionBean's event method, maybe
> @DelayedAction("/your_wait_page.jsp"). When the event was going to be
> invoked it would spawn a new
> thread to do the processing and do a forward to the wait page. The wait
> page could use JavaScript to
> check if the processing was complete or fallback to a <meta
> http-equiv="refresh" content="2"> inside
> of a <noscript>.
>
> I'll have to play around with that idea!
>
> Aaron
>
> Leonard Gestrin wrote:
>> Hello,
>> I was wondering if anything in Stripes exists to support
> time-consuming
>> operation. Let's say, user hits an action that might take considerable
>> amount of time. In such cases, application should probably display
>> progress bar, spinner or something to tell user that operation is in
>> progress. It would be nice if it could show progress status and allow
>> user to cancel.
>>
>> it appears that this could probably be done with custom dispatcher
>> servlet, which would spawn new thread for every action that implements
>> certain interface (DelayedAction for example), so that servlet would
>> check on the
>> status and send back to the browser special page that would check back
>> after some time with a servlet.  We've done something like with
> Strut's
>> actions and it worked pretty well.
>>
>> It sounds like pretty common problem that people should face. It would
>> be interesting to know what people think - if it is reasonable
> approach
>> and how other folks solving this issue.
>>
>> Thanks
>> Leonard
>>
>>
>>
>>
>>
>>
>>
>>
> ------------------------------------------------------------------------
> -
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
>
> ------------------------------------------------------------------------
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@...
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: Anyone else using Groovy?

by Freddy D. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Re: actions that take long time

by Aaron Porter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Witness the power of Stripes! :D

http://www.mongus.com/stripes/WaitPageInterceptor.java
http://www.mongus.com/stripes/WaitPage.java

This is the first run at a wait page handler. Make sure you load the interceptor then all you have
to do is

@WaitPage(path="/waitpage.jsp")
public Resolution myEvent()
{
    // your code here
}

your wait page will be displayed while myEvent executes.

Make sure your wait page reloads itself. you can do this with JavaScript or you can add
<meta http-equiv="refresh" content="1" />
to your HTML. It is set up so that you can report the progress by setting a field in your actionBean
during event handling then displaying the progress in the wait page. Just make sure you add a
parameter named ajax otherwise the wait page won't keep reloading, it will just sit there waiting
for 60 seconds or the event handler to complete, whichever comes first.

The annotation also accepts a delay parameter which is the number of milliseconds to give your event
handler to run before going to the wait page. The error parameter is the jsp that will be forwarded
to in event of an error that makes it all the way out. Both the wait page and the error page receive
the actionBean as a request attribute so you can do whatever you want there. The error page also
receives the exception encountered as a request attribute.

Here's an example event handler:

        @WaitPage(path="/wait.jsp",delay=500,error="/error.jsp")
        public Resolution test() throws InterruptedException
        {
                Thread.sleep(5000);
               
                return new RedirectResolution("/complete.jsp");
        }

Enjoy! I'm going to bed. :)

Aaron

Aaron Porter wrote:
> I'm actually working on an Interceptor to do it right now. I can add in a delay that would wait x
> seconds for the event to complete before forwarding on to the wait page. I might have the initial
> code done tonight but no promises. :)
>
> Aaron
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: actions that take long time

by Leonard Gestrin :: Rate this Message: