[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Custom ObjectInputStream / ObjectOutputStream  XML
Forum Index -> Terracotta for Web Sessions
Author Message
dhmayo

neo

Joined: 08/12/2012 18:03:11
Messages: 4
Offline

I'm experimenting with using TC for Web Sessions on Tomcat 6. I would like to use custom ObjectOutputStream/ObjectInputStream implementations, which override ReplaceObject/ResolveObject in order to do some object substitutions.

Is there a way to instruct Terracotta to use my custom classes instead of the standard ones when performing session serialization/deserialization? If possible, I would expect this to be specified via declarative TerracottaTomcat60xSessionValve settings in context.xml. Unfortunately, I can't seem to find any documentation to this effect, including API doc on that valve class.

Does anyone know if this is possible? I sure hope so.

Thanks!
teck

seraphim
[Avatar]
Joined: 05/24/2006 15:03:25
Messages: 1128
Offline

Unfortunately there really is no mechanism to plugin your input/output stream classes there as you desire.

We actually use custom classes for doing serialization as well to optimize how class descriptors are stored.

I'll admit I don't have much experience with those resolve/replace methods, but I thought there was a way to get a similar affect with magic method in the types you're serializing (much like readObject()) ?

The only other thing I can think that you could do would be to do the serialization/deserialization yourself and then store resulting byte[] in the session.

Tim Eck (terracotta engineer)
dhmayo

neo

Joined: 08/12/2012 18:03:11
Messages: 4
Offline

It looks like I can accomplish what I need by having certain of my classes implement the magic writeReplace() and readResolve() methods. Can you please confirm that your custom serialization classes will indeed invoke those methods?

Thanks!
teck

seraphim
[Avatar]
Joined: 05/24/2006 15:03:25
Messages: 1128
Offline

Well I guess I wouldn't want to say for certain that those standard methods work with our serialization without trying it first, but I have no reason to suspect they would not. We just subclass ObjectOutputStream and ObjectInputStream and don't touch the paths where those methods would be invoked.


Tim Eck (terracotta engineer)
 
Forum Index -> Terracotta for Web Sessions
Go to:   
Powered by JForum 2.1.7 © JForum Team