@Override
 public void sendError(int status) throws IOException {
   if (isCommitted()) {
     throw new IllegalStateException("Cannot set error status - response is already committed");
   }
   this.status = status;
   setCommitted(true);
 }
 @Override
 public void sendRedirect(String url) throws IOException {
   if (isCommitted()) {
     throw new IllegalStateException("Cannot send redirect - response is already committed");
   }
   Assert.notNull(url, "Redirect URL must not be null");
   setHeader(LOCATION_HEADER, url);
   setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
   setCommitted(true);
 }
 private void setCommittedIfBufferSizeExceeded() {
   int bufSize = getBufferSize();
   if (bufSize > 0 && this.content.size() > bufSize) {
     setCommitted(true);
   }
 }
 @Override
 public void flushBuffer() {
   setCommitted(true);
 }