Author: violetagg Date: Sun Sep 25 14:54:31 2016 New Revision: 1762212 URL: http://svn.apache.org/viewvc?rev=1762212&view=rev Log: Remove unused code.
Modified: tomcat/trunk/java/org/apache/coyote/OutputBuffer.java tomcat/trunk/java/org/apache/coyote/Response.java tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java tomcat/trunk/java/org/apache/coyote/http2/Stream.java tomcat/trunk/test/org/apache/coyote/http11/filters/TestGzipOutputFilter.java tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java Modified: tomcat/trunk/java/org/apache/coyote/OutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/OutputBuffer.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/OutputBuffer.java (original) +++ tomcat/trunk/java/org/apache/coyote/OutputBuffer.java Sun Sep 25 14:54:31 2016 @@ -19,8 +19,6 @@ package org.apache.coyote; import java.io.IOException; import java.nio.ByteBuffer; -import org.apache.tomcat.util.buf.ByteChunk; - /** * Output buffer. * @@ -33,22 +31,6 @@ public interface OutputBuffer { /** * Write the given data to the response. The caller owns the chunks. - * - * @param chunk data to write - * - * @return The number of bytes written which may be less than available in - * the input chunk - * - * @throws IOException an underlying I/O error occurred - * - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - public int doWrite(ByteChunk chunk) throws IOException; - - - /** - * Write the given data to the response. The caller owns the chunks. * * @param chunk data to write * Modified: tomcat/trunk/java/org/apache/coyote/Response.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Response.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/Response.java (original) +++ tomcat/trunk/java/org/apache/coyote/Response.java Sun Sep 25 14:54:31 2016 @@ -25,7 +25,6 @@ import java.util.concurrent.atomic.Atomi import javax.servlet.WriteListener; -import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.http.parser.MediaType; @@ -489,22 +488,6 @@ public final class Response { } - /** - * Write a chunk of bytes. - * - * @param chunk The bytes to write - * - * @throws IOException If an I/O error occurs during the write - * - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - public void doWrite(ByteChunk chunk) throws IOException { - outputBuffer.doWrite(chunk); - contentWritten+=chunk.getLength(); - } - - /** * Write a chunk of bytes. * Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Sun Sep 25 14:54:31 2016 @@ -1306,35 +1306,6 @@ public class AjpProcessor extends Abstra } - /** - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - private void writeData(ByteChunk chunk) throws IOException { - boolean blocking = (response.getWriteListener() == null); - - int len = chunk.getLength(); - int off = 0; - - // Write this chunk - while (len > 0) { - int thisTime = Math.min(len, outputMaxChunkSize); - - responseMessage.reset(); - responseMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK); - responseMessage.appendBytes(chunk.getBytes(), chunk.getOffset() + off, thisTime); - responseMessage.end(); - socketWrapper.write(blocking, responseMessage.getBuffer(), 0, responseMessage.getLen()); - socketWrapper.flush(blocking); - - len -= thisTime; - off += thisTime; - } - - bytesWritten += off; - } - - private void writeData(ByteBuffer chunk) throws IOException { boolean blocking = (response.getWriteListener() == null); @@ -1407,28 +1378,6 @@ public class AjpProcessor extends Abstra */ protected class SocketOutputBuffer implements OutputBuffer { - /** - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - @Override - public int doWrite(ByteChunk chunk) throws IOException { - - if (!response.isCommitted()) { - // Validate and write response headers - try { - prepareResponse(); - } catch (IOException e) { - setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e); - } - } - - if (!swallowResponse) { - writeData(chunk); - } - return chunk.getLength(); - } - @Override public int doWrite(ByteBuffer chunk) throws IOException { Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11OutputBuffer.java Sun Sep 25 14:54:31 2016 @@ -191,28 +191,6 @@ public class Http11OutputBuffer implemen // --------------------------------------------------- OutputBuffer Methods - /** - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - @Override - public int doWrite(ByteChunk chunk) throws IOException { - - if (!response.isCommitted()) { - // Send the connector a request for commit. The connector should - // then validate the headers, send them (using sendHeaders) and - // set the filters accordingly. - response.action(ActionCode.COMMIT, null); - } - - if (lastActiveFilter == -1) { - return outputStreamOutputBuffer.doWrite(chunk); - } else { - return activeFilters[lastActiveFilter].doWrite(chunk); - } - } - - @Override public int doWrite(ByteBuffer chunk) throws IOException { @@ -575,22 +553,6 @@ public class Http11OutputBuffer implemen /** * Write chunk. - * - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - @Override - public int doWrite(ByteChunk chunk) throws IOException { - int len = chunk.getLength(); - int start = chunk.getStart(); - byte[] b = chunk.getBuffer(); - socketWrapper.write(isBlocking(), b, start, len); - byteCount += len; - return len; - } - - /** - * Write chunk. */ @Override public int doWrite(ByteBuffer chunk) throws IOException { Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java Sun Sep 25 14:54:31 2016 @@ -23,7 +23,6 @@ import java.nio.ByteBuffer; import org.apache.coyote.OutputBuffer; import org.apache.coyote.Response; import org.apache.coyote.http11.OutputFilter; -import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.buf.HexUtils; /** @@ -77,34 +76,6 @@ public class ChunkedOutputFilter impleme // --------------------------------------------------- OutputBuffer Methods - /** - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - @Override - public int doWrite(ByteChunk chunk) throws IOException { - - int result = chunk.getLength(); - - if (result <= 0) { - return 0; - } - - int pos = calculateChunkHeader(result); - - chunkHeader.position(pos + 1).limit(chunkHeader.position() + 9 - pos); - buffer.doWrite(chunkHeader); - - buffer.doWrite(chunk); - - chunkHeader.position(8).limit(10); - buffer.doWrite(chunkHeader); - - return result; - - } - - @Override public int doWrite(ByteBuffer chunk) throws IOException { Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/filters/GzipOutputFilter.java Sun Sep 25 14:54:31 2016 @@ -27,7 +27,6 @@ import org.apache.coyote.Response; import org.apache.coyote.http11.OutputFilter; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; -import org.apache.tomcat.util.buf.ByteChunk; /** * Gzip output filter. @@ -63,21 +62,6 @@ public class GzipOutputFilter implements // --------------------------------------------------- OutputBuffer Methods - /** - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - @Override - public int doWrite(ByteChunk chunk) throws IOException { - if (compressionStream == null) { - compressionStream = new GZIPOutputStream(fakeOutputStream, true); - } - compressionStream.write(chunk.getBytes(), chunk.getStart(), - chunk.getLength()); - return chunk.getLength(); - } - - @Override public int doWrite(ByteBuffer chunk) throws IOException { if (compressionStream == null) { Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java Sun Sep 25 14:54:31 2016 @@ -23,7 +23,6 @@ import java.nio.ByteBuffer; import org.apache.coyote.OutputBuffer; import org.apache.coyote.Response; import org.apache.coyote.http11.OutputFilter; -import org.apache.tomcat.util.buf.ByteChunk; /** * Identity output filter. @@ -56,47 +55,6 @@ public class IdentityOutputFilter implem // --------------------------------------------------- OutputBuffer Methods - /** - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - @Override - public int doWrite(ByteChunk chunk) throws IOException { - - int result = -1; - - if (contentLength >= 0) { - if (remaining > 0) { - result = chunk.getLength(); - if (result > remaining) { - // The chunk is longer than the number of bytes remaining - // in the body; changing the chunk length to the number - // of bytes remaining - chunk.setBytes(chunk.getBytes(), chunk.getStart(), - (int) remaining); - result = (int) remaining; - remaining = 0; - } else { - remaining = remaining - result; - } - buffer.doWrite(chunk); - } else { - // No more bytes left to be written : return -1 and clear the - // buffer - chunk.recycle(); - result = -1; - } - } else { - // If no content length was set, just write the bytes - buffer.doWrite(chunk); - result = chunk.getLength(); - } - - return result; - - } - - @Override public int doWrite(ByteBuffer chunk) throws IOException { Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/filters/VoidOutputFilter.java Sun Sep 25 14:54:31 2016 @@ -23,7 +23,6 @@ import java.nio.ByteBuffer; import org.apache.coyote.OutputBuffer; import org.apache.coyote.Response; import org.apache.coyote.http11.OutputFilter; -import org.apache.tomcat.util.buf.ByteChunk; /** * Void output filter, which silently swallows bytes written. Used with a 204 @@ -36,16 +35,6 @@ public class VoidOutputFilter implements // --------------------------------------------------- OutputBuffer Methods - /** - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - @Override - public int doWrite(ByteChunk chunk) throws IOException { - return chunk.getLength(); - } - - @Override public int doWrite(ByteBuffer chunk) throws IOException { return chunk.remaining(); Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Sun Sep 25 14:54:31 2016 @@ -461,38 +461,6 @@ public class Stream extends AbstractStre * client that performed concurrent writes could corrupt the buffer. */ - /** - * @deprecated Unused. Will be removed in Tomcat 9. Use - * {@link #doWrite(ByteBuffer)} - */ - @Override - public synchronized int doWrite(ByteChunk chunk) throws IOException { - if (closed) { - throw new IllegalStateException( - sm.getString("stream.closed", getConnectionId(), getIdentifier())); - } - if (!coyoteResponse.isCommitted()) { - coyoteResponse.sendHeaders(); - } - int len = chunk.getLength(); - int offset = 0; - while (len > 0) { - int thisTime = Math.min(buffer.remaining(), len); - buffer.put(chunk.getBytes(), chunk.getOffset() + offset, thisTime); - offset += thisTime; - len -= thisTime; - if (len > 0 && !buffer.hasRemaining()) { - // Only flush if we have more data to write and the buffer - // is full - if (flush(true, coyoteResponse.getWriteListener() == null)) { - break; - } - } - } - written += offset; - return offset; - } - @Override public synchronized int doWrite(ByteBuffer chunk) throws IOException { if (closed) { Modified: tomcat/trunk/test/org/apache/coyote/http11/filters/TestGzipOutputFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/filters/TestGzipOutputFilter.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/coyote/http11/filters/TestGzipOutputFilter.java (original) +++ tomcat/trunk/test/org/apache/coyote/http11/filters/TestGzipOutputFilter.java Sun Sep 25 14:54:31 2016 @@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters; import java.io.ByteArrayOutputStream; +import java.nio.ByteBuffer; import java.util.zip.GZIPOutputStream; import static org.junit.Assert.assertTrue; @@ -25,7 +26,6 @@ import static org.junit.Assert.assertTru import org.junit.Test; import org.apache.coyote.Response; -import org.apache.tomcat.util.buf.ByteChunk; /** * Test case to demonstrate the interaction between gzip and flushing in the @@ -60,10 +60,8 @@ public class TestGzipOutputFilter { tob.addActiveFilter(gf); // write a chunk out - ByteChunk chunk = new ByteChunk(1024); byte[] d = "Hello there tomcat developers, there is a bug in JDK".getBytes(); - chunk.append(d, 0, d.length); - tob.doWrite(chunk); + tob.doWrite(ByteBuffer.wrap(d)); // flush the InternalOutputBuffer tob.flush(); Modified: tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java?rev=1762212&r1=1762211&r2=1762212&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java (original) +++ tomcat/trunk/test/org/apache/coyote/http11/filters/TesterOutputBuffer.java Sun Sep 25 14:54:31 2016 @@ -23,7 +23,6 @@ import java.nio.ByteBuffer; import org.apache.coyote.OutputBuffer; import org.apache.coyote.Response; import org.apache.coyote.http11.Http11OutputBuffer; -import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.net.SocketWrapperBase; /** @@ -103,14 +102,6 @@ public class TesterOutputBuffer extends protected class OutputStreamOutputBuffer implements OutputBuffer { @Override - public int doWrite(ByteChunk chunk) throws IOException { - int length = chunk.getLength(); - outputStream.write(chunk.getBuffer(), chunk.getStart(), length); - byteCount += chunk.getLength(); - return chunk.getLength(); - } - - @Override public int doWrite(ByteBuffer chunk) throws IOException { int length = chunk.remaining(); outputStream.write(chunk.array(), chunk.arrayOffset() + chunk.position(), length); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org