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
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTransferredSize(long byteCount) voidcheckAnyOfSystemPrivileges(SystemPrivilege... privileges) voidcheckObjectPrivileges(ObjectPrivilegeType type, String... objects) voidcheckObjectPrivileges(ObjectPrivilegeType type, Collection<String> objects) voidcheckParameterPrivilege(ObjectPrivilegeType type, Collection<Parameter> objects) voidcheckParameterPrivilege(ObjectPrivilegeType type, Parameter... parameters) voidcheckSystemPrivilege(SystemPrivilege privilege) getApi()com.google.protobuf.FieldMaskintgetId()abstract com.google.protobuf.Descriptors.MethodDescriptorcom.google.protobuf.Messagecom.google.protobuf.MessageintlongGet the number of bytes transferred as the result of this call.booleanbooleanvoidprintJson(com.google.protobuf.Message message) voidreportStatusCode(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
-
checkParameterPrivilege
public void checkParameterPrivilege(ObjectPrivilegeType type, Collection<Parameter> objects) throws ForbiddenException - Throws:
ForbiddenException
-
checkParameterPrivilege
public void checkParameterPrivilege(ObjectPrivilegeType type, Parameter... parameters) throws ForbiddenException - Throws:
ForbiddenException
-
getId
public int getId() -
toString
-