Class RequestHelper


  • public class RequestHelper
    extends Object
    Author:
    Andrea Di Cesare <andrea@softinstigate.com>
    • Method Detail

      • checkReadEtag

        public static boolean checkReadEtag​(io.undertow.server.HttpServerExchange exchange,
                                            org.bson.BsonObjectId etag)
        Parameters:
        exchange -
        etag -
        Returns:
      • getWriteEtag

        public static org.bson.types.ObjectId getWriteEtag​(io.undertow.server.HttpServerExchange exchange)
        Parameters:
        exchange -
        Returns:
        the etag ObjectId value or null in case the IF_MATCH header is not present. If the header contains an invalid ObjectId string value returns a new ObjectId (the check will fail for sure)
      • isNotAcceptableContent

        public static boolean isNotAcceptableContent​(org.bson.BsonValue content,
                                                     io.undertow.server.HttpServerExchange exchange)
                                              throws Exception
        Parameters:
        content -
        exchange -
        Returns:
        true if content is not acceptable. In this case it also invoke response.setInError() on the exchange and the caller must invoke next() and return
        Throws:
        Exception
      • isResponseInConflict

        public static boolean isResponseInConflict​(OperationResult result,
                                                   io.undertow.server.HttpServerExchange exchange)
                                            throws Exception
        Warn side effect: invokes MongoResponse.of(exchange).setDbOperationResult(result)
        Parameters:
        result -
        exchange -
        Returns:
        true if response is in coflict. In this case it also invoke response.setInError() on the exchange and the caller must invoke next() and return
        Throws:
        Exception