You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2018/03/02 17:01:35 UTC
svn commit: r1825734 -
/tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
Author: markt
Date: Fri Mar 2 17:01:35 2018
New Revision: 1825734
URL: http://svn.apache.org/viewvc?rev=1825734&view=rev
Log:
Add a characterset to the JMX text output
Modified:
tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
Modified: tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java?rev=1825734&r1=1825733&r2=1825734&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java Fri Mar 2 17:01:35 2018
@@ -83,7 +83,7 @@ public class JMXProxyServlet extends Htt
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
- response.setContentType("text/plain");
+ response.setContentType("text/plain;charset=" + Constants.CHARSET);
// Stop older versions of IE thinking they know best. We set text/plain
// in the line above for a reason. IE's behaviour is unwanted at best
// and dangerous at worst.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1825734 -
/tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Mark,
On 3/2/18 2:13 PM, Mark Thomas wrote:
> On 02/03/18 19:01, Christopher Schultz wrote:
>
> <snip/>
>
>> Would it be better to do this instead:
>>
>> response.setContentType("text/plain;charset=" +
>> response.getCharacterEncoding());
>>
>> Even if the encoding is *supposed* to be UTF-8 (like the
>> constant suggests), in case it isn't for whatever reason, we
>> should use the encoding that is actually being used, instead of
>> what we expect to be used.
>
> We should be in full control of the response so it can be any
> encoding we want. Can't it?
Sure, but I think it would be better if everything were
self-consistent. Sure, the code is self-consistent, but it could
diverge in the future. Using setContentType(getCharacterEncoding())
removes the possibility of a future bug.
Also, there are filters and other things that might cause the
character encoding to change to be something unexpected in this part
of the code. Pulling the *actual* character encoding prevents the
response from becoming inconsistent with itself.
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlqfDCMdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFjN9w//YtxZJ6vo7UMyTqMH
4lrQtjmduGVk6DzqrtKN4myRNLx5kdjtjgNprzxEUylT6o4XKtz0EDG+6NB4qzS4
oPEfS12XWzznyWGgkadNeo0azUHkbXhh8G61p/Hv2TktPnJou1mAINp9FFciMA8O
aXCDoF/03JEQRe/VUivmtmzfG8cWV82DR0dpNNabK8Yfm327Zxl9Qb2UJpnaomIq
u3OKJoS48Hk/d3NjN0hJZ7k+GLs7+pWwMQ/youAcGGW8BBgOnJG8HLiZKf851gS5
0J5GNg/osMmNsUmTcCBJ94q4TfAysa2oN/ZFem6RQItGdjUFyoz5JyQVHeYANQ2N
Prw374Z5g+LCJpkcMoJVqBx1qv2MeVy8QYv2fcaOtOd6rSnX8wnfCGIwDDwz/u5i
iXlUpOjHKwYomxmsXS9viBdEGT8fZkh14IVhrfSVL2qLOAepinmawin7Iu1Jstpq
puBDiN+V0B1UJZ5IInB+GOSSSMDfk7Ub1Sa2OEl7y9Z8kqwwQ9CTrJgkMhhW08tE
VpeakcXCf0dJHO8ktHJQfE5SjonEiDE3fYc7gmfYPSoFBBccixKRNZE7nSfsrCqK
+TCKfAtj/GptaGEHphFe1Fbq0plD35xzI6JVB87ZQKx6uVeFFkhO21V+AlMNJjKB
N5V+EJ3ueeT1NvI8TJgHU9a8LAk=
=Wbfk
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1825734 -
/tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
Posted by Mark Thomas <ma...@apache.org>.
On 02/03/18 19:01, Christopher Schultz wrote:
<snip/>
> Would it be better to do this instead:
>
> response.setContentType("text/plain;charset="
> + response.getCharacterEncoding());
>
> Even if the encoding is *supposed* to be UTF-8 (like the constant
> suggests), in case it isn't for whatever reason, we should use the
> encoding that is actually being used, instead of what we expect to be
> used.
We should be in full control of the response so it can be any encoding
we want. Can't it?
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1825734 -
/tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Mark,
On 3/2/18 12:01 PM, markt@apache.org wrote:
> Author: markt Date: Fri Mar 2 17:01:35 2018 New Revision: 1825734
>
> URL: http://svn.apache.org/viewvc?rev=1825734&view=rev Log: Add a
> characterset to the JMX text output
>
> Modified:
> tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
>
> Modified:
> tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
> URL:
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/man
ager/JMXProxyServlet.java?rev=1825734&r1=1825733&r2=1825734&view=diff
>
>
========================================================================
======
> ---
> tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
> (original) +++
> tomcat/trunk/java/org/apache/catalina/manager/JMXProxyServlet.java
> Fri Mar 2 17:01:35 2018 @@ -83,7 +83,7 @@ public class
> JMXProxyServlet extends Htt @Override public void
> doGet(HttpServletRequest request, HttpServletResponse response)
> throws IOException, ServletException { -
> response.setContentType("text/plain"); +
> response.setContentType("text/plain;charset=" +
> Constants.CHARSET);
Would it be better to do this instead:
response.setContentType("text/plain;charset="
+ response.getCharacterEncoding());
Even if the encoding is *supposed* to be UTF-8 (like the constant
suggests), in case it isn't for whatever reason, we should use the
encoding that is actually being used, instead of what we expect to be
used.
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlqZn4kdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFgyKQ//RVH1zS19GHdPTnWq
0E4Q5y4Ifs2So2VIWzbypmgjHeSnfmlMsXM2/dI4SxdD8G3mOqruTF8NsSxbvya6
aS7jlywLeHNXgJ97NwK4ze9/FjJJTQi8khr1B5sVZzTgL9ZAH4JW2P5/l5Oh2ETm
8IRJgR75MKm21VvmOwgakYDr2SQJckyORDbAHdtPT1NtYJ93WhnLTEmBhT7+t46n
b0zaSfYmusk/OPPimJljguXbkw0ydmirlpGXocEk9GFy59AdRmjNTCLSM/jQlzHx
h94M29UxdIbf0/UNF/+sSTUyxrDtc8GHWTLUaCSiS7tFk/2fV8UnmQRNna/ZSZHF
1yiG1PDFQW+UXlx7JkUp7KUSM/bZgW64SI9Zvqu659VJ2xAcG70qk0VytTQA8CHO
QXVTHrWn/6DuZ892JDPxafLeoWBA8DfGhZeVcSzGbXb5wFFRErZ0+OaiVe+OTTTD
l4fyrDlH69x20fvIObt9twte2Da6dUMzA+FxxubEpORuGf9nKdl11EON9ot0B8LL
EYay3E7isdMST2KeQVh0mVNxPW3qpStjxtF4p2Dwwke7h77gJp+1MXirUKrHmvGH
8azRKHdcVOd+8NeWLK34uQwDz30NH/X1SJmlySQ/hnyKN2udQTn7NEREfLk2AYbp
sJL/URUtyE2X+PdaqpEHVwWAUWc=
=4xK/
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org