You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2019/10/25 15:06:23 UTC

Is there a way to control Wicket's id generation?

I work on a government project and one of our rules is that all of our apps
scrape the request object and log it so that everything that happens can be
reviewed.  Partly this is for audit reasons, sometimes it comes in handy for
lawsuits, but mostly it's handy for our L2 support team. 

But when a dev fails to provide an explicit name for something, we get
things in the log like 'radio54' and the like.  Which is understandable as
the dev failed to provide a name (bad dev! *swats dev with newspaper*).  

A recent lawsuit revealed yet another place where the unhelpful 'radio38' is
logged.  Our PM asked if we can help our devs out because this mistake is
happening too often.  Can we disable wicket's natural tendency to generate
these names and force an exception instead?  Thus, the mistake would be
caught early.

Wicket often exposes 'strategy' objects or other overrides to do this sort
of thing, so I'm wondering if such a facility exists?  Even if it weren't an
exception, but were some other kind of thing that drew the dev's attention
it would be useful.  

We're in Wicket 6.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Is there a way to control Wicket's id generation?

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Oct 25, 2019 at 6:06 PM Entropy <bl...@gmail.com> wrote:

> I work on a government project and one of our rules is that all of our apps
> scrape the request object and log it so that everything that happens can be
> reviewed.  Partly this is for audit reasons, sometimes it comes in handy
> for
> lawsuits, but mostly it's handy for our L2 support team.
>
> But when a dev fails to provide an explicit name for something, we get
> things in the log like 'radio54' and the like.  Which is understandable as
> the dev failed to provide a name (bad dev! *swats dev with newspaper*).
>
> A recent lawsuit revealed yet another place where the unhelpful 'radio38'
> is
>

You, americans, are crazy with those law suits for everything and nothing!


> logged.  Our PM asked if we can help our devs out because this mistake is
> happening too often.  Can we disable wicket's natural tendency to generate
> these names and force an exception instead?  Thus, the mistake would be
> caught early.
>
> Wicket often exposes 'strategy' objects or other overrides to do this sort
> of thing, so I'm wondering if such a facility exists?  Even if it weren't
> an
> exception, but were some other kind of thing that drew the dev's attention
> it would be useful.
>

Like org.apache.wicket.IMarkupIdGenerator ?
See
org.apache.wicket.Component#getMarkupId(boolean)
and getApplication().getMarkupSettings().getMarkupIdGenerator()


>
> We're in Wicket 6.
>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Is there a way to control Wicket's id generation?

Posted by Bas Gooren <ba...@iswd.nl>.
Hi!

It sounds like you are referring to markup ids.

Have a look at the source code of Component:

https://github.com/apache/wicket/blob/wicket-6.x/wicket-core/src/main/java/org/apache/wicket/Component.java#L1508

This is where “random” ids are generated for components.
These generally have the format “id” + random chars.

Looking through the source code, the only reference I can find to “radio” +
unique id, is in Radio:

https://github.com/apache/wicket/blob/wicket-6.x/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Radio.java#L115

You can see that wicket auto-generates a “radioX” value there.
Of course the value can be overridden, but not with a central strategy.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 25 oktober 2019 bij 17:06:32, Entropy (blmulholland@gmail.com) schreef:

I work on a government project and one of our rules is that all of our apps
scrape the request object and log it so that everything that happens can be
reviewed. Partly this is for audit reasons, sometimes it comes in handy for
lawsuits, but mostly it's handy for our L2 support team.

But when a dev fails to provide an explicit name for something, we get
things in the log like 'radio54' and the like. Which is understandable as
the dev failed to provide a name (bad dev! *swats dev with newspaper*).

A recent lawsuit revealed yet another place where the unhelpful 'radio38'
is
logged. Our PM asked if we can help our devs out because this mistake is
happening too often. Can we disable wicket's natural tendency to generate
these names and force an exception instead? Thus, the mistake would be
caught early.

Wicket often exposes 'strategy' objects or other overrides to do this sort
of thing, so I'm wondering if such a facility exists? Even if it weren't an
exception, but were some other kind of thing that drew the dev's attention
it would be useful.

We're in Wicket 6.

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org