Discussion:
Struts 2 and NanoContainer 1.x?
Daniel Wellman
2008-09-27 19:12:13 UTC
Permalink
Greetings,

I'm in the process of upgrading from WebWork 2.1.7 to WW 2.2.x and use
NanoContainer 1.x and PicoContainer. I use the
ServletRequestContainerFilter, ServletContainerListener, and
PicoObjectFactoryFilter combo to specify my own ContainerComposer with app,
session, and request-scope Picos.

I'm looking to upgrade to Struts 2 soon, and wanted to know what the
preferred option for Nano/Pico support was? Is Pico/Nano 1.x supported, or
do I need to upgrade to Pico/PicoWeb 2.x first? I see that Struts2 includes
a PicoFilterDispatcher just like WebWork 2.2, but I wasn't sure what version
of Pico was required, etc.

Thanks,
Dan
--
View this message in context: http://www.nabble.com/Struts-2-and-NanoContainer-1.x--tp19705615p19705615.html
Sent from the NanoContainer - PicoContainer - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Paul Hammant
2008-09-27 19:48:35 UTC
Permalink
Dan,

The NanoContainer code-line has moved to PicoContainer-Web ( http://picocontainer.org/web/
) entirely. It was more of a re-write than a refactoring, whereas
PicoContainer 2.0 was closer to refactor than rewrite. The 1.x line
is supported for bugs of course, but all active development is
happening in the 2.x code-line. That included for web. It would be
possible to redo the old NanoContainer web stuff for the new
PicoContainer, but I'm thinking the benefits of fully upgrading to 2.0
are too good to pass up.

The biggest change, is to the way the SessionContext is used to store
instantiated components. Essentially, we used to make a new container
per session (incl re-registering comps) and serialize it with the
session. For the newer PicoContainer 2.0 web stuff the whole
container is populated once only, and not itself stored with the
session. Only the instantiated components are stored for the session.

I appreciate that that is some work for you for an existing codebase,
but we do have a Struts2 binding for PicoContainer web 2.x


Regards,

- Paul
Post by Daniel Wellman
Greetings,
I'm in the process of upgrading from WebWork 2.1.7 to WW 2.2.x and use
NanoContainer 1.x and PicoContainer. I use the
ServletRequestContainerFilter, ServletContainerListener, and
PicoObjectFactoryFilter combo to specify my own ContainerComposer with app,
session, and request-scope Picos.
I'm looking to upgrade to Struts 2 soon, and wanted to know what the
preferred option for Nano/Pico support was? Is Pico/Nano 1.x
supported, or
do I need to upgrade to Pico/PicoWeb 2.x first? I see that Struts2 includes
a PicoFilterDispatcher just like WebWork 2.2, but I wasn't sure what version
of Pico was required, etc.
Thanks,
Dan
--
View this message in context: http://www.nabble.com/Struts-2-and-NanoContainer-1.x--tp19705615p19705615.html
Sent from the NanoContainer - PicoContainer - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Daniel Wellman
2008-09-28 05:42:41 UTC
Permalink
Paul,

Thanks for the info and prompt response.

I'll download Pico 2 and try to build a sample application with Struts 2 to
get a feeling for the changes. I see that the new WebapplicationContext was
introduced to handle the app/session/request context scopes. Is there an
upgrade guide for 1.x to 2.x?

