On Sat, September 07, 2013, Martin Grigorov wrote:

> > com.mycompany.request.WicketContainerChecker.onInstantiation(WicketContainerChecker.java:48)
> >
> 
> What is this doing ?
> Does it start a new thread by chance ?
> Or doing something like: ThreadContext.detach() /
> ThreadContext.setRequestCycle(null)

No, nothing of that kind. It's just a helper to make sure noone
uses Ajax on components which are added to the markup as
"<wicket:container wicket:id="...">...</wicket:container>...".
The code goes like this:

| public class WicketContainerChecker implements 
IComponentInstantiationListener {
|     private static final Behavior BEHAVIOR = new Behavior() {
|         private static final long serialVersionUID = 1L;
| 
|         @Override
|         public void onComponentTag( final Component component, final 
ComponentTag tag ) {
|             if ( tag instanceof WicketTag && "container".equals( 
tag.getName() ) && component.getOutputMarkupId() ) {
|                 throw new IllegalStateException( "Component " + component + " 
requests a markup id (" + component.getMarkupId() + ") but is attached to " + 
tag
|                         + "! This will not work in deployment mode!" );
|             }
|         }
|     };
| 
|     @Override
|     public void onInstantiation( Component component ) {
|         component.add( BEHAVIOR );
|     }
| }

Cheers,

M'bert

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
WE ARE THE BORG - RESISTANCE IS VOLTAGE DIVIDED BY CURRENT!

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to