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 2016/08/11 11:55:43 UTC
svn commit: r1755959 - in /tomcat/tc8.5.x/trunk: ./
java/org/apache/catalina/connector/Connector.java
Author: markt
Date: Thu Aug 11 11:55:42 2016
New Revision: 1755959
URL: http://svn.apache.org/viewvc?rev=1755959&view=rev
Log:
Clean-up
- fix indentation (4 rather than 5 spaces)
- remove unnecessary whitespace
- use longer lines where possible
- copy properties to protocol handler consistently
- remove unnecessary ()
- remove getter/setter for maxHeaderCount that simply passes it through to the protocol handler
Modified:
tomcat/tc8.5.x/trunk/ (props changed)
tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Connector.java
Propchange: tomcat/tc8.5.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 11 11:55:42 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747
924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942
+/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747
924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Connector.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Connector.java?rev=1755959&r1=1755958&r2=1755959&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Connector.java Thu Aug 11 11:55:42 2016
@@ -228,27 +228,26 @@ public class Connector extends Lifecycle
protected Adapter adapter = null;
- /**
- * URI encoding.
- */
- protected String URIEncoding = null;
- protected String URIEncodingLower = null;
-
-
- /**
- * URI encoding as body.
- */
- protected boolean useBodyEncodingForURI = false;
-
-
- protected static final HashMap<String,String> replacements =
- new HashMap<>();
- static {
- replacements.put("acceptCount", "backlog");
- replacements.put("connectionLinger", "soLinger");
- replacements.put("connectionTimeout", "soTimeout");
- replacements.put("rootFile", "rootfile");
- }
+ /**
+ * URI encoding.
+ */
+ protected String URIEncoding = null;
+ protected String URIEncodingLower = null;
+
+
+ /**
+ * URI encoding as body.
+ */
+ protected boolean useBodyEncodingForURI = false;
+
+
+ protected static final HashMap<String,String> replacements = new HashMap<>();
+ static {
+ replacements.put("acceptCount", "backlog");
+ replacements.put("connectionLinger", "soLinger");
+ replacements.put("connectionTimeout", "soTimeout");
+ replacements.put("rootFile", "rootfile");
+ }
// ------------------------------------------------------------- Properties
@@ -283,6 +282,7 @@ public class Connector extends Lifecycle
return IntrospectionUtils.setProperty(protocolHandler, repl, value);
}
+
/**
* Return a property from the protocol handler.
*
@@ -309,9 +309,7 @@ public class Connector extends Lifecycle
* @return the <code>Service</code> with which we are associated (if any).
*/
public Service getService() {
-
- return (this.service);
-
+ return this.service;
}
@@ -321,19 +319,16 @@ public class Connector extends Lifecycle
* @param service The service that owns this Engine
*/
public void setService(Service service) {
-
this.service = service;
-
}
/**
- * @return <code>true</code> if the TRACE method is allowed. Default value is <code>false</code>.
+ * @return <code>true</code> if the TRACE method is allowed. Default value
+ * is <code>false</code>.
*/
public boolean getAllowTrace() {
-
- return (this.allowTrace);
-
+ return this.allowTrace;
}
@@ -343,10 +338,8 @@ public class Connector extends Lifecycle
* @param allowTrace The new allowTrace flag
*/
public void setAllowTrace(boolean allowTrace) {
-
this.allowTrace = allowTrace;
setProperty("allowTrace", String.valueOf(allowTrace));
-
}
@@ -354,9 +347,7 @@ public class Connector extends Lifecycle
* @return the default timeout for async requests in ms.
*/
public long getAsyncTimeout() {
-
return asyncTimeout;
-
}
@@ -366,10 +357,8 @@ public class Connector extends Lifecycle
* @param asyncTimeout The new timeout in ms.
*/
public void setAsyncTimeout(long asyncTimeout) {
-
this.asyncTimeout= asyncTimeout;
setProperty("asyncTimeout", String.valueOf(asyncTimeout));
-
}
@@ -377,9 +366,7 @@ public class Connector extends Lifecycle
* @return the "enable DNS lookups" flag.
*/
public boolean getEnableLookups() {
-
- return (this.enableLookups);
-
+ return this.enableLookups;
}
@@ -389,30 +376,10 @@ public class Connector extends Lifecycle
* @param enableLookups The new "enable DNS lookups" flag value
*/
public void setEnableLookups(boolean enableLookups) {
-
this.enableLookups = enableLookups;
setProperty("enableLookups", String.valueOf(enableLookups));
-
- }
-
-
- /**
- * @return the maximum number of headers that are allowed by the container. A
- * value of less than 0 means no limit.
- */
- public int getMaxHeaderCount() {
- return ((Integer) getProperty("maxHeaderCount")).intValue();
}
- /**
- * Set the maximum number of headers in a request that are allowed by the
- * container. A value of less than 0 means no limit.
- *
- * @param maxHeaderCount The new setting
- */
- public void setMaxHeaderCount(int maxHeaderCount) {
- setProperty("maxHeaderCount", String.valueOf(maxHeaderCount));
- }
/**
* @return the maximum number of parameters (GET plus POST) that will be
@@ -433,6 +400,7 @@ public class Connector extends Lifecycle
*/
public void setMaxParameterCount(int maxParameterCount) {
this.maxParameterCount = maxParameterCount;
+ setProperty("maxParameterCount", String.valueOf(maxParameterCount));
}
@@ -441,9 +409,7 @@ public class Connector extends Lifecycle
* parsed by the container.
*/
public int getMaxPostSize() {
-
- return (maxPostSize);
-
+ return maxPostSize;
}
@@ -455,8 +421,8 @@ public class Connector extends Lifecycle
* be automatically parsed by the container
*/
public void setMaxPostSize(int maxPostSize) {
-
this.maxPostSize = maxPostSize;
+ setProperty("maxPostSize", String.valueOf(maxPostSize));
}
@@ -465,9 +431,7 @@ public class Connector extends Lifecycle
* during authentication.
*/
public int getMaxSavePostSize() {
-
- return (maxSavePostSize);
-
+ return maxSavePostSize;
}
@@ -479,7 +443,6 @@ public class Connector extends Lifecycle
* be saved by the container during authentication.
*/
public void setMaxSavePostSize(int maxSavePostSize) {
-
this.maxSavePostSize = maxSavePostSize;
setProperty("maxSavePostSize", String.valueOf(maxSavePostSize));
}
@@ -489,11 +452,10 @@ public class Connector extends Lifecycle
* @return the HTTP methods which will support body parameters parsing
*/
public String getParseBodyMethods() {
-
return this.parseBodyMethods;
-
}
+
/**
* Set list of HTTP methods which should allow body parameter
* parsing. This defaults to <code>POST</code>.
@@ -504,34 +466,32 @@ public class Connector extends Lifecycle
HashSet<String> methodSet = new HashSet<>();
- if( null != methods ) {
+ if (null != methods) {
methodSet.addAll(Arrays.asList(methods.split("\\s*,\\s*")));
}
- if( methodSet.contains("TRACE") ) {
+ if (methodSet.contains("TRACE")) {
throw new IllegalArgumentException(sm.getString("coyoteConnector.parseBodyMethodNoTrace"));
}
this.parseBodyMethods = methods;
this.parseBodyMethodsSet = methodSet;
-
+ setProperty("parseBodyMethods", methods);
}
- protected boolean isParseBodyMethod(String method) {
+ protected boolean isParseBodyMethod(String method) {
return parseBodyMethodsSet.contains(method);
-
}
+
/**
* @return the port number on which this connector is configured to listen
* for requests. The special value of 0 means select a random free port
* when the socket is bound.
*/
public int getPort() {
-
- return (this.port);
-
+ return this.port;
}
@@ -541,10 +501,8 @@ public class Connector extends Lifecycle
* @param port The new port number
*/
public void setPort(int port) {
-
this.port = port;
setProperty("port", String.valueOf(port));
-
}
@@ -602,7 +560,6 @@ public class Connector extends Lifecycle
} else {
setProtocolHandlerClassName(protocol);
}
-
}
@@ -610,9 +567,7 @@ public class Connector extends Lifecycle
* @return the class name of the Coyote protocol handler in use.
*/
public String getProtocolHandlerClassName() {
-
- return (this.protocolHandlerClassName);
-
+ return this.protocolHandlerClassName;
}
@@ -623,9 +578,7 @@ public class Connector extends Lifecycle
* @param protocolHandlerClassName The new class name
*/
public void setProtocolHandlerClassName(String protocolHandlerClassName) {
-
this.protocolHandlerClassName = protocolHandlerClassName;
-
}
@@ -633,9 +586,7 @@ public class Connector extends Lifecycle
* @return the protocol handler associated with the connector.
*/
public ProtocolHandler getProtocolHandler() {
-
- return (this.protocolHandler);
-
+ return this.protocolHandler;
}
@@ -643,9 +594,7 @@ public class Connector extends Lifecycle
* @return the proxy server name for this Connector.
*/
public String getProxyName() {
-
- return (this.proxyName);
-
+ return this.proxyName;
}
@@ -658,11 +607,10 @@ public class Connector extends Lifecycle
if(proxyName != null && proxyName.length() > 0) {
this.proxyName = proxyName;
- setProperty("proxyName", proxyName);
} else {
this.proxyName = null;
}
-
+ setProperty("proxyName", this.proxyName);
}
@@ -670,9 +618,7 @@ public class Connector extends Lifecycle
* @return the proxy server port for this Connector.
*/
public int getProxyPort() {
-
- return (this.proxyPort);
-
+ return this.proxyPort;
}
@@ -682,10 +628,8 @@ public class Connector extends Lifecycle
* @param proxyPort The new proxy server port
*/
public void setProxyPort(int proxyPort) {
-
this.proxyPort = proxyPort;
setProperty("proxyPort", String.valueOf(proxyPort));
-
}
@@ -695,9 +639,7 @@ public class Connector extends Lifecycle
* with a transport guarantee that requires SSL.
*/
public int getRedirectPort() {
-
- return (this.redirectPort);
-
+ return this.redirectPort;
}
@@ -707,10 +649,8 @@ public class Connector extends Lifecycle
* @param redirectPort The redirect port number (non-SSL to SSL)
*/
public void setRedirectPort(int redirectPort) {
-
this.redirectPort = redirectPort;
setProperty("redirectPort", String.valueOf(redirectPort));
-
}
@@ -719,9 +659,7 @@ public class Connector extends Lifecycle
* through this connector. Default value is "http".
*/
public String getScheme() {
-
- return (this.scheme);
-
+ return this.scheme;
}
@@ -732,9 +670,7 @@ public class Connector extends Lifecycle
* @param scheme The new scheme
*/
public void setScheme(String scheme) {
-
this.scheme = scheme;
-
}
@@ -743,9 +679,7 @@ public class Connector extends Lifecycle
* received through this connector. Default value is "false".
*/
public boolean getSecure() {
-
- return (this.secure);
-
+ return this.secure;
}
@@ -756,66 +690,61 @@ public class Connector extends Lifecycle
* @param secure The new secure connection flag
*/
public void setSecure(boolean secure) {
-
this.secure = secure;
setProperty("secure", Boolean.toString(secure));
}
- /**
- * @return the character encoding to be used for the URI using the original
- * case.
- */
- public String getURIEncoding() {
- return this.URIEncoding;
- }
-
-
- /**
- * @return the character encoding to be used for the URI using lower case.
- */
- public String getURIEncodingLower() {
- return this.URIEncodingLower;
- }
-
-
- /**
- * Set the URI encoding to be used for the URI.
- *
- * @param URIEncoding The new URI character encoding.
- */
- public void setURIEncoding(String URIEncoding) {
- this.URIEncoding = URIEncoding;
- if (URIEncoding == null) {
- URIEncodingLower = null;
- } else {
- this.URIEncodingLower = URIEncoding.toLowerCase(Locale.ENGLISH);
- }
- setProperty("uRIEncoding", URIEncoding);
- }
-
-
- /**
- * @return the true if the entity body encoding should be used for the URI.
- */
- public boolean getUseBodyEncodingForURI() {
-
- return (this.useBodyEncodingForURI);
-
- }
-
-
- /**
- * Set if the entity body encoding should be used for the URI.
- *
- * @param useBodyEncodingForURI The new value for the flag.
- */
- public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI) {
-
- this.useBodyEncodingForURI = useBodyEncodingForURI;
- setProperty
- ("useBodyEncodingForURI", String.valueOf(useBodyEncodingForURI));
- }
+ /**
+ * @return the character encoding to be used for the URI using the original
+ * case.
+ */
+ public String getURIEncoding() {
+ return this.URIEncoding;
+ }
+
+
+ /**
+ * @return the character encoding to be used for the URI using lower case.
+ */
+ public String getURIEncodingLower() {
+ return this.URIEncodingLower;
+ }
+
+
+ /**
+ * Set the URI encoding to be used for the URI.
+ *
+ * @param URIEncoding The new URI character encoding.
+ */
+ public void setURIEncoding(String URIEncoding) {
+ this.URIEncoding = URIEncoding;
+ if (URIEncoding == null) {
+ URIEncodingLower = null;
+ } else {
+ this.URIEncodingLower = URIEncoding.toLowerCase(Locale.ENGLISH);
+ }
+ setProperty("uRIEncoding", URIEncoding);
+ }
+
+
+ /**
+ * @return the true if the entity body encoding should be used for the URI.
+ */
+ public boolean getUseBodyEncodingForURI() {
+ return this.useBodyEncodingForURI;
+ }
+
+
+ /**
+ * Set if the entity body encoding should be used for the URI.
+ *
+ * @param useBodyEncodingForURI The new value for the flag.
+ */
+ public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI) {
+ this.useBodyEncodingForURI = useBodyEncodingForURI;
+ setProperty("useBodyEncodingForURI", String.valueOf(useBodyEncodingForURI));
+ }
/**
* Indicates whether the generation of an X-Powered-By response header for
@@ -842,6 +771,7 @@ public class Connector extends Lifecycle
setProperty("xpoweredBy", String.valueOf(xpoweredBy));
}
+
/**
* Enable the use of IP-based virtual hosting.
*
@@ -853,6 +783,7 @@ public class Connector extends Lifecycle
setProperty("useIPVHosts", String.valueOf(useIPVHosts));
}
+
/**
* Test if IP-based virtual hosting is enabled.
*
@@ -876,6 +807,7 @@ public class Connector extends Lifecycle
protocolHandler.addSslHostConfig(sslHostConfig);
}
+
public SSLHostConfig[] findSslHostConfigs() {
return protocolHandler.findSslHostConfigs();
}
@@ -884,12 +816,14 @@ public class Connector extends Lifecycle
public void addUpgradeProtocol(UpgradeProtocol upgradeProtocol) {
protocolHandler.addUpgradeProtocol(upgradeProtocol);
}
+
+
public UpgradeProtocol[] findUpgradeProtocols() {
return protocolHandler.findUpgradeProtocols();
}
- // --------------------------------------------------------- Public Methods
+ // --------------------------------------------------------- Public Methods
/**
* Create (or allocate) and return a Request object suitable for
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org