You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Jean-Baptiste Quenot <jb...@apache.org> on 2007/07/16 10:06:24 UTC

Re: Register the web application instance with the servlet context (Was: svn commit: r556443)

* ehillenius@apache.org:
> Author: ehillenius
> Date: Sun Jul 15 13:20:59 2007
> New Revision: 556443
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=556443
> Log:
> register the web application instance with the servlet context so that extending framework can find the instance without having to rely on the current thread

Eelco,

That's a nice idea but sadly I don't think it will work if you have
multiple Wicket applications in the same servlet context.  For
example in wicket-examples we have several dozen apps on the same
servlet context.  The servlet context attribute will be overriden
everytime, so in the end you'll only keep the last-initialized
application.
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

Re: Register the web application instance with the servlet context (Was: svn commit: r556443)

Posted by Eelco Hillenius <ee...@gmail.com>.
> Surely you can just register it like that, but also put the name of the
> Wicket application (getName()) in the attribute key?
>
> Of course, that requires you to pass in the name of the Wicket app to
> your Seam stuff somehow, but if you want to support running multiple
> apps in a single context then you'll need to disambiguate them somehow
> anyway, so that doesn't seem unreasonable.

Hey Al. I already fixed it by rolling back. Applications were already
put in a static map, and the keys of that map are exposed now as well.
That way, you can at least detect whether there is *some* Wicket app
running, and extensions projects like wicket-seam can attach to the
application if there is only one, or complain it needs more
configurtion if there are multiple.

Eelco

Re: Register the web application instance with the servlet context (Was: svn commit: r556443)

Posted by Al Maw <wi...@almaw.com>.
Eelco Hillenius wrote:
> On 7/16/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
>> * ehillenius@apache.org:
>> > Author: ehillenius
>> > Date: Sun Jul 15 13:20:59 2007
>> > New Revision: 556443
>> >
>> > URL: http://svn.apache.org/viewvc?view=rev&rev=556443
>> > Log:
>> > register the web application instance with the servlet context so 
>> that extending framework can find the instance without having to rely 
>> on the current thread
>>
>> Eelco,
>>
>> That's a nice idea but sadly I don't think it will work if you have
>> multiple Wicket applications in the same servlet context.  For
>> example in wicket-examples we have several dozen apps on the same
>> servlet context.  The servlet context attribute will be overriden
>> everytime, so in the end you'll only keep the last-initialized
>> application.
> 
> Blast. You're right of course. I was too focussed on getting Seam to
> work. I'll look for an alternative solution. I want something that
> doesn't require *any* knowledge about specific Wicket applications.

Surely you can just register it like that, but also put the name of the 
Wicket application (getName()) in the attribute key?

Of course, that requires you to pass in the name of the Wicket app to 
your Seam stuff somehow, but if you want to support running multiple 
apps in a single context then you'll need to disambiguate them somehow 
anyway, so that doesn't seem unreasonable.

Al

-- 
Alastair Maw
Wicket-biased blog at http://herebebeasties.com

Re: Register the web application instance with the servlet context (Was: svn commit: r556443)

Posted by Eelco Hillenius <ee...@gmail.com>.
On 7/16/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
> * ehillenius@apache.org:
> > Author: ehillenius
> > Date: Sun Jul 15 13:20:59 2007
> > New Revision: 556443
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=556443
> > Log:
> > register the web application instance with the servlet context so that extending framework can find the instance without having to rely on the current thread
>
> Eelco,
>
> That's a nice idea but sadly I don't think it will work if you have
> multiple Wicket applications in the same servlet context.  For
> example in wicket-examples we have several dozen apps on the same
> servlet context.  The servlet context attribute will be overriden
> everytime, so in the end you'll only keep the last-initialized
> application.

Blast. You're right of course. I was too focussed on getting Seam to
work. I'll look for an alternative solution. I want something that
doesn't require *any* knowledge about specific Wicket applications.

Eelco

Re: Register the web application instance with the servlet context (Was: svn commit: r556443)

Posted by Johan Compagner <jc...@gmail.com>.
and it looks like that we try to duplicate the Applicat.get(appname)
behavior
i think that is the way to always get an application object you only have to
know the appname

And to correctly do the thing below we also have to append the appname
after:

SERVLET_CONTEXT_APPLICATION_KEY

johan


On 7/16/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
>
> * ehillenius@apache.org:
> > Author: ehillenius
> > Date: Sun Jul 15 13:20:59 2007
> > New Revision: 556443
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=556443
> > Log:
> > register the web application instance with the servlet context so that
> extending framework can find the instance without having to rely on the
> current thread
>
> Eelco,
>
> That's a nice idea but sadly I don't think it will work if you have
> multiple Wicket applications in the same servlet context.  For
> example in wicket-examples we have several dozen apps on the same
> servlet context.  The servlet context attribute will be overriden
> everytime, so in the end you'll only keep the last-initialized
> application.
> --
>      Jean-Baptiste Quenot
> aka  John Banana   Qwerty
> http://caraldi.com/jbq/
>