Class ResponseWriteDeadlineInterceptor

java.lang.Object
org.apache.tika.server.core.ResponseWriteDeadlineInterceptor
All Implemented Interfaces:
jakarta.ws.rs.ext.WriterInterceptor

@Provider public class ResponseWriteDeadlineInterceptor extends Object implements jakarta.ws.rs.ext.WriterInterceptor
Aborts a response still being written maxResponseWriteMillis after it is committed; the idle timeout alone resets on every trickle a slow reader accepts.

A timer, not a check between writes: one blocking write to a client that accepts a byte at a time can otherwise outlast the deadline indefinitely. From commit, not the first write: CXF drains the unread request body inside that write, which the read deadline bounds. Aborted, not closed: closing would end a chunked body cleanly, passing a truncated document off as complete.

  • Constructor Details

    • ResponseWriteDeadlineInterceptor

      public ResponseWriteDeadlineInterceptor(long maxResponseWriteMillis)
      Parameters:
      maxResponseWriteMillis - how long writing a response body may take; negative disables it
  • Method Details

    • aroundWriteTo

      public void aroundWriteTo(jakarta.ws.rs.ext.WriterInterceptorContext context) throws IOException
      Specified by:
      aroundWriteTo in interface jakarta.ws.rs.ext.WriterInterceptor
      Throws:
      IOException