[jboss-remoting-commits] JBoss Remoting SVN: r5191 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Sun May 10 02:51:10 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-05-10 02:51:10 -0400 (Sun, 10 May 2009)
New Revision: 5191

Modified:
   remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
Log:
JBREM-1079: (1) Implements line preservation feature; (2) puts metadata in request parameter map; (3) allows client to determine content type.

Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java	2009-05-10 06:49:22 UTC (rev 5190)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java	2009-05-10 06:51:10 UTC (rev 5191)
@@ -175,6 +175,21 @@
             log.trace("  " + key + ": " + metadata.get(key));
          }
       }
+      
+      // UnMarshaller may not be an HTTPUnMarshaller, in which case it
+      // can ignore this parameter.
+      Object o = configuration.get(HTTPUnMarshaller.PRESERVE_LINES);
+      if (o != null)
+      {
+         if (o instanceof String[])
+         {
+            metadata.put(HTTPUnMarshaller.PRESERVE_LINES, ((String[]) o)[0]);
+         }
+         else
+         {
+            metadata.put(HTTPUnMarshaller.PRESERVE_LINES, o);
+         }
+      }
 
       String requestContentType = request.getContentType();
 
@@ -293,6 +308,24 @@
       }
 
       metadata.put(HTTPMetadataConstants.METHODTYPE, request.getMethod());
+      
+      // UnMarshaller may not be an HTTPUnMarshaller, in which case it
+      // can ignore this parameter.
+      log.info("configuration: " + configuration);
+      Object o = configuration.get(HTTPUnMarshaller.PRESERVE_LINES);
+      log.info("preserveLines: " + o);
+      if (o != null)
+      {
+         if (o instanceof String[])
+         {
+            metadata.put(HTTPUnMarshaller.PRESERVE_LINES, ((String[]) o)[0]);
+         }
+         else
+         {
+            metadata.put(HTTPUnMarshaller.PRESERVE_LINES, o);
+         }
+      }
+      
       String path = request.getPathTranslated();
       if (path != null)
          metadata.put(HTTPMetadataConstants.PATH, path);
@@ -325,6 +358,16 @@
             if(obj instanceof InvocationRequest)
             {
                invocationRequest = (InvocationRequest) obj;
+
+               Map requestMap = invocationRequest.getRequestPayload();
+               if (requestMap == null)
+               {
+                  invocationRequest.setRequestPayload(metadata);
+               }
+               else
+               {
+                  requestMap.putAll(metadata);
+               }
             }
             else
             {
@@ -411,7 +454,15 @@
 
          if(responseObject != null)
          {
-            String responseContentType = responseObject == null ? requestContentType : WebUtil.getContentType(responseObject);
+            String responseContentType = null;
+            if (responseMap != null)
+            {
+               responseContentType = (String) responseMap.get("Content-Type");
+            }
+            if(responseContentType == null)
+            {
+               responseContentType = responseObject == null ? requestContentType : WebUtil.getContentType(responseObject);
+            }
             response.setContentType(responseContentType);
             ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
             Marshaller marshaller = getMarshaller();




More information about the jboss-remoting-commits mailing list