Package org.restheart.mongodb.utils
Class MongoURLUtils
java.lang.Object
org.restheart.utils.URLUtils
org.restheart.mongodb.utils.MongoURLUtils
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExchangeKeys.DOC_ID_TYPEcheckId(org.bson.BsonValue id) static org.bson.BsonValueGets the id as object from its string representation in the document URI NOTE: for POST the special string id are checked by BodyInjectorHandler.checkSpecialStringId()static StringgetRemappedRequestURL(io.undertow.server.HttpServerExchange exchange) returns the request URL taking into account the instance-base-url configuration option.static StringgetUriWithDocId(MongoRequest request, String dbName, String collName, org.bson.BsonValue id) static StringgetUriWithFilterMany(MongoRequest request, String dbName, String collName, org.bson.BsonValue[] ids) static StringgetUriWithFilterManyInverse(MongoRequest request, String dbName, String collName, String referenceField, org.bson.BsonValue id) static StringgetUriWithFilterOne(MongoRequest request, String dbName, String collName, String referenceField, org.bson.BsonValue id) Methods inherited from class org.restheart.utils.URLUtils
decodeQueryString, getIdString, getParentPath, getPrefixUrl, getQueryStringRemovingParams, removeTrailingSlashes
-
Method Details
-
checkId
public static ExchangeKeys.DOC_ID_TYPE checkId(org.bson.BsonValue id) throws UnsupportedDocumentIdException - Parameters:
id-- Returns:
- Throws:
UnsupportedDocumentIdException
-
getDocumentIdFromURI
public static org.bson.BsonValue getDocumentIdFromURI(String id, ExchangeKeys.DOC_ID_TYPE type) throws UnsupportedDocumentIdException Gets the id as object from its string representation in the document URI NOTE: for POST the special string id are checked by BodyInjectorHandler.checkSpecialStringId()- Parameters:
id-type-- Returns:
- Throws:
UnsupportedDocumentIdException
-
getRemappedRequestURL
returns the request URL taking into account the instance-base-url configuration option. When RESTHeart is exposed via a reverse-proxy or an API gateway it allows mapping the Location header correctly.- Parameters:
exchange-- Returns:
-
getUriWithDocId
public static String getUriWithDocId(MongoRequest request, String dbName, String collName, org.bson.BsonValue id) throws UnsupportedDocumentIdException - Parameters:
request-dbName-collName-id-- Returns:
- Throws:
UnsupportedDocumentIdException
-
getUriWithFilterMany
public static String getUriWithFilterMany(MongoRequest request, String dbName, String collName, org.bson.BsonValue[] ids) throws UnsupportedDocumentIdException - Parameters:
request-dbName-collName-ids-- Returns:
- Throws:
UnsupportedDocumentIdException
-
getUriWithFilterOne
public static String getUriWithFilterOne(MongoRequest request, String dbName, String collName, String referenceField, org.bson.BsonValue id) throws UnsupportedDocumentIdException - Parameters:
request-dbName-collName-referenceField-id-- Returns:
- Throws:
UnsupportedDocumentIdException
-
getUriWithFilterManyInverse
public static String getUriWithFilterManyInverse(MongoRequest request, String dbName, String collName, String referenceField, org.bson.BsonValue id) throws UnsupportedDocumentIdException - Parameters:
request-dbName-collName-referenceField-id-- Returns:
- Throws:
UnsupportedDocumentIdException
-