I've a system that runs over Tomcat 7 run-time.
Until now I'm using the ServletOutputStream as the following:
new ServletOutputStream() {
@Override
public void write(final int b) throws IOException {
responseBuilder.append(Character.toChars(b));
}
}
But now, the system run both over Tomcat 8 and 7 (depends on user), and I have to use the abstract functions isReady and setWriteListener that not exists in Tomcat 7 in-order run over Tomcat 8 (error in Tomcat 8):
https://tomcat.apache.org/tomcat-7.0-doc/servletapi/javax/servlet/ServletOutputStream.html
https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/ServletOutputStream.html
And if I use the abstract functions (error in Tomcat 7):
new ServletOutputStream() {
@Override
public void write(final int b) throws IOException {
responseBuilder.append(Character.toChars(b));
}
@Override
public boolean isReady() {
// TODO Auto-generated method stub
return false;
}
@Override
public void setWriteListener(WriteListener arg0) {
// TODO Auto-generated method stub
}
}
So, how can I use ServletOutputStream both Tomcat 8 and Tomcat 7?