wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r945339 - /incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/StringProvider.java
Date Mon, 17 May 2010 20:15:25 GMT
Author: bluk
Date: Mon May 17 20:15:25 2010
New Revision: 945339

URL: http://svn.apache.org/viewvc?rev=945339&view=rev
Log:
Return -1 for the StringProvider size.

This will now not fill in the Content-Length
in the response headers.

Thanks to Shay Tsadok for reporting the issue.

See [WINK-282].

Modified:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/StringProvider.java

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/StringProvider.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/StringProvider.java?rev=945339&r1=945338&r2=945339&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/StringProvider.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/StringProvider.java
Mon May 17 20:15:25 2010
@@ -39,20 +39,14 @@ import javax.ws.rs.ext.MessageBodyReader
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-import org.apache.wink.common.RuntimeContext;
-import org.apache.wink.common.internal.runtime.RuntimeContextTLS;
 import org.apache.wink.common.internal.utils.MediaTypeUtils;
 import org.apache.wink.common.utils.ProviderUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @Provider
 @Consumes
 @Produces
 public class StringProvider implements MessageBodyReader<String>, MessageBodyWriter<String>
{
 
-    private static final Logger logger = LoggerFactory.getLogger(StringProvider.class);
-
     public boolean isReadable(Class<?> type,
                               Type genericType,
                               Annotation[] annotations,
@@ -75,24 +69,7 @@ public class StringProvider implements M
                         Type genericType,
                         Annotation[] annotations,
                         MediaType mediaType) {
-        RuntimeContext context = RuntimeContextTLS.getRuntimeContext();
-        HttpHeaders requestHeaders = null;
-        if (context != null) {
-            requestHeaders = context.getHttpHeaders();
-        }
-        String charSet = ProviderUtils.getCharset(mediaType, requestHeaders);
-        if (charSet == null) {
-            return -1;
-        }
-        if (!"UTF-8".equals(charSet)) { //$NON-NLS-1$
-            try {
-                return t.getBytes(charSet).length;
-            } catch (UnsupportedEncodingException e) {
-                logger.debug("Unsupported character encoding exception: {}", e); //$NON-NLS-1$
-                throw new WebApplicationException(e, 500);
-            }
-        }
-        return t.length();
+        return -1;
     }
 
     public boolean isWriteable(Class<?> type,



Mime
View raw message