wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: Use application.setName to set a custom name?
Date Wed, 21 Jan 2015 08:46:39 GMT
On Wed, Jan 21, 2015 at 10:12 AM, Thorsten Schöning <tschoening@am-soft.de>
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: Thorsten.Schoening@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message