You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Tobias Bocanegra (JIRA)" <ji...@apache.org> on 2008/02/20 23:07:43 UTC

[jira] Created: (SLING-263) json render servlet does not set charset of content type

json render servlet does not set charset of content type
--------------------------------------------------------

                 Key: SLING-263
                 URL: https://issues.apache.org/jira/browse/SLING-263
             Project: Sling
          Issue Type: Bug
          Components: Launchpad
            Reporter: Tobias Bocanegra


the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.

Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
===================================================================
--- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
+++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
@@ -94,7 +94,7 @@
 
         getServlets = new HashMap<String, Servlet>();
         getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
-        getServlets.put("json", new JsonRendererServlet("application/json"));
+        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
         getServlets.put("txt", defaultGetServlet);
         getServlets.put("res", streamServlet);
     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-263) json render servlet does not set charset of content type

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571051#action_12571051 ] 

Felix Meschberger commented on SLING-263:
-----------------------------------------

Fixed erroneous character encoding setting on the response in the SlingHttpServletResponseImpl class in Rev. 629795

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-263) json render servlet does not set charset of content type

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571012#action_12571012 ] 

Carsten Ziegeler commented on SLING-263:
----------------------------------------

Wouldn't the same apply for the mime type as well? I think its rather the servlet who decides the mime type (as well as the encoding) as some external code.

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SLING-263) json render servlet does not set charset of content type

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-263:
---------------------------------------

    Assignee: Felix Meschberger

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SLING-263) json render servlet does not set charset of content type

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-263.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

Fixed character encoding setting in Rev. 629808 and deployed new snapshot.

Please close this issue if this fixes your problem.

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (SLING-263) json render servlet does not set charset of content type

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tobias Bocanegra reopened SLING-263:
------------------------------------


does not work correctly. the response content type still does not include the charset.
this time it's the problem of SlingHttpServletResponseImpl not calling the super method in
setCharacterEncoding().  see [1]

btw: i don't see why the content type handling is explicitly done in the sling response impl once more. this should be handled by the servlet container.

[1] http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletResponse.html#setCharacterEncoding(java.lang.String)

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-263) json render servlet does not set charset of content type

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570968#action_12570968 ] 

Felix Meschberger commented on SLING-263:
-----------------------------------------

Thanks for reporting. Actually, I would not do it like this but rather have the servlets set the encoding themselves.

Will do that.

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-263) json render servlet does not set charset of content type

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571083#action_12571083 ] 

Felix Meschberger commented on SLING-263:
-----------------------------------------

As you can see in above comment, I fixed this in Rev. 629795 in sling/core while fixing this issue.

Can you please verify with an up to date core bundle ? Thanks.

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-263) json render servlet does not set charset of content type

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571015#action_12571015 ] 

Bertrand Delacretaz commented on SLING-263:
-------------------------------------------

You're right Carsten, that "select servlet by content-type" business is old remains from microsling where we used the expected Content-Type of the response to select renderers.

Moving to extension-based selection, and letting the servlets set the Content-Type including encoding, makes sense.

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-263) json render servlet does not set charset of content type

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571024#action_12571024 ] 

Felix Meschberger commented on SLING-263:
-----------------------------------------

Yes, I agree with you both and this will be part of migrating these renderer servlets into a new location and bundle and separating the ujax POST servlet into its own servlet.

In the meantime I fix this issue by adding a response.setCharacterEncoding() to all servlets (instead of extending the content type as proposed by the initial description).

Currently I am trying to test this, but there are issues with transferrring non-ASCII7 characters from the integration tests to Sling, which I am analyzing at the moment.

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (SLING-263) json render servlet does not set charset of content type

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tobias Bocanegra closed SLING-263.
----------------------------------

    Resolution: Fixed

oh, ok. i have missed that. 

now it works. thanks.

> json render servlet does not set charset of content type
> --------------------------------------------------------
>
>                 Key: SLING-263
>                 URL: https://issues.apache.org/jira/browse/SLING-263
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>
> the launchpad JsonRenderServlet uses incomplete response content type not specifying the charset.
> Index: launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
> ===================================================================
> --- launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (revision 629192)
> +++ launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java (working copy)
> @@ -94,7 +94,7 @@
>  
>          getServlets = new HashMap<String, Servlet>();
>          getServlets.put("html", new DefaultHtmlRendererServlet("text/html"));
> -        getServlets.put("json", new JsonRendererServlet("application/json"));
> +        getServlets.put("json", new JsonRendererServlet("application/json; charset=utf-8"));
>          getServlets.put("txt", defaultGetServlet);
>          getServlets.put("res", streamServlet);
>      }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.