On Wed, Jan 21, 2015 at 12:18 PM, Thorsten Schöning <tschoen...@am-soft.de> wrote:
> Guten Tag Martin Grigorov, > am Mittwoch, 21. Januar 2015 um 09:46 schrieben Sie: > > > But how would you decide what name to use if you do this in the > constructor? > > At that time you don't have access to many things, e.g. the servlet > context. > > I would have implemented a ServletContextListener to create my custom > name depending on it's dir name and save that statically. Such a > listener should always be called before the Wicket filter. > > > I meant to add your own MBean somewhere in the root. > > This way it will be easy for you to check the instance "real" name in the > > JMX viewer > > I see, but for that to work I would need more than one wicket specific > entry in the console and currently I have only one. It's always just > one "org.apache.wicket.app.WicketFilter", where WicketFilter is the > name of the filter in web.xml, and not two of them. I guess I only see > the first recognized or whatever, if I change one name in web.xml, I > get two entries. > This is a problem that deserves a ticket, IMO. MyApp#init() method is called *after* the initializers so it would be too late for changing the name even with Java reflection. I guess you could override MyApp#internalInit() to set the name (with reflection) before the initializers, but I'm not sure it will work (I haven't tried). If no one else has better idea then I guess we can add the check in WicketFilter to set the name only if it is not set already. > > > Here is a quick and dirty workaround for the problem: use Reflection to > set > > the Application#name field value to anything by-passing the setter and > the > > check. > > I will rather stick with documentation in web.xml if I can't guarantee > being the first and only one setting this. Thanks anyways! > > Mit freundlichen Grüßen, > > Thorsten Schöning > > -- > Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de > AM-SoFT IT-Systeme http://www.AM-SoFT.de/ > > Telefon...........05151- 9468- 55 > Fax...............05151- 9468- 88 > Mobil..............0178-8 9468- 04 > > AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln > AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >