Risking writing a message for /dev/null (sourceforge lists are borked at the moment)...

There is an RFE/Bug report for working with the different application aspects. Currently you have to merge these by hand yourself.

I suggest (tried and tested at my company) to use the Auth application as your base class and merge the spring related stuff into your subclass. The spring integration is agnostic for sessions and such, so you'll be up and running much quicker.

Probably not all methods are necessary, but this works for me :-)

public class MyApplication extends AuthenticatedWebApplication implements
        ApplicationContextAware {
    /**
     * Constructor.
     */
    public MyApplication() {
    }
    /**
     * @see AuthenticatedWebApplication#getWebSessionClass()
     */
    @Override
    protected Class<? extends AuthenticatedWebSession> getWebSessionClass() {
        return MySession.class;
    }

    /**
     * @see AuthenticatedWebApplication#getSignInPageClass()
     */
    @Override
    protected Class<? extends WebPage> getSignInPageClass() {
        return MySignInPage.class;
    }
    private ApplicationContext applicationContext;
    private final static ISpringContextLocator contextLocator = new MySpringContextLocator();
    protected void internalInit() {
        super.internalInit();

        if (applicationContext == null) {
            // this application was not created as a spring bean so we
            // locate the app context from servlet context

            ServletContext sc = getWicketServlet().getServletContext();
            applicationContext = WebApplicationContextUtils
                    .getRequiredWebApplicationContext(sc);

        }
        InjectorHolder.setInjector(new AnnotSpringInjector(
                getSpringContextLocator()));
        addComponentInstantiationListener(new ComponentInjector());
    }
    public final void setApplicationContext(
            ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
    protected final ApplicationContext internalGetApplicationContext() {
        return applicationContext;
    }
    public ISpringContextLocator getSpringContextLocator() {
        return contextLocator;
    }
    protected Object createSpringBeanProxy(Class clazz, String beanName) {
        return LazyInitProxyFactory.createProxy(clazz, new SpringBeanLocator(
                beanName, clazz, getSpringContextLocator()));
    }
    protected Object createSpringBeanProxy(Class clazz) {
        return LazyInitProxyFactory.createProxy(clazz, new SpringBeanLocator(
                clazz, getSpringContextLocator()));
    }
    public static final class MySpringContextLocator implements
            ISpringContextLocator {
        /** Voor serializatie. */
        private static final long serialVersionUID = 1L;

        public ApplicationContext getSpringContext() {
            Application app = Application.get();
            return ((MyApplication) app).internalGetApplicationContext();
        }
    }
}




Martijn

On 6/7/06, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote:

Hi all,

i started to learn about wicket. But i get confused, as more as i read.
Simplicity is wickets great promice. The approach is great: Java and Html,
no XML, noJSP, that sounds fantastic, but now i have to build  up knowlede
'from the ground' around wickets architecture first. However, i will not
give up, there is no alternative and as far as i can, i will help, at least
with my humble comments. :-)
But now to my actual question; At the auth module, the application is used
to act as a single point of initialization, inherit by
AuthenticationApplication or something. Combining Wicket with Spring, again
the application is used to inherit now from the DataApplication.
I expected to code nothing new but rather just to use modules, but it
seems, that i have to. So, how can i combine at least these two aspects
(Databinding via Spring and authentication) as easy as possible?
And another question: Is it planned to deal with the portal spec? Or: How
can i control the application considering the users role?

Thx in advance!
Cheers, Peter



_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



--
Download Wicket 1.2 now! Write Ajax applications without touching _javascript_!
-- http://wicketframework.org
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to