public final class ExpansionDeltaUtil extends Object
Utility class providing methods used in ExpansionHandler and DeltaHandler.
| Modifier and Type | Class and Description |
|---|---|
static class |
ExpansionDeltaUtil.CollectionResourceContainer
Simple container holding a collectionName and a list of resourceNames
|
static class |
ExpansionDeltaUtil.SlashHandling |
| Modifier and Type | Method and Description |
|---|---|
static String |
constructRequestUri(String path,
io.vertx.core.MultiMap params,
List<String> paramsToRemove,
String subResource,
ExpansionDeltaUtil.SlashHandling slashHandling)
Constructs a Request based on the given path and the given params without the paramsToRemove
|
static io.vertx.core.Handler<Throwable> |
createRequestExceptionHandler(io.vertx.core.http.HttpServerRequest request,
String uri,
Class<?> caller)
Utility method to create a Exception for a
HttpServerRequest |
static io.vertx.core.Handler<Throwable> |
createResponseExceptionHandler(io.vertx.core.http.HttpServerRequest request,
String uri,
Class<?> caller)
Utility method to create a
Exception for a HttpServerRequest |
static String |
extractCollectionFromPath(String path)
Extracts the collection name from the given path.
|
static List<String> |
extractCollectionResourceNames(io.vertx.core.json.JsonArray collectionArray)
Extracts the collection resource names from the given
JsonArray |
static String |
mapToDelimetedString(io.vertx.core.MultiMap map,
String delim)
Converts the given map to a delimited string based on the given delimiter.
|
static String |
removeFromEndOfString(String source,
String stringToRemove)
Remove the stringToRemove from source when existing
|
static ExpansionDeltaUtil.CollectionResourceContainer |
verifyCollectionResponse(io.vertx.core.http.HttpServerRequest request,
io.vertx.core.buffer.Buffer data,
Set<String> originalParams)
Verifies the result of the collection request.
|
static ExpansionDeltaUtil.CollectionResourceContainer |
verifyCollectionResponse(String targetPath,
io.vertx.core.buffer.Buffer data,
Set<String> originalParams)
Verifies the result of the collection request.
|
public static String mapToDelimetedString(io.vertx.core.MultiMap map, String delim)
Example
Input Map: {k1=v1, k2=v2, k3=v3} Input delim:
Result: k1=v1&k2=v2&k3=v3
map - The map to convert.delim - The delimiter to use between key-value pairs.public static String removeFromEndOfString(String source, String stringToRemove)
source - the source to remove the stringToRemove fromstringToRemove - the token to remove from sourcepublic static String extractCollectionFromPath(String path)
path - pathpublic static List<String> extractCollectionResourceNames(io.vertx.core.json.JsonArray collectionArray) throws ResourceCollectionException
JsonArraycollectionArray - collectionArrayResourceCollectionException - ResourceCollectionExceptionpublic static String constructRequestUri(String path, io.vertx.core.MultiMap params, List<String> paramsToRemove, String subResource, ExpansionDeltaUtil.SlashHandling slashHandling)
path - the original path to modifyparams - the params of the original requestparamsToRemove - the params which should be removed in the new requestsubResource - additional segment for the new requestslashHandling - when set to true, the new request will have a / at the endpublic static io.vertx.core.Handler<Throwable> createRequestExceptionHandler(io.vertx.core.http.HttpServerRequest request, String uri, Class<?> caller)
HttpServerRequestrequest - the requesturi - an uricaller - the callerpublic static io.vertx.core.Handler<Throwable> createResponseExceptionHandler(io.vertx.core.http.HttpServerRequest request, String uri, Class<?> caller)
Exception for a HttpServerRequestrequest - the requesturi - an uricaller - the callerpublic static ExpansionDeltaUtil.CollectionResourceContainer verifyCollectionResponse(io.vertx.core.http.HttpServerRequest request, io.vertx.core.buffer.Buffer data, Set<String> originalParams) throws ResourceCollectionException
ResourceCollectionException when no collection or more than one collection was found Returns a
ExpansionDeltaUtil.CollectionResourceContainer containing the name of the collection and a list of the resourceNames.request - the requestdata - the dataoriginalParams - originalParamsResourceCollectionException - ResourceCollectionExceptionpublic static ExpansionDeltaUtil.CollectionResourceContainer verifyCollectionResponse(String targetPath, io.vertx.core.buffer.Buffer data, Set<String> originalParams) throws ResourceCollectionException
ResourceCollectionException when no collection
or more than one collection was found Returns a ExpansionDeltaUtil.CollectionResourceContainer containing the name of the
collection and a list of the resourceNames.targetPath - target pathdata - the dataoriginalParams - originalParamsResourceCollectionException - ResourceCollectionExceptionCopyright © 2016–2020. All rights reserved.