From eabad33aa287fb0a45f7bc88ce32e636307ab094 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 31 Mar 2009 14:36:46 +0000 Subject: [PATCH] Hessian service exporter sets content type "application/x-hessian" (SPR-5621) --- .../org/springframework/remoting/caucho/HessianExporter.java | 3 +++ .../remoting/caucho/HessianServiceExporter.java | 1 + .../remoting/caucho/SimpleHessianServiceExporter.java | 1 + 3 files changed, 5 insertions(+) diff --git a/org.springframework.web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java b/org.springframework.web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java index 51b7c334d5..d198a10be0 100644 --- a/org.springframework.web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java +++ b/org.springframework.web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java @@ -54,6 +54,9 @@ import org.springframework.util.CommonsLogWriter; */ public class HessianExporter extends RemoteExporter implements InitializingBean { + public static final String CONTENT_TYPE_HESSIAN = "application/x-hessian"; + + private SerializerFactory serializerFactory = new SerializerFactory(); private Log debugLogger; 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 75d5ec032c..f47c773616 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 @@ -61,6 +61,7 @@ public class HessianServiceExporter extends HessianExporter implements HttpReque new String[] {"POST"}, "HessianServiceExporter only supports POST requests"); } + response.setContentType(CONTENT_TYPE_HESSIAN); try { invoke(request.getInputStream(), response.getOutputStream()); } 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 3bba58fd38..39e0aa0bb1 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 @@ -66,6 +66,7 @@ public class SimpleHessianServiceExporter extends HessianExporter implements Htt throw new IOException("Hessian skeleton invocation failed", ex); } + exchange.getResponseHeaders().set("Content-Type", CONTENT_TYPE_HESSIAN); exchange.sendResponseHeaders(200, output.size()); FileCopyUtils.copy(output.toByteArray(), exchange.getResponseBody()); }