1 17 package org.apache.geronimo.kernel; 18 19 import java.io.IOException ; 20 import java.io.InputStream ; 21 import java.io.ObjectInputStream ; 22 import java.io.ObjectStreamClass ; 23 import java.lang.reflect.Proxy ; 24 25 28 public class ObjectInputStreamExt extends ObjectInputStream { 29 30 private ClassLoader classloader; 31 32 public ObjectInputStreamExt(InputStream in, ClassLoader loader) throws IOException { 33 super(in); 34 this.classloader = loader; 35 } 36 37 protected Class resolveClass(ObjectStreamClass classDesc) throws IOException , ClassNotFoundException { 38 return ClassLoading.loadClass(classDesc.getName(), classloader); 39 } 40 41 protected Class resolveProxyClass(String [] interfaces) throws IOException , ClassNotFoundException { 42 Class [] cinterfaces = new Class [interfaces.length]; 43 for (int i = 0; i < interfaces.length; i++) 44 cinterfaces[i] = classloader.loadClass(interfaces[i]); 45 46 try { 47 return Proxy.getProxyClass(classloader, cinterfaces); 48 } catch (IllegalArgumentException e) { 49 throw new ClassNotFoundException (null, e); 50 } 51 } 52 53 ClassLoader getClassloader() { 54 return classloader; 55 } 56 57 } 58 | Popular Tags |