From 07fba932ac1bf8ff0b523d85e8f9f2e6a1c322cc Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 27 Mar 2009 00:00:31 +0000 Subject: [PATCH] updated to Hessian 3.2.1 (remaining compatible with Hessian 3.1.3 and above) --- org.springframework.web/ivy.xml | 2 +- .../remoting/caucho/HessianExporter.java | 65 ++- .../caucho/HessianServiceExporter.java | 5 +- .../caucho/SimpleHessianServiceExporter.java | 4 +- org.springframework.web/web.iml | 488 +++++++++--------- 5 files changed, 281 insertions(+), 283 deletions(-) diff --git a/org.springframework.web/ivy.xml b/org.springframework.web/ivy.xml index c46f7fb88e..1263b0dd3d 100644 --- a/org.springframework.web/ivy.xml +++ b/org.springframework.web/ivy.xml @@ -29,7 +29,7 @@ - Hessian is a slim, binary RPC protocol. * For information on Hessian, see the * Hessian website. - * This exporter requires Hessian 3.0.20 or above. + * This exporter requires Hessian 3.1.3 or above. * * @author Juergen Hoeller * @since 2.5.1 @@ -53,9 +54,6 @@ import org.springframework.util.CommonsLogWriter; */ public class HessianExporter extends RemoteExporter implements InitializingBean { - private static final boolean debugOutputStreamAvailable = ClassUtils.isPresent( - "com.caucho.hessian.io.HessianDebugOutputStream", HessianExporter.class.getClassLoader()); - private SerializerFactory serializerFactory = new SerializerFactory(); private Log debugLogger; @@ -129,31 +127,43 @@ public class HessianExporter extends RemoteExporter implements InitializingBean if (this.debugLogger != null && this.debugLogger.isDebugEnabled()) { PrintWriter debugWriter = new PrintWriter(new CommonsLogWriter(this.debugLogger)); isToUse = new HessianDebugInputStream(inputStream, debugWriter); - if (debugOutputStreamAvailable) { - osToUse = DebugStreamFactory.createDebugOutputStream(outputStream, debugWriter); - } + osToUse = new HessianDebugOutputStream(outputStream, debugWriter); } - Hessian2Input in = new Hessian2Input(isToUse); - if (this.serializerFactory != null) { - in.setSerializerFactory(this.serializerFactory); - } + int code = isToUse.read(); + int major; + int minor; - int code = in.read(); - if (code != 'c') { - throw new IOException("expected 'c' in hessian input at " + code); - } + AbstractHessianInput in; + AbstractHessianOutput out; - AbstractHessianOutput out = null; - int major = in.read(); - int minor = in.read(); - if (major >= 2) { + if (code == 'H') { + major = isToUse.read(); + minor = isToUse.read(); + if (major != 0x02) { + throw new IOException("Version " + major + "." + minor + " is not understood"); + } + in = new Hessian2Input(isToUse); out = new Hessian2Output(osToUse); + in.readCall(); + } + else if (code == 'c') { + major = isToUse.read(); + minor = isToUse.read(); + in = new HessianInput(isToUse); + if (major >= 2) { + out = new Hessian2Output(osToUse); + } + else { + out = new HessianOutput(osToUse); + } } else { - out = new HessianOutput(osToUse); + throw new IOException("Expected 'H' (Hessian 2.0) or 'c' (Hessian 1.0) in hessian input at " + code); } + if (this.serializerFactory != null) { + in.setSerializerFactory(this.serializerFactory); out.setSerializerFactory(this.serializerFactory); } @@ -178,15 +188,4 @@ public class HessianExporter extends RemoteExporter implements InitializingBean } } - - /** - * Inner class to avoid hard dependency on Hessian 3.1.3's HessianDebugOutputStream. - */ - private static class DebugStreamFactory { - - public static OutputStream createDebugOutputStream(OutputStream os, PrintWriter debug) { - return new HessianDebugOutputStream(os, debug); - } - } - } diff --git a/org.springframework.web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java b/org.springframework.web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java index b55c3a03c5..75d5ec032c 100644 --- a/org.springframework.web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java +++ b/org.springframework.web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.springframework.remoting.caucho; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -36,7 +35,7 @@ import org.springframework.web.util.NestedServletException; *

Hessian is a slim, binary RPC protocol. * For information on Hessian, see the * Hessian website. - * This exporter requires Hessian 3.0.20 or above. + * This exporter requires Hessian 3.1.3 or above. * *

Note: Hessian services exported with this class can be accessed by * any Hessian client, as there isn't any special handling involved. diff --git a/org.springframework.web/src/main/java/org/springframework/remoting/caucho/SimpleHessianServiceExporter.java b/org.springframework.web/src/main/java/org/springframework/remoting/caucho/SimpleHessianServiceExporter.java index a9dfb8d772..3bba58fd38 100644 --- a/org.springframework.web/src/main/java/org/springframework/remoting/caucho/SimpleHessianServiceExporter.java +++ b/org.springframework.web/src/main/java/org/springframework/remoting/caucho/SimpleHessianServiceExporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import org.springframework.util.FileCopyUtils; *

Hessian is a slim, binary RPC protocol. * For information on Hessian, see the * Hessian website. - * This exporter requires Hessian 3.0.20 or above. + * This exporter requires Hessian 3.1.3 or above. * *

Note: Hessian services exported with this class can be accessed by * any Hessian client, as there isn't any special handling involved. diff --git a/org.springframework.web/web.iml b/org.springframework.web/web.iml index 5b7e806452..981138940e 100644 --- a/org.springframework.web/web.iml +++ b/org.springframework.web/web.iml @@ -1,244 +1,244 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- GitLab