Package org.restheart.mongodb.utils
Class RequestHelper
java.lang.Object
org.restheart.mongodb.utils.RequestHelper
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckReadEtag(io.undertow.server.HttpServerExchange exchange, org.bson.BsonObjectId etag) static org.bson.types.ObjectIdgetWriteEtag(io.undertow.server.HttpServerExchange exchange) static booleanisNotAcceptableContent(org.bson.BsonValue content, io.undertow.server.HttpServerExchange exchange) static booleanisNotAcceptableContentForPatch(org.bson.BsonValue content, io.undertow.server.HttpServerExchange exchange) static booleanisResponseInConflict(OperationResult result, io.undertow.server.HttpServerExchange exchange) Warn side effect: invokes MongoResponse.of(exchange).setDbOperationResult(result)
-
Method Details
-
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
-
isNotAcceptableContentForPatch
public static boolean isNotAcceptableContentForPatch(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
-