2

I have a cache of objects (not the HTTP session attributes) and I want to be able to get an object from this cache when a Hessian request comes in and have Hessian execute the call on this object instead of the servlet.

I can control the class that the request is executed on by setting the service-class and api-class init parameters on the HessianServlet. However, it is performing the instantiation of objects itself and it does not look like I can control this.

I've tried to override the execute() method of HessianServlet and calling setService() or setObject() but it does not use the object I've passed in. Instead it seems to instantiate its own.

Sarel Botha
  • 12,419
  • 7
  • 54
  • 59

1 Answers1

3

A simple hack is create a service class that has the same interface on your object, which delegates to an instance of your object it fetches to the pool, expose this service through Hessian.

alex
  • 5,213
  • 1
  • 24
  • 33
  • So every method has to be implemented and the call forwarded to the instance? Pretty ugly, but yes it would work. Thanks. – Sarel Botha Feb 04 '09 at 15:04
  • Well, you could do it with a dynamic Proxy, or maybe with a fancy AspectJ pool as in Spring... – alex Feb 04 '09 at 22:26