Thanks,
Dan
Post by Paul Hammant
n
Dan,
The NanoContainer code-line has moved to PicoContainer-Web (
http://picocontainer.org/web/
) entirely. It was more of a re-write than a refactoring, whereas
PicoContainer 2.0 was closer to refactor than rewrite. The 1.x line
is supported for bugs of course, but all active development is
happening in the 2.x code-line. That included for web. It would be
possible to redo the old NanoContainer web stuff for the new
PicoContainer, but I'm thinking the benefits of fully upgrading to 2.0
are too good to pass up.
The biggest change, is to the way the SessionContext is used to store
instantiated components. Essentially, we used to make a new container
per session (incl re-registering comps) and serialize it with the
session. For the newer PicoContainer 2.0 web stuff the whole
container is populated once only, and not itself stored with the
session. Only the instantiated components are stored for the session.
I appreciate that that is some work for you for an existing codebase,
but we do have a Struts2 binding for PicoContainer web 2.x
Regards,
- Paul
Post by Daniel Wellman
Greetings,
I'm in the process of upgrading from WebWork 2.1.7 to WW 2.2.x and use
NanoContainer 1.x and PicoContainer. I use the
ServletRequestContainerFilter, ServletContainerListener, and
PicoObjectFactoryFilter combo to specify my own ContainerComposer with app,
session, and request-scope Picos.
I'm looking to upgrade to Struts 2 soon, and wanted to know what the
preferred option for Nano/Pico support was? Is Pico/Nano 1.x
supported, or
do I need to upgrade to Pico/PicoWeb 2.x first? I see that Struts2 includes
a PicoFilterDispatcher just like WebWork 2.2, but I wasn't sure what version
of Pico was required, etc.
Thanks,
Dan
--
http://www.nabble.com/Struts-2-and-NanoContainer-1.x--tp19705615p19705615.html
Sent from the NanoContainer - PicoContainer - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
View this message in context: http://www.nabble.com/Struts-2-and-NanoContainer-1.x--tp19705615p19709072.html
Sent from the NanoContainer - PicoContainer - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Daniel Wellman
2008-11-09 16:38:47 UTC
Permalink
Hi Paul,

I'm working on upgrading my application to use PicoContainer 2.6 and PicoWeb
2.1. I think the PicoContainer documentation is quite good -- I especially
appreciated the section on Component Adapters which I thought was very
helpful.


A question on caching and lifecycle changes -- I see that PicoContainer 2
now does not cache components by default, which was the behavior for Pico
1.x. From the documentation:

Lifecycle is really only going to work for PicoContainers that are also
caching component instances. Caching was a default in PicoContainer 1.x, but
is not for 2.x - be warned!


I'm looking the the source for
PicoServletContainerListener#makeScopedContainers:

protected ScopedContainers makeScopedContainers() {
DefaultPicoContainer appCtnr = new DefaultPicoContainer(new
Caching(), makeParentContainer());
Storing sessStoring = new Storing();
DefaultPicoContainer sessCtnr = new
DefaultPicoContainer(sessStoring, appCtnr);
Storing reqStoring = new Storing();
DefaultPicoContainer reqCtnr = new DefaultPicoContainer(reqStoring,
sessCtnr);
return new
ScopedContainers(appCtnr,sessCtnr,reqCtnr,sessStoring,reqStoring);
}

#1. I see that the app container uses caching, but the session and request
containers use a Storing behavior. It looks like these use a ThreadLocal
storage mechanism, which caches the instances per thread. Is this correct?
Will these containers work with lifecycle methods as expected? For example,
I have a HibernateSession with lifecycle methods on it registered at Request
level in Pico/Nano 1.x.

#2. Furthermore, if I wanted to simulate the PicoWeb caching behavior in my
tests outside of an application server, should I be using the same
app=Caching, session=Storing, request=Storing behaviors as specified above?

Thank for your advice!

Dan
Post by Paul Hammant
Dan,
The NanoContainer code-line has moved to PicoContainer-Web (
http://picocontainer.org/web/
) entirely. It was more of a re-write than a refactoring, whereas
PicoContainer 2.0 was closer to refactor than rewrite. The 1.x line
is supported for bugs of course, but all active development is
happening in the 2.x code-line. That included for web. It would be
possible to redo the old NanoContainer web stuff for the new
PicoContainer, but I'm thinking the benefits of fully upgrading to 2.0
are too good to pass up.
The biggest change, is to the way the SessionContext is used to store
instantiated components. Essentially, we used to make a new container
per session (incl re-registering comps) and serialize it with the
session. For the newer PicoContainer 2.0 web stuff the whole
container is populated once only, and not itself stored with the
session. Only the instantiated components are stored for the session.
I appreciate that that is some work for you for an existing codebase,
but we do have a Struts2 binding for PicoContainer web 2.x
Regards,
- Paul
--
View this message in context: http://www.nabble.com/Struts-2-and-NanoContainer-1.x--tp19705615p20408128.html
Sent from the NanoContainer - PicoContainer - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...