Author: markt
Date: Mon Mar 20 10:07:29 2017
New Revision: 1787705
URL: http://svn.apache.org/viewvc?rev=1787705&view=rev
Log:
Servlet 4.0 updates for web.xml parsing
request-encoding -> request-character-encoding
response-encoding -> response-character-encoding
Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1787705&r1=1787704&r2=1787705&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Mon Mar 20
10:07:29 2017
@@ -1299,7 +1299,7 @@ public class ContextConfig implements Li
webxml.getMimeMappings().entrySet()) {
context.addMimeMapping(entry.getKey(), entry.getValue());
}
- context.setRequestCharacterEncoding(webxml.getRequestEncoding());
+
context.setRequestCharacterEncoding(webxml.getRequestCharacterEncoding());
// Name is just used for ordering
for (ContextResourceEnvRef resource :
webxml.getResourceEnvRefs().values()) {
@@ -1308,7 +1308,7 @@ public class ContextConfig implements Li
for (ContextResource resource : webxml.getResourceRefs().values()) {
context.getNamingResources().addResource(resource);
}
- context.setResponseCharacterEncoding(webxml.getResponseEncoding());
+
context.setResponseCharacterEncoding(webxml.getResponseCharacterEncoding());
boolean allAuthenticatedUsersIsAppRole =
webxml.getSecurityRoles().contains(
SecurityConstraint.ROLE_ALL_AUTHENTICATED_USERS);
Modified:
tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java?rev=1787705&r1=1787704&r2=1787705&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebRuleSet.java Mon
Mar 20 10:07:29 2017
@@ -195,9 +195,11 @@ public class WebRuleSet extends RuleSetB
digester.addCallMethod(fullPrefix + "/absolute-ordering/others",
"addAbsoluteOrderingOthers");
digester.addRule(fullPrefix + "/deny-uncovered-http-methods",
- new SetDenyUncoveredHttpMethodsRule());
- digester.addCallMethod(fullPrefix + "/request-encoding",
"setRequestEncoding", 0);
- digester.addCallMethod(fullPrefix + "/response-encoding",
"setResponseEncoding", 0);
+ new SetDenyUncoveredHttpMethodsRule());
+ digester.addCallMethod(fullPrefix + "/request-character-encoding",
+ "setRequestCharacterEncoding", 0);
+ digester.addCallMethod(fullPrefix + "/response-character-encoding",
+ "setResponseCharacterEncoding", 0);
}
digester.addCallMethod(fullPrefix + "/context-param",
Modified: tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java?rev=1787705&r1=1787704&r2=1787705&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/WebXml.java Mon Mar
20 10:07:29 2017
@@ -610,34 +610,34 @@ public class WebXml extends XmlEncodingB
return new JspConfigDescriptorImpl(descriptors, tlds);
}
- private String requestEncoding;
- public String getRequestEncoding() {
- return requestEncoding;
+ private String requestCharacterEncoding;
+ public String getRequestCharacterEncoding() {
+ return requestCharacterEncoding;
}
- public void setRequestEncoding(String requestEncoding) {
- if (requestEncoding != null) {
+ public void setRequestCharacterEncoding(String requestCharacterEncoding) {
+ if (requestCharacterEncoding != null) {
try {
- B2CConverter.getCharset(requestEncoding);
+ B2CConverter.getCharset(requestCharacterEncoding);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e);
}
}
- this.requestEncoding = requestEncoding;
+ this.requestCharacterEncoding = requestCharacterEncoding;
}
- private String responseEncoding;
- public String getResponseEncoding() {
- return responseEncoding;
+ private String responseCharacterEncoding;
+ public String getResponseCharacterEncoding() {
+ return responseCharacterEncoding;
}
- public void setResponseEncoding(String responseEncoding) {
- if (responseEncoding != null) {
+ public void setResponseCharacterEncoding(String responseCharacterEncoding)
{
+ if (responseCharacterEncoding != null) {
try {
- B2CConverter.getCharset(responseEncoding);
+ B2CConverter.getCharset(responseCharacterEncoding);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e);
}
}
- this.responseEncoding = responseEncoding;
+ this.responseCharacterEncoding = responseCharacterEncoding;
}
// Attributes not defined in web.xml or web-fragment.xml
@@ -1353,8 +1353,8 @@ public class WebXml extends XmlEncodingB
// request-encoding and response-encoding was introduced in Servlet 4.0
if (getMajorVersion() >= 4) {
- appendElement(sb, INDENT2, "request-encoding", requestEncoding);
- appendElement(sb, INDENT2, "response-encoding", responseEncoding);
+ appendElement(sb, INDENT2, "request-character-encoding",
requestCharacterEncoding);
+ appendElement(sb, INDENT2, "response-character-encoding",
responseCharacterEncoding);
}
sb.append("</web-app>");
return sb.toString();
@@ -1478,17 +1478,17 @@ public class WebXml extends XmlEncodingB
}
}
}
- if (requestEncoding == null) {
+ if (requestCharacterEncoding == null) {
for (WebXml fragment : fragments) {
- if (fragment.getRequestEncoding() != null) {
- requestEncoding = fragment.getRequestEncoding();
+ if (fragment.getRequestCharacterEncoding() != null) {
+ requestCharacterEncoding =
fragment.getRequestCharacterEncoding();
}
}
}
- if (responseEncoding == null) {
+ if (responseCharacterEncoding == null) {
for (WebXml fragment : fragments) {
- if (fragment.getResponseEncoding() != null) {
- responseEncoding = fragment.getResponseEncoding();
+ if (fragment.getResponseCharacterEncoding() != null) {
+ responseCharacterEncoding =
fragment.getResponseCharacterEncoding();
}
}
}
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1787705&r1=1787704&r2=1787705&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Mar 20 10:07:29 2017
@@ -76,9 +76,14 @@
9.0.0.M18 for the Servlet 4.0 API changes. (markt)
</fix>
<update>
- Align <code>PushBuilder</code> API with changes from Servlet expert
+ Align <code>PushBuilder</code> API with changes from the Servlet expert
group. (markt)
</update>
+ <update>
+ Align web.xml parsing rules with changes from the Servlet expert group
+ for <code><request-character-encoding></code> and
+ <code><response-character-encoding></code>. (markt)
+ </update>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]