- java.lang.Object
-
- org.redkale.net.Response<C,R>
-
- 类型参数:
C
- Context的子类型R
- Request的子类型
- 直接已知子类:
HttpResponse
,SncpResponse
public abstract class Response<C extends Context,R extends Request<C>> extends Object
协议响应对象详情见: https://redkale.org
- 作者:
- zhangjx
-
-
字段概要
字段 修饰符和类型 字段 说明 protected List<Runnable>
afterFinishListeners
protected AsyncConnection
channel
protected C
context
protected BiConsumer<R,Throwable>
errorHandler
protected Filter<C,R,? extends Response<C,R>>
filter
protected boolean
inNonBlocking
protected Object
output
protected boolean
readRegistered
protected BiConsumer<R,Response<C,R>>
recycleListener
protected R
request
protected Consumer<Response>
responseConsumer
protected Supplier<Response>
responseSupplier
protected Servlet<C,R,? extends Response<C,R>>
servlet
protected WorkThread
thread
protected ExecutorService
workExecutor
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addAfterFinishListener(Runnable listener)
protected void
codecError(Throwable t)
对请求包进行编解码时报错, 非Servlet.execute执行报错protected void
completeFinishBytes(Integer result, Void attachment)
protected void
defaultError(Throwable t)
void
errorHandler(BiConsumer<R,Throwable> errorHandler)
void
finish(boolean kill, byte[] bs)
void
finish(boolean kill, byte[] bs, int offset, int length)
void
finish(boolean kill, byte[] bs1, int offset1, int length1, byte[] bs2, int offset2, int length2)
void
finish(boolean kill, ByteTuple array)
void
finish(byte[] bs)
void
finish(byte[] bs, int offset, int length)
void
finish(ByteTuple array)
protected void
finishBuffer(boolean kill, ByteBuffer buffer)
protected void
finishBuffer(ByteBuffer buffer)
protected void
finishBuffers(boolean kill, ByteBuffer... buffers)
protected void
finishBuffers(ByteBuffer... buffers)
void
finishError(Throwable t)
Servlet.execute执行时报错C
getContext()
Object
getOutput()
protected ExecutorService
getWorkExecutor()
protected void
init(AsyncConnection channel)
protected boolean
inNonBlocking()
boolean
isClosed()
是否已关闭void
nextEvent()
protected void
prepare()
protected boolean
recycle()
void
recycleListener(BiConsumer<R,Response<C,R>> recycleListener)
protected void
refuseAlive()
protected AsyncConnection
removeChannel()
protected <A> void
send(ByteBuffer[] buffers, A attachment, CompletionHandler<Integer,A> handler)
protected <A> void
send(ByteBuffer buffer, A attachment, CompletionHandler<Integer,A> handler)
protected void
send(ByteTuple array, CompletionHandler<Integer,Void> handler)
protected void
setFilter(Filter<C,R,Response<C,R>> filter)
protected void
thenEvent(Filter<C,R,Response<C,R>> filter)
protected void
thenEvent(Servlet servlet)
protected void
updateNonBlocking(boolean nonBlocking)
-
-
-
字段详细资料
-
workExecutor
protected final ExecutorService workExecutor
-
thread
protected final WorkThread thread
-
channel
protected AsyncConnection channel
-
inNonBlocking
protected boolean inNonBlocking
-
readRegistered
protected boolean readRegistered
-
output
protected Object output
-
recycleListener
protected BiConsumer<R extends Request<C>,Response<C extends Context,R extends Request<C>>> recycleListener
-
errorHandler
protected BiConsumer<R extends Request<C>,Throwable> errorHandler
-
filter
protected Filter<C extends Context,R extends Request<C>,? extends Response<C extends Context,R extends Request<C>>> filter
-
-
方法详细资料
-
removeChannel
protected AsyncConnection removeChannel()
-
prepare
protected void prepare()
-
recycle
protected boolean recycle()
-
getWorkExecutor
protected ExecutorService getWorkExecutor()
-
updateNonBlocking
protected void updateNonBlocking(boolean nonBlocking)
-
inNonBlocking
protected boolean inNonBlocking()
-
refuseAlive
protected void refuseAlive()
-
init
protected void init(AsyncConnection channel)
-
thenEvent
protected void thenEvent(Servlet servlet)
-
nextEvent
public void nextEvent() throws IOException
- 抛出:
IOException
-
recycleListener
public void recycleListener(BiConsumer<R,Response<C,R>> recycleListener)
-
errorHandler
public void errorHandler(BiConsumer<R,Throwable> errorHandler)
-
addAfterFinishListener
public void addAfterFinishListener(Runnable listener)
-
getOutput
public Object getOutput()
-
isClosed
public boolean isClosed()
是否已关闭- 返回:
- boolean
-
finishError
public final void finishError(Throwable t)
Servlet.execute执行时报错被重载后kill不一定为true
- 参数:
t
- Throwable
-
defaultError
protected void defaultError(Throwable t)
-
codecError
protected void codecError(Throwable t)
对请求包进行编解码时报错, 非Servlet.execute执行报错- 参数:
t
- Throwable
-
finish
public final void finish(byte[] bs)
-
finish
public final void finish(byte[] bs, int offset, int length)
-
finish
public final void finish(ByteTuple array)
-
finish
public final void finish(boolean kill, byte[] bs)
-
finish
public final void finish(boolean kill, ByteTuple array)
-
finish
public void finish(boolean kill, byte[] bs, int offset, int length)
-
finish
public void finish(boolean kill, byte[] bs1, int offset1, int length1, byte[] bs2, int offset2, int length2)
-
finishBuffers
protected void finishBuffers(boolean kill, ByteBuffer... buffers)
-
finishBuffer
protected final void finishBuffer(ByteBuffer buffer)
-
finishBuffers
protected final void finishBuffers(ByteBuffer... buffers)
-
finishBuffer
protected void finishBuffer(boolean kill, ByteBuffer buffer)
-
send
protected void send(ByteTuple array, CompletionHandler<Integer,Void> handler)
-
send
protected <A> void send(ByteBuffer buffer, A attachment, CompletionHandler<Integer,A> handler)
-
send
protected <A> void send(ByteBuffer[] buffers, A attachment, CompletionHandler<Integer,A> handler)
-
getContext
public C getContext()
-
-