[seam-dev] Wicket & Interceptors

Pete Muir pmuir at bleepbleep.org.uk
Mon May 12 11:08:25 EDT 2008


I did consider forcing creation of seam-enabled wicket components  
through a factory and just returning a proxy, however this struck me  
as fairly un-wicket-like as it seemed to me that the simplicity of  
Wicket was that you could use new and anonymous inner classes. Maybe  
we do a POC using factories for now, and look at classloading tricks  
or Paolo's idea as a second step.

On 12 May 2008, at 16:03, Igor Vaynberg wrote:

> i think thats what pax wicket does for osgi integration
>
> -igor
>
>
> On Mon, May 12, 2008 at 12:07 AM, Johan Compagner <jcompagner at gmail.com 
> > wrote:
>> You could create a factory where you ask your instances from  
>> instead of new...
>>
>>
>>
>> On 5/12/08, Paolo Di Tommaso <paolo.ditommaso at gmail.com> wrote:
>>> Other than using AspectJ to intercept the @Begin annotated  
>>> methods, I don't
>>> see an elegant/straightforward solution.
>>>
>>>
>>> An idea could be to subclass WebPage adding a visitor to look for  
>>> all
>>> components implementing IFormSubmitListener interface  
>>> (ILinkListener .. and
>>> so on).
>>>
>>> That components should be replaced dynamically with an interceptor  
>>> proxy.
>>>
>>> Anyway it would be a partial solution because in Wicket action  
>>> could be
>>> submitted with behaviour also.
>>>
>>> Core developers any ideas?
>>>
>>>
>>> // Paolo
>>>
>>>
>>>
>>> On Fri, May 9, 2008 at 6:27 PM, Pete Muir  
>>> <pmuir at bleepbleep.org.uk> wrote:
>>>
>>>> All,
>>>> Looking for some ideas/suggestions here (perhaps I am missing a  
>>>> trick
>>>> here?).
>>>>
>>>> Wicket binds html layout/styling to Java objects which define the
>>>> component
>>>> behaviour:
>>>>
>>>> public class Home extends WebPage {
>>>>
>>>>  @In Foo foo;
>>>>
>>>>  public Home(final PageParameters parameters) {
>>>>    add(new LoginForm("login"));
>>>>  }
>>>> }
>>>>
>>>> is doable, as we use a component instantiation callback (provided  
>>>> by
>>>> Wicket) to make foo a proxy which asks Seam for the component  
>>>> *every time*
>>>> the object is accessed. This is pretty ugly though, and I would  
>>>> prefer to
>>>> use injection/disinjection.
>>>>
>>>> However, if we want to do:
>>>>
>>>> public class LoginForm extends Form {
>>>>    public LoginForm(String id) {
>>>>      super(id);
>>>>      add(new TextField("username", new PropertyModel(identity,
>>>> "username")));
>>>>      add(new PasswordTextField("password", new  
>>>> PropertyModel(identity,
>>>> "password")));
>>>>      }
>>>>
>>>>      @Begin
>>>>      protected void onSubmit() {
>>>>        // Authenticate, and display feedback to user
>>>>      }
>>>>    }
>>>>  }
>>>> }
>>>>
>>>> then no lifecycle callback will help.
>>>>
>>>> As you can see the new operator is used almost exclusively. This  
>>>> means we
>>>> can't use a proxy based interceptor system. So, AFAICS we have to  
>>>> use byte
>>>> code enhancement to apply an interceptor, I guess either at  
>>>> compile time
>>>> or
>>>> through a custom classloader.
>>>>
>>>> So,
>>>>
>>>> 1) is it worth it (this is starting to get very fiddly)?
>>>> 2) is there a better way?
>>>>
>>>> Thanks :)
>>>>
>>>> _______________________________________________
>>>> seam-dev mailing list
>>>> seam-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>>>
>>>>
>>>
>>




More information about the seam-dev mailing list