You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by S M <co...@gmail.com> on 2013/02/12 05:20:51 UTC

struts2 and WebSphere dynacache

Hi,
How do we cache struts2 actions using dynache? Since struts2 uses a filter
instead of servlets, the cachespec.xml entries I have for the actions don't
seem to have any effect.

Re: struts2 and WebSphere dynacache

Posted by Lukasz Lenart <lu...@apache.org>.
2013/2/12 S M <co...@gmail.com>:
> What if I use a servlet for the 'View' instead of using a struts2 action or
> using spring/guice? Since my only objective is to try use dynacache, for
> the views.

There is no View action in Struts 2 by default, is it a custom action
you made? Anyway, if those are the static resources (like JS, Html
pages) you should server them as a static content. Struts 2 already
support that:

http://struts.apache.org/development/2.x/docs/static-content.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2 and WebSphere dynacache

Posted by S M <co...@gmail.com>.
What if I use a servlet for the 'View' instead of using a struts2 action or
using spring/guice? Since my only objective is to try use dynacache, for
the views.

I don't have experience with Spring so my understanding of the benefits are
lacking.

On Tue, Feb 12, 2013 at 10:20 AM, Antonios Gkogkakis <gk...@tcd.ie>wrote:

> Assuming that caching of Action objects makes sense in your application,
> you could change the struts default object factory,
> to guice or spring and declare the  action beans that you want to be cached
> as singletons. Alternatively you could write your own object factory and
> put some caching logic there.
>
> Antonios
>
> On 12 February 2013 15:06, S M <co...@gmail.com> wrote:
>
> > Hi,
> > Thanks for the quick response. I've structured my struts2 application by
> > using a struts action 'View' which renders different pages depending on
> the
> > parameters passed in to the view. So I'm looking to cache the different
> > pages based on the url.
> >
> >
> >
> >
> >
> > On Tue, Feb 12, 2013 at 1:20 AM, Lukasz Lenart <lukaszlenart@apache.org
> > >wrote:
> >
> > > 2013/2/12 S M <co...@gmail.com>:
> > > > Hi,
> > > > How do we cache struts2 actions using dynache? Since struts2 uses a
> > > filter
> > > > instead of servlets, the cachespec.xml entries I have for the actions
> > > don't
> > > > seem to have any effect.
> > >
> > > Why and what for? Actions are dynamic elements of your application and
> > > caching them doesn't make sense.
> > >
> > >
> > > Regards
> > > --
> > > Łukasz
> > > + 48 606 323 122 http://www.lenart.org.pl/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
>

Re: struts2 and WebSphere dynacache

Posted by Ken McWilliams <ke...@gmail.com>.
Even then the solution is very limited. The OP probably wants to cache all
popular pages/reports, in many cases the same action will be responsible...
a singleton clearly can't address that.

It could be addressed with an object pool that was keyed to actions,
parameters and values and managed by an interceptor. I think it would be
tricky to implement, particularly the promotion of which resources to the
cache and which objects to dispose of.


On Wed, Feb 13, 2013 at 2:22 AM, Antonios Gkogkakis <gk...@tcd.ie> wrote:

> On 13 February 2013 07:35, Lukasz Lenart <lu...@apache.org> wrote:
>
> > 2013/2/12 Antonios Gkogkakis <gk...@tcd.ie>:
> > > Assuming that caching of Action objects makes sense in your
> application,
> > > you could change the struts default object factory,
> > > to guice or spring and declare the  action beans that you want to be
> > cached
> > > as singletons. Alternatively you could write your own object factory
> and
> > > put some caching logic there.
> >
> > It isn't a good practise to declare actions as singleton, Struts 2
> > wasn't designed in that way. You really must know what are you doing
> > :-)
> >
> > I'm with you on that one Lukasz that's way I said "assuming..." :)
> >
>
> Antonios
>

Re: struts2 and WebSphere dynacache

Posted by Antonios Gkogkakis <gk...@tcd.ie>.
On 13 February 2013 07:35, Lukasz Lenart <lu...@apache.org> wrote:

> 2013/2/12 Antonios Gkogkakis <gk...@tcd.ie>:
> > Assuming that caching of Action objects makes sense in your application,
> > you could change the struts default object factory,
> > to guice or spring and declare the  action beans that you want to be
> cached
> > as singletons. Alternatively you could write your own object factory and
> > put some caching logic there.
>
> It isn't a good practise to declare actions as singleton, Struts 2
> wasn't designed in that way. You really must know what are you doing
> :-)
>
> I'm with you on that one Lukasz that's way I said "assuming..." :)
>

Antonios

Re: struts2 and WebSphere dynacache

Posted by Lukasz Lenart <lu...@apache.org>.
2013/2/12 Antonios Gkogkakis <gk...@tcd.ie>:
> Assuming that caching of Action objects makes sense in your application,
> you could change the struts default object factory,
> to guice or spring and declare the  action beans that you want to be cached
> as singletons. Alternatively you could write your own object factory and
> put some caching logic there.

It isn't a good practise to declare actions as singleton, Struts 2
wasn't designed in that way. You really must know what are you doing
:-)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: struts2 and WebSphere dynacache

Posted by Antonios Gkogkakis <gk...@tcd.ie>.
Assuming that caching of Action objects makes sense in your application,
you could change the struts default object factory,
to guice or spring and declare the  action beans that you want to be cached
as singletons. Alternatively you could write your own object factory and
put some caching logic there.

Antonios

On 12 February 2013 15:06, S M <co...@gmail.com> wrote:

> Hi,
> Thanks for the quick response. I've structured my struts2 application by
> using a struts action 'View' which renders different pages depending on the
> parameters passed in to the view. So I'm looking to cache the different
> pages based on the url.
>
>
>
>
>
> On Tue, Feb 12, 2013 at 1:20 AM, Lukasz Lenart <lukaszlenart@apache.org
> >wrote:
>
> > 2013/2/12 S M <co...@gmail.com>:
> > > Hi,
> > > How do we cache struts2 actions using dynache? Since struts2 uses a
> > filter
> > > instead of servlets, the cachespec.xml entries I have for the actions
> > don't
> > > seem to have any effect.
> >
> > Why and what for? Actions are dynamic elements of your application and
> > caching them doesn't make sense.
> >
> >
> > Regards
> > --
> > Łukasz
> > + 48 606 323 122 http://www.lenart.org.pl/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

Re: struts2 and WebSphere dynacache

Posted by S M <co...@gmail.com>.
Hi,
Thanks for the quick response. I've structured my struts2 application by
using a struts action 'View' which renders different pages depending on the
parameters passed in to the view. So I'm looking to cache the different
pages based on the url.





On Tue, Feb 12, 2013 at 1:20 AM, Lukasz Lenart <lu...@apache.org>wrote:

> 2013/2/12 S M <co...@gmail.com>:
> > Hi,
> > How do we cache struts2 actions using dynache? Since struts2 uses a
> filter
> > instead of servlets, the cachespec.xml entries I have for the actions
> don't
> > seem to have any effect.
>
> Why and what for? Actions are dynamic elements of your application and
> caching them doesn't make sense.
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: struts2 and WebSphere dynacache

Posted by Lukasz Lenart <lu...@apache.org>.
2013/2/12 S M <co...@gmail.com>:
> Hi,
> How do we cache struts2 actions using dynache? Since struts2 uses a filter
> instead of servlets, the cachespec.xml entries I have for the actions don't
> seem to have any effect.

Why and what for? Actions are dynamic elements of your application and
caching them doesn't make sense.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org