AW: WebSession Casting unable

2009-10-05 Thread Peter Arnulf Lustig
yeah you are right. Thank you for your help.



- Ursprüngliche Mail 
Von: Pedro Santos 
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 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 getHomePage() {
>return Backend.class;
>}
> }
>
>
> Is this what you mean?
>
>
>
>
>
> - Ursprüngliche Mail 
> Von: Pieter Degraeuwe 
> 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  >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



Re: WebSession Casting unable

2009-10-05 Thread Pedro Santos
your implementation needs to return an instance of SecurePageSession

On Mon, Oct 5, 2009 at 8:43 AM, Peter Arnulf Lustig 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 getHomePage() {
>return Backend.class;
>}
> }
>
>
> Is this what you mean?
>
>
>
>
>
> - Ursprüngliche Mail 
> Von: Pieter Degraeuwe 
> 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  >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


AW: WebSession Casting unable

2009-10-05 Thread Peter Arnulf Lustig
ah sorry I got it:
@Override
public org.apache.wicket.Session newSession(Request request, Response 
response) {
return new SecurePageSession(request);
}

Thank you. I had the auto-fixed solution from netbeans :)





- Ursprüngliche Mail 
Von: Pieter Degraeuwe 
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 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



AW: WebSession Casting unable

2009-10-05 Thread Peter Arnulf Lustig
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 getHomePage() {
return Backend.class;
}
}


Is this what you mean?





- Ursprüngliche Mail 
Von: Pieter Degraeuwe 
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 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



Re: WebSession Casting unable

2009-10-05 Thread Pieter Degraeuwe
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 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


WebSession Casting unable

2009-10-05 Thread Peter Arnulf Lustig
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