geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r529850 - /geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
Date Wed, 18 Apr 2007 04:06:30 GMT
Author: gawor
Date: Tue Apr 17 21:06:29 2007
New Revision: 529850

URL: http://svn.apache.org/viewvc?view=rev&rev=529850
Log:
workaround for jetty character encoding problems

Modified:
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java?view=diff&rev=529850&r1=529849&r2=529850
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
Tue Apr 17 21:06:29 2007
@@ -88,11 +88,24 @@
         message.put(Message.PATH_INFO, servletRequest.getPathInfo());
         message.put(Message.QUERY_STRING, servletRequest.getQueryString());
         message.put(Message.CONTENT_TYPE, servletRequest.getContentType());
-        message.put(Message.ENCODING, servletRequest.getCharacterEncoding());
+        message.put(Message.ENCODING, getCharacterEncoding(servletRequest.getCharacterEncoding()));
         
         messageObserver.onMessage(message);
     }
 
+    private static String getCharacterEncoding(String encoding) {
+        if (encoding != null) {
+            encoding = encoding.trim();
+            // work around a bug with Jetty which results in the character
+            // encoding not being trimmed correctly:
+            // http://jira.codehaus.org/browse/JETTY-302
+            if (encoding.endsWith("\"")) {
+                encoding = encoding.substring(0, encoding.length() - 1);
+            }
+        }
+        return encoding;
+    }
+    
     protected void copyRequestHeaders(Message message, Map<String, List<String>>
headers) {
         HttpServletRequest servletRequest = (HttpServletRequest)message.get(MessageContext.SERVLET_REQUEST);
         if (servletRequest != null) {



Mime
View raw message