The only thing is you need to do some maintenance. So you shutdown tomcat or the webapp context
update it and restart it again. The shutdown did save the session to disk..
Then after restart all sessions comes in memory again. And the request comes in.
But now pages are not made because the come from the session. So resources are not bound anymore.. (or yet)
With an initializer that is taken care of.
johan
On 5/10/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
imagine this situation w/out the use of initializer
you have a cluster where you do not use sticky sessions
user comes to node A and requests a page. this page binds a bunch of resources that image components on this page need. browser starts to render one of these image components and makes a resource to the resource url it needs. this request now comes to node B of the cluster. on node B no one has ever accessed this page before so none of its resources have been bound yet, so now one of the images will get a 404.
the initializer makes sure that all resources are bound on all nodes at startup time not at first-access time so the situation above does not occur.
hope this is clear enough
-IgorOn 5/10/06, smallufo <[EMAIL PROTECTED]> wrote:Hi
Can somebody explain the purpose of PackageResource.bind() in IInitializer ?
I tried to remove PackageResource.bind(application , Foo.class , "bar.gif") in IInitializer
and ... keeps the following code intact in Page/Panel
add(new Image("myImage" , new PackageResourceReference(Foo.class, "bar.gif")));
and the whole application works fine , images correctly shown. (I am sure the IInitializer.init() is executed)
I just get confused. What is the purpose of PackageResource.bind in IInitializer ?
In the JavaDoc , it says for some reason about sticky session or cluster ... But I am still not clear...
If it is for the purpose of sticky session or cluster ... why do we need to duplicate some very similar code ?
I think
PackageResource.bind(application , Foo.class , "bar.gif")
and
...new PackageResourceReference(Foo.class, "bar.gif")));
seems violate the DRY rule...
