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 2017/06/19 19:48:38 UTC
svn commit: r1799268 - in /tomcat/tc8.5.x/trunk/java/org/apache:
catalina/connector/Response.java coyote/Response.java
Author: markt
Date: Mon Jun 19 19:48:37 2017
New Revision: 1799268
URL: http://svn.apache.org/viewvc?rev=1799268&view=rev
Log:
Refactor to reduce the need to deprecate code in 8.5.x
Modified:
tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Response.java
tomcat/tc8.5.x/trunk/java/org/apache/coyote/Response.java
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Response.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Response.java?rev=1799268&r1=1799267&r2=1799268&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Response.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Response.java Mon Jun 19 19:48:37 2017
@@ -557,7 +557,7 @@ public class Response implements HttpSer
*/
@Override
public String getCharacterEncoding() {
- String charset = getCoyoteResponse().getCharsetName();
+ String charset = getCoyoteResponse().getCharacterEncoding();
if (charset != null) {
return charset;
}
Modified: tomcat/tc8.5.x/trunk/java/org/apache/coyote/Response.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/coyote/Response.java?rev=1799268&r1=1799267&r2=1799268&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/coyote/Response.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/coyote/Response.java Mon Jun 19 19:48:37 2017
@@ -112,7 +112,7 @@ public final class Response {
// Retain the original name used to set the charset so exactly that name is
// used in the ContentType header. Some (arguably non-specification
// compliant) user agents are very particular
- String charsetName = null;
+ String characterEncoding = null;
long contentLength = -1;
private Locale locale = DEFAULT_LOCALE;
@@ -422,36 +422,29 @@ public final class Response {
* Overrides the character encoding used in the body of the response. This
* method must be called prior to writing output using getWriter().
*
- * @param charsetName The name of character encoding.
+ * @param characterEncoding The name of character encoding.
*
* @throws UnsupportedEncodingException If the specified name is not
* recognised
*/
- public void setCharset(String charsetName) throws UnsupportedEncodingException {
+ public void setCharset(String characterEncoding) throws UnsupportedEncodingException {
if (isCommitted()) {
return;
}
- if (charsetName == null) {
+ if (characterEncoding == null) {
return;
}
- this.charset = B2CConverter.getCharset(charsetName);
- this.charsetName = charsetName;
+ this.charset = B2CConverter.getCharset(characterEncoding);
+ this.characterEncoding = characterEncoding;
}
/**
* @return The name of the current encoding
- *
- * @deprecated This method will be removed in Tomcat 9.0.x
*/
- @Deprecated
public String getCharacterEncoding() {
- Charset charset = getCharset();
- if (charset == null) {
- return null;
- }
- return charset.name();
+ return characterEncoding;
}
@@ -460,11 +453,6 @@ public final class Response {
}
- public String getCharsetName() {
- return charsetName;
- }
-
-
/**
* Sets the content type.
*
@@ -520,7 +508,7 @@ public final class Response {
if (ret != null
&& charset != null) {
- ret = ret + ";charset=" + charsetName;
+ ret = ret + ";charset=" + characterEncoding;
}
return ret;
@@ -582,7 +570,7 @@ public final class Response {
contentLanguage = null;
locale = DEFAULT_LOCALE;
charset = null;
- charsetName = null;
+ characterEncoding = null;
contentLength = -1;
status = 200;
message = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org