Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Scott Ferguson
On 04/24/2011 05:14 PM, Edvin Syse wrote: Hi, I see that the JavaSessionDeserializer has a constructor that takes a ClassLoader: http://caucho.com/resin-4.0-javadoc/com/caucho/server/session/JavaSessionDeserializer.html .. but I can't figure out how to configure this in resin.xml. It

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Edvin Syse
My application is a CMS where each user can compile and run Groovy classes as controllers for pages. These Groovy classes are compiled, and it is fully legal to put part of a such a class in a session variable (they are Serializable). The controller is executed using a special classloader and

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Scott Ferguson
On 04/25/2011 10:07 AM, Edvin Syse wrote: My application is a CMS where each user can compile and run Groovy classes as controllers for pages. These Groovy classes are compiled, and it is fully legal to put part of a such a class in a session variable (they are Serializable). The controller is

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Edvin Syse
Hmm. When you call request.getSession(), have you already set the Thread.setContextClassLoader? It might be cleaner for us to add a use-context-class-loader as a session-config configuration. -- Scotthttp://maillist.caucho.com/mailman/listinfo/resin-interest Basically, I construct a

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Edvin Syse
Maybe a better route is to configure my own serializer/deserializer? If I use a custom ObjectInputStream that overrides the loadClass() method s/loadClass/resolveClass/ :) -- Edvin ___ resin-interest mailing list resin-interest@caucho.com

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Scott Ferguson
On 04/25/2011 10:44 AM, Edvin Syse wrote: Hmm. When you call request.getSession(), have you already set the Thread.setContextClassLoader? It might be cleaner for us to add a use-context-class-loader as a session-config configuration. --

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Edvin Syse
The typical pattern for a custom classloader would also use: Thread thread = Thread.currentThread(); ClassLoader oldLoader = thread.getContextClassLoader(); try { thread.setContextClassLoader(myClassLoader); pageController.execute(); } finally {

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Scott Ferguson
On 04/25/2011 12:11 PM, Edvin Syse wrote: But it might be cleaner to use the ContextClassLoader pattern with a session-config so you don't actually need to write a custom serializer. This will actually not work properly, since ObjectInputStream.readObject does not honor the thread's

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Edvin Syse
On 04/25/2011 12:11 PM, Edvin Syse wrote: But it might be cleaner to use the ContextClassLoader pattern with a session-config so you don't actually need to write a custom serializer. This will actually not work properly, since ObjectInputStream.readObject does not honor the thread's

Re: [Resin-interest] How to configure the JavaSessionDeserializer to accept a custom classloader?

2011-04-25 Thread Edvin Syse
But that's the point of adding session-config use-context-class-loader='true'/ to Resin. I can have Resin use the context classloader when it's deserializing. Resin already needs to deal with this issue to use the web-app's classloader. It's an easy change to allow the context classloader