On Wed, Jan 21, 2015 at 10:12 AM, Thorsten Schöning <[email protected]> wrote:
> Guten Tag Martin Grigorov, > am Dienstag, 20. Januar 2015 um 19:21 schrieben Sie: > > > This is by design ( > > > https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/Application.java#L944-L945 > > ). > > The application name is used for internal caches, keys, etc. and it must > be > > something stable and unique. > > If it was allowed to change it at any time then many things may break. > > That's fine, but why am I not allowed to set it myself first? > WicketFilter could just test if it is already set and don't set it > than, it doesn't necessarily provide a better one. The problem > currently is only that it always wants to set it, even if I already > did using a custom constructor. > 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. > > That's the only thing that doesn't make sense to me. > > > I think the easiest thing to do is to export yet another JMX ObjectName > > with the custom name. See > > > https://github.com/apache/wicket/blob/master/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java#L109 > > I had a look at that as well, but didn't understand what I could do to > change the implementation, as there doesn't seem to be any hook or > callback or whatever to change how the variable "domain" is created. > It always uses the application name. > 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 > > Would I need to implement an own Initializer by overriding the > mentioned "init"? How would I register my Initializer to be used by > wicket-jmx then? I would prefer some way like it's now, either the > wicket-jmx gets deployed or not, so everything is as loose coupled as > now. > > Thanks for any more details. > 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. > > Mit freundlichen Grüßen, > > Thorsten Schöning > > -- > Thorsten Schöning E-Mail: [email protected] > 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: [email protected] > For additional commands, e-mail: [email protected] > >
