- java.lang.Object
-
- org.redkale.net.Request<C>
-
- 类型参数:
C- Context子类型
- 直接已知子类:
HttpRequest,SncpRequest
public abstract class Request<C extends Context> extends Object
协议请求对象详情见: https://redkale.org
- 作者:
- zhangjx
-
-
字段概要
字段 修饰符和类型 字段 说明 protected Annotation[]annotationsprotected Map<String,Object>attributes每次新请求都会清空protected AsyncConnectionchannelprotected Ccontextprotected longcreateTimeprotected JsonConvertjsonConvertprotected booleankeepAliveprotected booleanpipelineCompletedprotected intpipelineCountprotected intpipelineIndexprotected ProtobufConvertprotobufConvertprotected booleanreadCompletedprotected Stringtraceid
-
方法概要
所有方法 实例方法 抽象方法 具体方法 已过时的方法 修饰符和类型 方法 说明 <T extends Annotation>
TgetAnnotation(Class<T> annotationClass)获取当前操作Method上的注解Annotation[]getAnnotations()获取当前操作Method上的注解集合<T extends Annotation>
T[]getAnnotationsByType(Class<T> annotationClass)获取当前操作Method上的注解集合<V> VgetAttribute(String name)Map<String,Object>getAttributes()CgetContext()longgetCreatetime()已过时。replace bygetCreateTime()longgetCreateTime()protected abstract SerializablegetRequestid()<V> VgetSubobject(String name)<V> VgetSubobjectIfAbsent(String name, Function<String,? extends V> func)protected Map<String,Object>getSubobjects()StringgetTraceid()booleanisKeepAlive()protected InputStreamnewInputStream()protected Requestpipeline(int pipelineIndex, int pipelineCount)protected intpipelineHeaderLength()protected abstract voidprepare()protected abstract intreadHeader(ByteBuffer buffer, int pipelineHeaderLength)返回值:Integer.MIN_VALUE: 帧数据; -1:数据不合法; 0:解析完毕; >0: 需再读取的字节数。protected voidrecycle()<V> VremoveAttribute(String name)<V> VremoveSubobject(String name)<V> VsetAttribute(String name, V value)<V> VsetSubobject(String name, V value)Request<C>traceid(String traceid)
-
-
-
字段详细资料
-
protobufConvert
protected final ProtobufConvert protobufConvert
-
jsonConvert
protected final JsonConvert jsonConvert
-
createTime
protected long createTime
-
keepAlive
protected boolean keepAlive
-
readCompleted
protected boolean readCompleted
-
pipelineIndex
protected int pipelineIndex
-
pipelineCount
protected int pipelineCount
-
pipelineCompleted
protected boolean pipelineCompleted
-
traceid
protected String traceid
-
annotations
protected Annotation[] annotations
-
channel
protected AsyncConnection channel
-
-
方法详细资料
-
pipelineHeaderLength
protected int pipelineHeaderLength()
-
pipeline
protected Request pipeline(int pipelineIndex, int pipelineCount)
-
readHeader
protected abstract int readHeader(ByteBuffer buffer, int pipelineHeaderLength)
返回值:Integer.MIN_VALUE: 帧数据; -1:数据不合法; 0:解析完毕; >0: 需再读取的字节数。- 参数:
buffer- ByteBuffer对象pipelineHeaderLength- 同一Channel的pipelien模式下上一个Request的header长度- 返回:
- 缺少的字节数
-
getRequestid
protected abstract Serializable getRequestid()
-
prepare
protected abstract void prepare()
-
recycle
protected void recycle()
-
getSubobject
public <V> V getSubobject(String name)
-
getSubobjectIfAbsent
public <V> V getSubobjectIfAbsent(String name, Function<String,? extends V> func)
-
setSubobject
public <V> V setSubobject(String name, V value)
-
removeSubobject
public <V> V removeSubobject(String name)
-
setAttribute
public <V> V setAttribute(String name, V value)
-
getAttribute
public <V> V getAttribute(String name)
-
removeAttribute
public <V> V removeAttribute(String name)
-
newInputStream
protected InputStream newInputStream()
-
isKeepAlive
public boolean isKeepAlive()
-
getContext
public C getContext()
-
getCreateTime
public long getCreateTime()
-
getAnnotations
public Annotation[] getAnnotations()
获取当前操作Method上的注解集合- 返回:
- Annotation[]
-
getAnnotation
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
获取当前操作Method上的注解- 类型参数:
T- 注解泛型- 参数:
annotationClass- 注解类型- 返回:
- Annotation
-
getAnnotationsByType
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass)
获取当前操作Method上的注解集合- 类型参数:
T- 注解泛型- 参数:
annotationClass- 注解类型- 返回:
- Annotation[]
-
getCreatetime
@Deprecated(since="2.7.0") public long getCreatetime()
已过时。replace bygetCreateTime()- 返回:
- long
- 另请参阅:
getCreateTime()
-
getTraceid
public String getTraceid()
-
-