Author: schultz Date: Thu Dec 9 14:35:28 2010 New Revision: 1043983 URL: http://svn.apache.org/viewvc?rev=1043983&view=rev Log: - 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)
Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties tomcat/trunk/java/org/apache/catalina/connector/Request.java tomcat/trunk/webapps/docs/config/ajp.xml tomcat/trunk/webapps/docs/config/http.xml Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=1043983&r1=1043982&r2=1043983&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Thu Dec 9 14:35:28 2010 @@ -188,7 +188,7 @@ public class Connector extends Lifecycle protected String parseBodyMethods = "POST"; - protected HashSet parseBodyMethodsSet; + protected HashSet<String> parseBodyMethodsSet; /** @@ -455,28 +455,31 @@ public class Connector extends Lifecycle } - 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<String> methodSet = new HashSet<String>(); - 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 Lifecycle protocolHandler.setAdapter(adapter); // Make sure parseBodyMethodsSet has a default - if(null == parseBodyMethodsSet) + if( null == parseBodyMethodsSet ) setParseBodyMethods(getParseBodyMethods()); try { Modified: tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=1043983&r1=1043982&r2=1043983&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties Thu Dec 9 14:35:28 2010 @@ -27,6 +27,7 @@ coyoteConnector.protocolHandlerPauseFail 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 Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1043983&r1=1043982&r2=1043983&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Thu Dec 9 14:35:28 2010 @@ -2798,7 +2798,7 @@ public class Request if (usingInputStream || usingReader) return; - if(!getConnector().isParseBodyMethod(getMethod())) + if( !getConnector().isParseBodyMethod(getMethod()) ) return; String contentType = getContentType(); Modified: tomcat/trunk/webapps/docs/config/ajp.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/ajp.xml?rev=1043983&r1=1043982&r2=1043983&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/ajp.xml (original) +++ tomcat/trunk/webapps/docs/config/ajp.xml Thu Dec 9 14:35:28 2010 @@ -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 <code>POST</code> 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 <code>POST</code></p> Modified: tomcat/trunk/webapps/docs/config/http.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http.xml?rev=1043983&r1=1043982&r2=1043983&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/http.xml (original) +++ tomcat/trunk/webapps/docs/config/http.xml Thu Dec 9 14:35:28 2010 @@ -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 <code>POST</code> 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 <code>POST</code></p> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org