You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/02/21 15:23:15 UTC

svn commit: r629795 - /incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/SlingHttpServletResponseImpl.java

Author: fmeschbe
Date: Thu Feb 21 06:23:11 2008
New Revision: 629795

URL: http://svn.apache.org/viewvc?rev=629795&view=rev
Log:
SLING-263 content encoding setting not implemented correctly, partly overwriting
Servlet API 2.4 methods. This is not needed anymore (dates back to when Sling
only required Servlet API 2.3) so I removed the set/getCharacterEncoding and
set/getContentType methods in the SlingHttpServletRequestImpl class.

Modified:
    incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/SlingHttpServletResponseImpl.java

Modified: incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/SlingHttpServletResponseImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/SlingHttpServletResponseImpl.java?rev=629795&r1=629794&r2=629795&view=diff
==============================================================================
--- incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/SlingHttpServletResponseImpl.java (original)
+++ incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/SlingHttpServletResponseImpl.java Thu Feb 21 06:23:11 2008
@@ -39,9 +39,6 @@
 
     private final RequestData requestData;
 
-    private String contentType = "text/html";
-    private String characterEncoding = null;
-
     public SlingHttpServletResponseImpl(RequestData requestData,
             HttpServletResponse response) {
         super(response);
@@ -63,22 +60,6 @@
     }
 
     @Override
-    public String getCharacterEncoding() {
-        return characterEncoding;
-    }
-
-    @Override
-    public String getContentType() {
-        // plaing content type if there is no character encoding
-        if (characterEncoding == null) {
-            return contentType;
-        }
-
-        // otherwise append the charset
-        return contentType + ";charset=" + characterEncoding;
-    }
-
-    @Override
     public Locale getLocale() {
         // TODO Should use our Locale Resolver and not let the component set the locale, right ??
         return getResponse().getLocale();
@@ -114,40 +95,6 @@
     @Override
     public void setBufferSize(int size) {
         getRequestData().getContentData().setBufferSize(size);
-    }
-
-    @Override
-    public void setCharacterEncoding(String charset) {
-        // should actually check for charset validity ??
-        characterEncoding = charset;
-    }
-
-    @Override
-    public void setContentType(String type) {
-        // ignore empty values
-        if (type == null || type.length() == 0) {
-            return;
-        }
-
-        if (type.indexOf(';') > 0) {
-            Map<String, Map<String, String>> parsedType = RequestUtil.parserHeader(type);
-            if (parsedType.size() == 1) {
-                // expected single entry of token being content type and
-                // a single parameter charset, otherwise just ignore and
-                // use type as is...
-                Map.Entry<String, Map<String, String>> entry = parsedType.entrySet().iterator().next();
-                type = entry.getKey();
-                String charset = entry.getValue().get("charset");
-                if (charset != null && charset.length() > 0) {
-                    setCharacterEncoding(charset);
-                }
-            }
-        }
-
-        contentType = type;
-
-        // set the content type with charset on the underlying response
-        super.setContentType(getContentType());
     }
 
     // ---------- Redirection support through PathResolver --------------------