Class ClassloaderSwitcherInterceptor
- java.lang.Object
-
- org.pentaho.platform.plugin.services.security.userrole.ClassloaderSwitcherInterceptor
-
- All Implemented Interfaces:
org.aopalliance.aop.Advice
,org.aopalliance.intercept.Interceptor
,org.aopalliance.intercept.MethodInterceptor
public class ClassloaderSwitcherInterceptor extends Object implements org.aopalliance.intercept.MethodInterceptor
This interceptor changes the thread context classloader to the class' current classloader.
We need this because of the
ConversionServiceConverterManager
which was introduced in spring-security-2.0.0.This manager uses
ClassUtils.getDefaultClassLoader()
which creates new class instance using thread context classloader which differs from the current classloader of the caller class:- thread context classloader is the
org.apache.activemq.activemq-osgi
- current classloader is the spring's
WebappClassLoader
ConversionServiceConverterManager
tries to castclazz.newInstance()
to theGenericConversionService
it throwsClassCastException
if the context classloader hadn't changed.That's why we need to proxy all classes which might use the
ConversionServiceConverterManager
.- Author:
- Andrei Abramov
-
-
Constructor Summary
Constructors Constructor Description ClassloaderSwitcherInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
invoke(org.aopalliance.intercept.MethodInvocation invocation)
-