Re: Session.get covariant override and back button issue?

2008-07-25 Thread Timo Rantalaiho
On Thu, 24 Jul 2008, Ritz123 wrote:
 I have a custom Session object which is registered in the custom
 WebApplication class as newSession method override. 

Is your custom session class extending Session or WebSession?

 The session object overrides static Session.get() method returning custom

But static methods cannot be overriden in Java, can they?

 java.lang.ClassCastException: com.neobits.web.NeobitsWebSession
 at com.neobits.web.NeobitsWebSession.get(NeobitsWebSession.java:51)
 at
 com.neobits.web.pages.ViewCartPage$CartDetailsFragment$CheckoutButton.onSubmit(ViewCartPage.java:330)

Could you show those lines of code?

Best wishes,
Timo


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Session.get covariant override and back button issue?

2008-07-25 Thread Johan Compagner
do you use special classloading?

On Fri, Jul 25, 2008 at 4:21 AM, Ritz123 [EMAIL PROTECTED] wrote:


 Hi,

 I have a custom Session object which is registered in the custom
 WebApplication class as newSession method override.

 The session object overrides static Session.get() method returning custom
 instance (covariant). The problem is, for some reason when I hit back
 button
 in the browser I get ClassCastException on session  (see below)


 Root cause:

 java.lang.ClassCastException: com.neobits.web.NeobitsWebSession
 at com.neobits.web.NeobitsWebSession.get(NeobitsWebSession.java:51)
 at

 com.neobits.web.pages.ViewCartPage$CartDetailsFragment$CheckoutButton.onSubmit(ViewCartPage.java:330)
 --
 View this message in context:
 http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18644053.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Session.get covariant override and back button issue?

2008-07-25 Thread Ritz123

I dont have custom classloader but I do have custom resource loader, not sure
if that is relevant.

Ok here is the custom WebSession class and relevant method

