protected void handleStream ( ) { inboundStreamHandler . handle ( new ISignalWriteStream ( ) { boolean streamFinished = false ; @ Override public void write ( IApimanBuffer buffer ) { if ( streamFinished ) { throw new IllegalStateException ( "Attempted write after #end() was called." ) ; //$NON-NLS-1$ } requestChain . write ( buffer ) ; } @ Override public void end ( ) { requestChain . end ( ) ; streamFinished = true ; } /** * @see io.apiman.gateway.engine.io.IAbortable#abort() */ @ Override public void abort ( Throwable t ) { // If this is called, it means that something went wrong on the inbound // side of things - so we need to make sure we abort and cleanup the // api connector resources. We'll also call handle() on the result // handler so that the caller knows something went wrong. streamFinished = true ; apiConnection . abort ( t ) ; resultHandler . handle ( AsyncResultImpl . < IEngineResult > create ( new RequestAbortedException ( t ) ) ) ; } @ Override public boolean isFinished ( ) { return streamFinished ; } @ Override public void drainHandler ( IAsyncHandler < Void > drainHandler ) { apiConnection . drainHandler ( drainHandler ) ; } @ Override public boolean isFull ( ) { return apiConnection . isFull ( ) ; } } ) ; }
Called when the api connector is ready to receive data from the inbound client request .