yeah you are right. Thank you for your help.
----- Ursprüngliche Mail ---- Von: Pedro Santos <pedros...@gmail.com> An: users@wicket.apache.org Gesendet: Montag, den 5. Oktober 2009, 13:50:32 Uhr Betreff: Re: WebSession Casting unable your implementation needs to return an instance of SecurePageSession On Mon, Oct 5, 2009 at 8:43 AM, Peter Arnulf Lustig <uuuuu...@yahoo.de>wrote: > I have overwritten the newSession Method: > > > > public class Application extends WebApplication { > > @Override > protected void init() { > super.init(); > getSecuritySettings().setAuthorizationStrategy(new > AdministratorLoginSimplePageAuthStrategy(LoginPage.class)); > } > > @Override > public org.apache.wicket.Session newSession(Request request, Response > response) { > return super.newSession(request, response); > } > > > > @Override > public Class<? extends Page> getHomePage() { > return Backend.class; > } > } > > > Is this what you mean? > > > > > > ----- Ursprüngliche Mail ---- > Von: Pieter Degraeuwe <pieter.degrae...@systemworks.be> > An: users@wicket.apache.org > Gesendet: Montag, den 5. Oktober 2009, 13:29:28 Uhr > Betreff: Re: WebSession Casting unable > > Not each Websession is a SecurePageSession. (but each SecurePageSession IS > a > WebSession) > So, it means that you probably are dealing with a normal WebSession. > > Is your Application creating the correct Session instance (override the > newSession()) > > > > On Mon, Oct 5, 2009 at 1:19 PM, Peter Arnulf Lustig <uuuuu...@yahoo.de > >wrote: > > > Hi, > > > > why can't I cast a Websession to a SecurePageSession-Class which extends > > Websession?! > > > > > > java.lang.ClassCastException: org.apache.wicket.protocol.http.WebSession > > cannot be cast to org.omikron.test.SecurePageSession > > > > In the book I bought (Wicket in Praxis, a german book for wicket 1.4) the > > author does it like that. > > Thats my source: > > > > public class SecurePageSession extends WebSession{ > > > > Integer administratorId; > > > > public SecurePageSession(Request request) { > > super(request); > > } > > > > public synchronized void setAdministrator(Administrator administrator) > { > > administratorId = administrator.getId(); dirty(); > > } > > > > public synchronized void clearAdministrator() { > > administratorId = null; dirty(); > > } > > > > public synchronized Administrator getAdministrator() { > > if (administratorId != null ) return > > AdministratorDataProvider.getAdministrator(administratorId); > > return null; > > } > > > > public synchronized boolean isAdministratorLogin() { > > return administratorId != null ? true:false; > > } > > > > public static SecurePageSession get() { > > return (SecurePageSession) Session.get(); > > } > > > > } > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > -- > Pieter Degraeuwe > Systemworks bvba > Belgiëlaan 61 > 9070 Destelbergen > GSM: +32 (0)485/68.60.85 > Email: pieter.degrae...@systemworks.be > visit us at http://www.systemworks.be > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Pedro Henrique Oliveira dos Santos --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org