public class NeobitsWebSession
extends WebSession
{

...
/**
 * Constructor
 * 
 * @param webapp
 * @param request
 */
public NeobitsWebSession(Application webapp, Request request)
{
super(request);
setApplication(webapp);
}

/**
 * Covariant for Session.get()
 * @return
 */
public static NeobitsWebSession get()
{
return (NeobitsWebSession)Session.get();
}


Here is the Custom WebApplication
public class NeobitsWebApp
extends WebApplication
{
   .
@Override
public Session newSession(Request request, Response response)
{
return new NeobitsWebSession(this, request);
}
...
}


Timo Rantalaiho wrote:
 
 On Thu, 24 Jul 2008, Ritz123 wrote:
 I have a custom Session object which is registered in the custom
 WebApplication class as newSession method override. 
 
 Is your custom session class extending Session or WebSession?
 
 The session object overrides static Session.get() method returning custom
 
 But static methods cannot be overriden in Java, can they?
 
 java.lang.ClassCastException: com.neobits.web.NeobitsWebSession
 at com.neobits.web.NeobitsWebSession.get(NeobitsWebSession.java:51)
 at
 com.neobits.web.pages.ViewCartPage$CartDetailsFragment$CheckoutButton.onSubmit(ViewCartPage.java:330)
 
 Could you show those lines of code?
 
 Best wishes,
 Timo
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18655699.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Session.get covariant override and back button issue?

2008-07-25 Thread Ritz123

Igor, 

I have posted the relevant code in the other reply to Tim. If you mean
actual class being returned from the covariant get() method - I tried
returning both Session and NeobitsWebSession (my custom websession class).
But still get the same error.



igor.vaynberg wrote:
 
 and so what is the actual class being returned?
 
 -igor
 
 On Thu, Jul 24, 2008 at 7:21 PM, Ritz123 [EMAIL PROTECTED] wrote:

 Hi,

 I have a custom Session object which is registered in the custom
 WebApplication class as newSession method override.

 The session object overrides static Session.get() method returning custom
 instance (covariant). The problem is, for some reason when I hit back
 button
 in the browser I get ClassCastException on session  (see below)


 Root cause:

 java.lang.ClassCastException: com.neobits.web.NeobitsWebSession
 at com.neobits.web.NeobitsWebSession.get(NeobitsWebSession.java:51)
 at
 com.neobits.web.pages.ViewCartPage$CartDetailsFragment$CheckoutButton.onSubmit(ViewCartPage.java:330)
 --
 View this message in context:
 http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18644053.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18655735.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Session.get covariant override and back button issue?

2008-07-25 Thread Igor Vaynberg
 public static NeobitsWebSession get()
   {
   Class clazz=Session.get();
   System.out.println(clazz.getName());
   return (NeobitsWebSession)Session.get();
   }

what does that print?

-igor

On Fri, Jul 25, 2008 at 10:00 AM, Ritz123 [EMAIL PROTECTED] wrote:

 Igor,

 I have posted the relevant code in the other reply to Tim. If you mean
 actual class being returned from the covariant get() method - I tried
 returning both Session and NeobitsWebSession (my custom websession class).
 But still get the same error.



 igor.vaynberg wrote:

 and so what is the actual class being returned?

 -igor

 On Thu, Jul 24, 2008 at 7:21 PM, Ritz123 [EMAIL PROTECTED] wrote:

 Hi,

 I have a custom Session object which is registered in the custom
 WebApplication class as newSession method override.

 The session object overrides static Session.get() method returning custom
 instance (covariant). The problem is, for some reason when I hit back
 button
 in the browser I get ClassCastException on session  (see below)


 Root cause:

 java.lang.ClassCastException: com.neobits.web.NeobitsWebSession
 at com.neobits.web.NeobitsWebSession.get(NeobitsWebSession.java:51)
 at
 com.neobits.web.pages.ViewCartPage$CartDetailsFragment$CheckoutButton.onSubmit(ViewCartPage.java:330)
 --
 View this message in context:
 http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18644053.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




 --
 View this message in context: 
 http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18655735.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Session.get covariant override and back button issue?

2008-07-25 Thread Ritesh Trivedi

Ok turns out this morning when I restarted the server, it started working.
The things I had changed was the return  type for newSession in
WebApplication to be NeobitsWebSession and return type of the following
covariant method also to be NeobitsWebSession. I suppose thats how it
supposed to be - can someone confirm? also not sure why it was only throwing
exception during back button and not during normal browsing of the site in
forward direction.

I think the reason why this change didnt work yesterday was probably because
of the serialization, for some reason the serialization doesnt seem to
detect the new version of the class a lot of the times and I have to either
delete the session.ser file under tomcat or restart the tomcat server from
scratch to make it see the new classes.



igor.vaynberg wrote:
 
  public static NeobitsWebSession get()
{
Class clazz=Session.get();
System.out.println(clazz.getName());
return (NeobitsWebSession)Session.get();
}
 
 what does that print?
 
 -igor
 
 On Fri, Jul 25, 2008 at 10:00 AM, Ritz123 [EMAIL PROTECTED]
 wrote:

 Igor,

 I have posted the relevant code in the other reply to Tim. If you mean
 actual class being returned from the covariant get() method - I tried
 returning both Session and NeobitsWebSession (my custom websession
 class).
 But still get the same error.



 igor.vaynberg wrote:

 and so what is the actual class being returned?

 -igor

 On Thu, Jul 24, 2008 at 7:21 PM, Ritz123 [EMAIL PROTECTED]
 wrote:

 Hi,

 I have a custom Session object which is registered in the custom
 WebApplication class as newSession method override.

 The session object overrides static Session.get() method returning
 custom
 instance (covariant). The problem is, for some reason when I hit back
 button
 in the browser I get ClassCastException on session  (see below)


 Root cause:

 java.lang.ClassCastException: com.neobits.web.NeobitsWebSession
 at com.neobits.web.NeobitsWebSession.get(NeobitsWebSession.java:51)
 at
 com.neobits.web.pages.ViewCartPage$CartDetailsFragment$CheckoutButton.onSubmit(ViewCartPage.java:330)
 --
 View this message in context:
 http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18644053.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




 --
 View this message in context:
 http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18655735.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18657342.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Session.get covariant override and back button issue?

2008-07-24 Thread Ritz123

Hi,

I have a custom Session object which is registered in the custom
WebApplication class as newSession method override. 

The session object overrides static Session.get() method returning custom
instance (covariant). The problem is, for some reason when I hit back button
in the browser I get ClassCastException on session  (see below)


Root cause:

java.lang.ClassCastException: com.neobits.web.NeobitsWebSession
at com.neobits.web.NeobitsWebSession.get(NeobitsWebSession.java:51)
at
com.neobits.web.pages.ViewCartPage$CartDetailsFragment$CheckoutButton.onSubmit(ViewCartPage.java:330)
-- 
View this message in context: 
http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18644053.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Session.get covariant override and back button issue?

2008-07-24 Thread Igor Vaynberg
and so what is the actual class being returned?

-igor

On Thu, Jul 24, 2008 at 7:21 PM, Ritz123 [EMAIL PROTECTED] wrote:

 Hi,

 I have a custom Session object which is registered in the custom
 WebApplication class as newSession method override.

 The session object overrides static Session.get() method returning custom
 instance (covariant). The problem is, for some reason when I hit back button
 in the browser I get ClassCastException on session  (see below)


 Root cause:

 java.lang.ClassCastException: com.neobits.web.NeobitsWebSession
 at com.neobits.web.NeobitsWebSession.get(NeobitsWebSession.java:51)
 at
 com.neobits.web.pages.ViewCartPage$CartDetailsFragment$CheckoutButton.onSubmit(ViewCartPage.java:330)
 --
 View this message in context: 
 http://www.nabble.com/Session.get-covariant-override-and-back-button-issue--tp18644053p18644053.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]