Author: markt Date: Wed Oct 19 20:53:26 2011 New Revision: 1186484 URL: http://svn.apache.org/viewvc?rev=1186484&view=rev Log: Code clean-up. No functional change.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Oct 19 20:53:26 2011 @@ -1 +1 @@ -/tomcat/trunk:1156115,1156171,1156276,1156304,1156519,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166693,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172556,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096 ,1173241,1173256,1173288,1173333,1173342,1173461,1173614,1173630,1173659,1173722,1174061,1174239,1174322,1174325,1174329-1174330,1174337-1174339,1174343,1174353,1174799,1174882,1174884,1174983,1175155,1175158,1175167,1175182,1175190,1175201,1175272,1175275,1175283,1175582,1175589-1175590,1175594,1175602,1175613,1175633,1175690,1175713,1175889,1175896,1175907,1176584,1176590,1176799,1177050,1177060,1177125,1177152,1177160,1177245,1177850,1177862,1177978,1178209,1178228,1178233,1178449,1178542,1178681,1178684,1178721,1179268,1179274,1180261,1180865,1180891,1180894,1180907,1181028,1181123,1181125,1181136,1181291,1181743,1182796,1183078,1183105,1183142,1183328,1183339-1183340,1183492-1183494,1183605,1184917,1184919,1185018,1185020,1185200,1185588,1185626,1185756,1185758,1186011,1186042-1186045,1186104,1186123,1186137,1186153,1186254,1186257,1186377-1186379 +/tomcat/trunk:1156115,1156171,1156276,1156304,1156519,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166693,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172556,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096 ,1173241,1173256,1173288,1173333,1173342,1173461,1173614,1173630,1173659,1173722,1174061,1174239,1174322,1174325,1174329-1174330,1174337-1174339,1174343,1174353,1174799,1174882,1174884,1174983,1175155,1175158,1175167,1175182,1175190,1175201,1175272,1175275,1175283,1175582,1175589-1175590,1175594,1175602,1175613,1175633,1175690,1175713,1175889,1175896,1175907,1176584,1176590,1176799,1177050,1177060,1177125,1177152,1177160,1177245,1177850,1177862,1177978,1178209,1178228,1178233,1178449,1178542,1178681,1178684,1178721,1179268,1179274,1180261,1180865,1180891,1180894,1180907,1181028,1181123,1181125,1181136,1181291,1181743,1182796,1183078,1183105,1183142,1183328,1183339-1183340,1183492-1183494,1183605,1184917,1184919,1185018,1185020,1185200,1185588,1185626,1185756,1185758,1186011,1186042-1186045,1186104,1186123,1186137,1186153,1186254,1186257,1186377-1186379,1186479 Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1186484&r1=1186483&r2=1186484&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Wed Oct 19 20:53:26 2011 @@ -62,7 +62,7 @@ public abstract class AbstractHttp11Proc /* * Tracks how many internal filters are in the filter library so they - * are skipped when looking for pluggable filters. + * are skipped when looking for pluggable filters. */ private int pluggableFilterIndex = Integer.MAX_VALUE; @@ -252,7 +252,7 @@ public abstract class AbstractHttp11Proc */ protected String server = null; - + public AbstractHttp11Processor(AbstractEndpoint endpoint) { super(endpoint); } @@ -374,8 +374,9 @@ public abstract class AbstractHttp11Proc } else { result = new String[sArray.length + 1]; - for (int i = 0; i < sArray.length; i++) + for (int i = 0; i < sArray.length; i++) { result[i] = sArray[i]; + } result[sArray.length] = value; } return result; @@ -389,8 +390,9 @@ public abstract class AbstractHttp11Proc * @param value string */ private boolean startsWithStringArray(String sArray[], String value) { - if (value == null) - return false; + if (value == null) { + return false; + } for (int i = 0; i < sArray.length; i++) { if (value.startsWith(sArray[i])) { return true; @@ -537,12 +539,14 @@ public abstract class AbstractHttp11Proc response.getMimeHeaders().getValue("Content-Encoding"); if ((contentEncodingMB != null) - && (contentEncodingMB.indexOf("gzip") != -1)) + && (contentEncodingMB.indexOf("gzip") != -1)) { return false; + } // If force mode, always compress (test purposes only) - if (compressionLevel == 2) - return true; + if (compressionLevel == 2) { + return true; + } // Check if sufficient length to trigger the compression long contentLength = response.getContentLengthLong(); @@ -558,7 +562,7 @@ public abstract class AbstractHttp11Proc return false; } - + /** * Check if compression should be used for this resource. Already checked * that the resource could be compressed if the client supports it. @@ -570,12 +574,14 @@ public abstract class AbstractHttp11Proc request.getMimeHeaders().getValue("accept-encoding"); if ((acceptEncodingMB == null) - || (acceptEncodingMB.indexOf("gzip") == -1)) + || (acceptEncodingMB.indexOf("gzip") == -1)) { return false; + } // If force mode, always compress (test purposes only) - if (compressionLevel == 2) - return true; + if (compressionLevel == 2) { + return true; + } // Check for incompatible Browser if (noCompressionUserAgents != null) { @@ -594,7 +600,7 @@ public abstract class AbstractHttp11Proc return true; } - + /** * Specialized utility method: find a sequence of lower case bytes inside * a ByteChunk. @@ -610,19 +616,24 @@ public abstract class AbstractHttp11Proc int srcEnd = b.length; for (int i = start; i <= (end - srcEnd); i++) { - if (Ascii.toLower(buff[i]) != first) continue; + if (Ascii.toLower(buff[i]) != first) { + continue; + } // found first char, now look for a match int myPos = i+1; for (int srcPos = 1; srcPos < srcEnd;) { - if (Ascii.toLower(buff[myPos++]) != b[srcPos++]) + if (Ascii.toLower(buff[myPos++]) != b[srcPos++]) { break; - if (srcPos == srcEnd) return i - start; // found it + } + if (srcPos == srcEnd) { + return i - start; // found it + } } } return -1; } - + /** * Determine if we must drop the connection because of the HTTP status * code. Use the same list of codes as Apache/httpd. @@ -638,7 +649,7 @@ public abstract class AbstractHttp11Proc status == 501 /* SC_NOT_IMPLEMENTED */; } - + /** * Allows the super class to set the socket wrapper being used. */ @@ -647,18 +658,18 @@ public abstract class AbstractHttp11Proc /** * Exposes input buffer to super class to allow better code re-use. - * @return The input buffer used by the processor. + * @return The input buffer used by the processor. */ protected abstract AbstractInputBuffer<S> getInputBuffer(); - + /** * Exposes output buffer to super class to allow better code re-use. - * @return The output buffer used by the processor. + * @return The output buffer used by the processor. */ protected abstract AbstractOutputBuffer<S> getOutputBuffer(); - + /** * Initialize standard input and output filters. */ @@ -681,11 +692,11 @@ public abstract class AbstractHttp11Proc // Create and add the chunked filters. //getInputBuffer().addFilter(new GzipInputFilter()); getOutputBuffer().addFilter(new GzipOutputFilter()); - + pluggableFilterIndex = getInputBuffer().getFilters().length; } - + /** * Add an input filter to the current request. * @@ -722,7 +733,7 @@ public abstract class AbstractHttp11Proc */ @Override public final void action(ActionCode actionCode, Object param) { - + if (actionCode == ActionCode.CLOSE) { // End the processing of the current request @@ -736,8 +747,9 @@ public abstract class AbstractHttp11Proc } else if (actionCode == ActionCode.COMMIT) { // Commit current response - if (response.isCommitted()) + if (response.isCommitted()) { return; + } // Validate and write response headers try { @@ -752,8 +764,9 @@ public abstract class AbstractHttp11Proc // Send a 100 status back if it makes sense (response not committed // yet, and client specified an expectation for 100-continue) - if ((response.isCommitted()) || !expectation) + if ((response.isCommitted()) || !expectation) { return; + } getInputBuffer().setSwallowInput(true); try { @@ -790,7 +803,7 @@ public abstract class AbstractHttp11Proc } else if (actionCode == ActionCode.REQ_SET_BODY_REPLAY) { ByteChunk body = (ByteChunk) param; - + InputFilter savedBody = new SavedRequestInputFilter(body); savedBody.setRequest(request); @@ -821,14 +834,14 @@ public abstract class AbstractHttp11Proc actionInternal(actionCode, param); } } - + abstract void actionInternal(ActionCode actionCode, Object param); - + /** * Processors (currently only HTTP BIO) may elect to disable HTTP keep-alive * in some circumstances. This method allows the processor implementation to - * determine if keep-alive should be disabled or not. + * determine if keep-alive should be disabled or not. */ protected abstract boolean disableKeepAlive(); @@ -841,7 +854,7 @@ public abstract class AbstractHttp11Proc /** * Defines how a connector handles an incomplete request line read. - * + * * @return <code>true</code> if the processor should break out of the * processing loop, otherwise <code>false</code>. */ @@ -860,7 +873,7 @@ public abstract class AbstractHttp11Proc * * @param socketWrapper Socket from which the HTTP requests will be read * and the HTTP responses will be written. - * + * * @throws IOException error during an I/O operation */ @Override @@ -897,7 +910,7 @@ public abstract class AbstractHttp11Proc // Parsing the request header try { setRequestLineReadTimeout(); - + if (!getInputBuffer().parseRequestLine(keptAlive)) { if (handleIncompleteRequestLineRead()) { break; @@ -1067,7 +1080,7 @@ public abstract class AbstractHttp11Proc http09 = false; contentDelimitation = false; expectation = false; - + prepareRequestInternal(); if (endpoint.isSSLEnabled()) { @@ -1120,8 +1133,9 @@ public abstract class AbstractHttp11Proc } MessageBytes expectMB = null; - if (http11) + if (http11) { expectMB = headers.getValue("expect"); + } if ((expectMB != null) && (expectMB.indexOfIgnoreCase("100-continue", 0) != -1)) { getInputBuffer().setSwallowInput(false); @@ -1175,8 +1189,9 @@ public abstract class AbstractHttp11Proc // Parse transfer-encoding header MessageBytes transferEncodingValueMB = null; - if (http11) + if (http11) { transferEncodingValueMB = headers.getValue("transfer-encoding"); + } if (transferEncodingValueMB != null) { String transferEncodingValue = transferEncodingValueMB.toString(); // Parse the comma separated list. "identity" codings are ignored @@ -1233,7 +1248,7 @@ public abstract class AbstractHttp11Proc parseHost(valueMB); if (!contentDelimitation) { - // If there's no content length + // If there's no content length // (broken HTTP/1.0 or HTTP/1.1), assume // the client is not broken and didn't send a body getInputBuffer().addActiveFilter @@ -1246,7 +1261,7 @@ public abstract class AbstractHttp11Proc request.setAttribute("org.apache.tomcat.sendfile.support", Boolean.TRUE); } - + // Advertise comet support through a request attribute if (endpoint.getUseComet()) { request.setAttribute("org.apache.tomcat.comet.support", @@ -1257,7 +1272,7 @@ public abstract class AbstractHttp11Proc request.setAttribute("org.apache.tomcat.comet.timeout.support", Boolean.TRUE); } - + if (error) { adapter.log(request, response, 0); } @@ -1269,7 +1284,7 @@ public abstract class AbstractHttp11Proc * go away in the future. */ protected abstract void prepareRequestInternal(); - + /** * When committing the response, we have to validate the set of headers, as * well as setup the response filters. @@ -1311,7 +1326,7 @@ public abstract class AbstractHttp11Proc if (getEndpoint().getUseSendfile()) { sendingWithSendfile = prepareSendfile(outputFilters); } - + // Check for compression boolean isCompressable = false; boolean useCompression = false; @@ -1420,7 +1435,7 @@ public abstract class AbstractHttp11Proc } abstract boolean prepareSendfile(OutputFilter[] outputFilters); - + /** * Parse host. */ @@ -1470,7 +1485,7 @@ public abstract class AbstractHttp11Proc request.serverName().setChars(hostNameC, 0, valueL); } else { request.serverName().setChars(hostNameC, 0, colonPos); - + int port = 0; int mult = 1; for (int i = valueL - 1; i > colonPos; i--) { @@ -1490,7 +1505,7 @@ public abstract class AbstractHttp11Proc } - + @Override public SocketState asyncDispatch(SocketStatus status) { @@ -1600,6 +1615,6 @@ public abstract class AbstractHttp11Proc localPort = -1; recycleInternal(); } - + protected abstract void recycleInternal(); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org