From 810d222f1461abfea830f7f0cc0d19320dc30546 Mon Sep 17 00:00:00 2001
From: schultz
Date: Thu, 9 Dec 2010 14:35:28 +0000
Subject: [PATCH] - Fixed brace and paren placement - Changed
Connector.isParseBodyMethod from public -> protected - Relaxed language
claiming that use of parseBodyMethods may "violate" the servlet spec - Moved
error message to LocalStrings.properties (Translations requested)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1043983 13f79535-47bb-0310-9956-ffa450edef68
---
java/org/apache/catalina/connector/Connector.java | 29 ++++++++++++----------
.../catalina/connector/LocalStrings.properties | 1 +
java/org/apache/catalina/connector/Request.java | 2 +-
webapps/docs/config/ajp.xml | 3 ++-
webapps/docs/config/http.xml | 3 ++-
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java
index 609bbc8ad..4b8185bc3 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -188,7 +188,7 @@ public class Connector extends LifecycleMBeanBase {
protected String parseBodyMethods = "POST";
- protected HashSet parseBodyMethodsSet;
+ protected HashSet parseBodyMethodsSet;
/**
@@ -455,28 +455,31 @@ public class Connector extends LifecycleMBeanBase {
}
- public String getParseBodyMethods()
- {
- return (this.parseBodyMethods);
+ public String getParseBodyMethods() {
+
+ return this.parseBodyMethods;
+
}
- public void setParseBodyMethods(String methods)
- {
- HashSet methodSet = new HashSet();
+ public void setParseBodyMethods(String methods) {
+
+ HashSet methodSet = new HashSet();
- if(null != methods)
+ if( null != methods )
methodSet.addAll(Arrays.asList(methods.split("\\s*,\\s*")));
- if(methodSet.contains("TRACE"))
- throw new IllegalArgumentException("TRACE method MUST NOT include an entity (see RFC 2616 Section 9.6)");
+ if( methodSet.contains("TRACE") )
+ throw new IllegalArgumentException(sm.getString("coyoteConnector.parseBodyMethodNoTrace"));
this.parseBodyMethods = methods;
this.parseBodyMethodsSet = methodSet;
+
}
- public boolean isParseBodyMethod(String method)
- {
+ protected boolean isParseBodyMethod(String method) {
+
return parseBodyMethodsSet.contains(method);
+
}
/**
@@ -896,7 +899,7 @@ public class Connector extends LifecycleMBeanBase {
protocolHandler.setAdapter(adapter);
// Make sure parseBodyMethodsSet has a default
- if(null == parseBodyMethodsSet)
+ if( null == parseBodyMethodsSet )
setParseBodyMethods(getParseBodyMethods());
try {
diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties
index 70131a393..a237bc4ff 100644
--- a/java/org/apache/catalina/connector/LocalStrings.properties
+++ b/java/org/apache/catalina/connector/LocalStrings.properties
@@ -27,6 +27,7 @@ coyoteConnector.protocolHandlerPauseFailed=Protocol handler pause failed
coyoteConnector.protocolHandlerResumeFailed=Protocol handler resume failed
coyoteConnector.MapperRegistration=register Mapper: {0}
coyoteConnector.protocolUnregistrationFailed=Protocol handler stop failed
+coyoteConnector.parseBodyMethodNoTrace=TRACE method MUST NOT include an entity (see RFC 2616 Section 9.6)
#
# CoyoteAdapter
diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java
index 60936bee6..c2ef8dc99 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -2798,7 +2798,7 @@ public class Request
if (usingInputStream || usingReader)
return;
- if(!getConnector().isParseBodyMethod(getMethod()))
+ if( !getConnector().isParseBodyMethod(getMethod()) )
return;
String contentType = getContentType();
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index b82136f13..9c71e5cb3 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -121,7 +121,8 @@
to POST. This is useful in RESTful applications that want to
support POST-style semantics for PUT requests.
Note that any setting other than POST causes Tomcat
- to behave in a way that violates the servlet specification.
+ to behave in a way that does against the intent of the servlet
+ specification.
The HTTP method TRACE is specifically forbidden here in accordance
with the HTTP specification.
The default is POST
diff --git a/webapps/docs/config/http.xml b/webapps/docs/config/http.xml
index 4fd8b05a4..053926757 100644
--- a/webapps/docs/config/http.xml
+++ b/webapps/docs/config/http.xml
@@ -121,7 +121,8 @@
to POST. This is useful in RESTful applications that want to
support POST-style semantics for PUT requests.
Note that any setting other than POST causes Tomcat
- to behave in a way that violates the servlet specification.
+ to behave in a way that does against the intent of the servlet
+ specification.
The HTTP method TRACE is specifically forbidden here in accordance
with the HTTP specification.
The default is POST
--
2.11.0