Package org.yamcs.http
Class Context
java.lang.Object
org.yamcs.http.Context
- Direct Known Subclasses:
RouteContext
,TopicContext
Request context used in RPC-style endpoints.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTransferredSize
(long byteCount) void
checkAnyOfSystemPrivileges
(SystemPrivilege... privileges) void
checkObjectPrivileges
(ObjectPrivilegeType type, String... objects) void
checkObjectPrivileges
(ObjectPrivilegeType type, Collection<String> objects) void
checkSystemPrivilege
(SystemPrivilege privilege) getApi()
com.google.protobuf.FieldMask
int
getId()
abstract com.google.protobuf.Descriptors.MethodDescriptor
com.google.protobuf.Message
com.google.protobuf.Message
int
long
Get the number of bytes transferred as the result of this call.boolean
boolean
void
printJson
(com.google.protobuf.Message message) void
reportStatusCode
(int statusCode) toString()
-
Field Details
-
log
-
nettyContext
public final io.netty.channel.ChannelHandlerContext nettyContextThe Netty request context for an RPC call. In general RPC implementation should avoid using this object. It is exposed only because we need it for some HTTP-specific functionalities that are not covered by our RPC implementation (e.g. http chunking) -
api
-
fieldMask
protected com.google.protobuf.FieldMask fieldMask -
user
The request user. -
txSize
protected long txSize -
statusCode
protected int statusCode -
reverseLookup
protected boolean reverseLookup
-
-
Method Details
-
getApi
-
getMethod
public abstract com.google.protobuf.Descriptors.MethodDescriptor getMethod() -
isServerStreaming
public boolean isServerStreaming() -
isClientStreaming
public boolean isClientStreaming() -
getRequestPrototype
public com.google.protobuf.Message getRequestPrototype() -
getResponsePrototype
public com.google.protobuf.Message getResponsePrototype() -
parseJson
public void parseJson(String json, com.google.protobuf.Message.Builder builder) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
printJson
public String printJson(com.google.protobuf.Message message) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
getFieldMask
public com.google.protobuf.FieldMask getFieldMask() -
getTransferredSize
public long getTransferredSize()Get the number of bytes transferred as the result of this call. It should not include the http headers. Note that the number might be increased before the data is sent so it will be wrong if there was an error sending data.- Returns:
- number of bytes transferred as part of the request
-
addTransferredSize
public void addTransferredSize(long byteCount) -
getStatusCode
public int getStatusCode() -
reportStatusCode
public void reportStatusCode(int statusCode) -
getClientAddress
-
checkSystemPrivilege
- Throws:
ForbiddenException
-
checkAnyOfSystemPrivileges
-
checkObjectPrivileges
public void checkObjectPrivileges(ObjectPrivilegeType type, Collection<String> objects) throws ForbiddenException - Throws:
ForbiddenException
-
checkObjectPrivileges
public void checkObjectPrivileges(ObjectPrivilegeType type, String... objects) throws ForbiddenException - Throws:
ForbiddenException
-
getId
public int getId() -
toString
-