your implementation needs to return an instance of SecurePageSession
On Mon, Oct 5, 2009 at 8:43 AM, Peter Arnulf Lustig <[email protected]>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 <[email protected]>
> An: [email protected]
> 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 <[email protected]
> >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: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
>
> --
> Pieter Degraeuwe
> Systemworks bvba
> Belgiëlaan 61
> 9070 Destelbergen
> GSM: +32 (0)485/68.60.85
> Email: [email protected]
> visit us at http://www.systemworks.be
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Pedro Henrique Oliveira dos Santos