I actually started to use this strategy by placing my custom Session and
Application classes in my package :

public class Session extends WebSession {

        Application application;
        public Session(Application application) {
                super(application);
                this.application = application;
        }

        /**
         * shortcut method to obtain the Session from the current
RequestCycle 
         */
        public static Session get() {
                RequestCycle cycle = RequestCycle.get();
                return (Session)cycle.getSession();
        }

        ...

}

public class Application extends wicket.protocol.http.WebApplication
{
        public static Application instance;
        
        public static Application get() {
                return instance;
        }
        
        protected void init() {
                instance = this;
                ...
        }
        ...
}

Then in my code I can always call Session.get() or Application.get()

Cameron.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:wicket-develop-
> [EMAIL PROTECTED] On Behalf Of Igor Vaynberg
> Sent: Wednesday, 17 August 2005 3:25 PM
> To: [email protected]
> Subject: [Wicket-develop] Renaming getApplication() and getSession()
> 
> What do you guys think of renaming all the getApplication() and
> getSession()
> methods to getWicketApplication() and getWicketSession(). I am really sick
> of introducing get<SHORT_APP_NAME>Application() and
> get<SHORT_APP_NAME>Session() everywhere because afore mentioned are
> already
> taken and final! Makes my code look way more verbose. Seems like a good
> time
> to do it since we are breaking some things in this release anyways.
> 
> -Igor
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Wicket-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-develop



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to