Leo Leo - 3 months ago 30
Java Question

AbstractServletInputStream missing on tomcat-embed-core 8.5.4

Recently updated a java project from spring-boot 1.3.0 to 1.4.0, which is using a tomcat-embed-core 8.0.28 now AbstractServletInputStream is missing on the latest version of spring boot which is using tomcat-embed-core 8.5.4. What is the alternative/replacement of this class?

Here's the old code block, I hope it helps my case:

public class MultiReadHttpServletRequest extends HttpServletRequestWrapper {
...
public class CachedServletInputStream extends AbstractServletInputStream {
private ByteArrayInputStream input;

public CachedServletInputStream() {
input = new ByteArrayInputStream(cachedBytes.toByteArray());
}

/**
* Returns true. This stream is always ready.
*/
@Override
protected boolean doIsReady() throws IOException {
return true;
}

/**
* Reads the next set of bytes into the byte array.
*/
@Override
protected int doRead(boolean b, byte[] bytes, int i, int i1) throws IOException {
return input.read(bytes, i, i1);
}

/**
* Closes this stream. This does not affect any other streams that are dependent
* on the cached content.
*/
@Override
protected void doClose() throws IOException {
input.close();
}
}
}

Answer