Class Context

java.lang.Object
org.yamcs.http.Context
Direct Known Subclasses:
RouteContext, TopicContext

public abstract class Context extends Object
Request context used in RPC-style endpoints.
  • Field Details

    • log

      protected final Log log
    • nettyContext

      public final io.netty.channel.ChannelHandlerContext nettyContext
      The 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

      protected final Api<Context> api
    • fieldMask

      protected com.google.protobuf.FieldMask fieldMask
    • user

      public final User user
      The request user.
    • txSize

      protected long txSize
    • statusCode

      protected int statusCode
    • reverseLookup

      protected boolean reverseLookup
  • Method Details

    • getApi

      public Api<Context> 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

      public String getClientAddress()
    • checkSystemPrivilege

      public void checkSystemPrivilege(SystemPrivilege privilege) throws ForbiddenException
      Throws:
      ForbiddenException
    • checkAnyOfSystemPrivileges

      public void checkAnyOfSystemPrivileges(SystemPrivilege... privileges)
    • 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

      public String toString()
      Overrides:
      toString in class Object