Class GQLContext

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public abstract class GQLContext
    extends java.lang.Object
    implements java.lang.AutoCloseable
    The GQL context is created once per query method call, and once for the whole operation for mutations. Note that GQLServlet can be updated to handle queries serially as mutations if need be.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected GQLContext​(javax.servlet.http.HttpServletRequest request, GQLOperation operation)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abort​(java.lang.Exception ex)
      Implement if a failed context session ends in failure, e.g. update failure.
      void commit()
      Implement if a successful request is passed, and e.g. a transaction needs to be committed (instead of aborted).
      GQLOperation getOperation()  
      javax.servlet.http.HttpServletRequest getRequest()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.AutoCloseable

        close
    • Constructor Detail

      • GQLContext

        protected GQLContext​(@Nonnull
                             javax.servlet.http.HttpServletRequest request,
                             @Nonnull
                             GQLOperation operation)
    • Method Detail

      • getRequest

        public javax.servlet.http.HttpServletRequest getRequest()
        Returns:
        The HTTP request that initiated the GQL operation.
      • getOperation

        public GQLOperation getOperation()
        Returns:
        The GQL operation to be handled.
      • commit

        public void commit()
                    throws java.lang.Exception
        Implement if a successful request is passed, and e.g. a transaction needs to be committed (instead of aborted). This method is called when the last method call has passed for the context. It will be called before close.
        Throws:
        java.lang.Exception - If committing failed.
      • abort

        public void abort​(java.lang.Exception ex)
                   throws java.lang.Exception
        Implement if a failed context session ends in failure, e.g. update failure. This can be used to trigger transaction abort procedure etc. This will also trigger if commit() throws exception.
        Parameters:
        ex - The exception causing the abort.
        Throws:
        java.lang.Exception - If the abort procedure failed.