1 16 17 package org.springframework.remoting.caucho; 18 19 import java.io.IOException ; 20 import java.io.InputStream ; 21 import java.io.OutputStream ; 22 23 import com.caucho.hessian.io.AbstractHessianOutput; 24 import com.caucho.hessian.io.Hessian2Input; 25 import com.caucho.hessian.io.Hessian2Output; 26 import com.caucho.hessian.io.HessianOutput; 27 import com.caucho.hessian.io.SerializerFactory; 28 import com.caucho.hessian.server.HessianSkeleton; 29 30 37 class Hessian2SkeletonInvoker extends HessianSkeletonInvoker { 38 39 public Hessian2SkeletonInvoker(HessianSkeleton skeleton, SerializerFactory serializerFactory) { 40 super(skeleton, serializerFactory); 41 } 42 43 public void invoke(InputStream inputStream, OutputStream outputStream) throws Throwable { 44 Hessian2Input in = new Hessian2Input(inputStream); 45 if (this.serializerFactory != null) { 46 in.setSerializerFactory(this.serializerFactory); 47 } 48 49 int code = in.read(); 50 if (code != 'c') { 51 throw new IOException ("expected 'c' in hessian input at " + code); 52 } 53 54 AbstractHessianOutput out = null; 55 int major = in.read(); 56 int minor = in.read(); 57 if (major >= 2) { 58 out = new Hessian2Output(outputStream); 59 } 60 else { 61 out = new HessianOutput(outputStream); 62 } 63 if (this.serializerFactory != null) { 64 out.setSerializerFactory(this.serializerFactory); 65 } 66 67 this.skeleton.invoke(in, out); 68 } 69 70 } 71 | Popular Tags |