public class RequestPath
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
int |
getBlobSegmentIdx() |
java.lang.String |
getClusterName() |
java.lang.String |
getOperationOrBlobId(boolean stripLeadingSlash) |
java.lang.String |
getPathAfterPrefixes()
For use cases that only require prefixes to be removed from a request path but do not need special handling for
blob IDs and sub-resources.
|
java.lang.String |
getPrefix() |
RestUtils.SubResource |
getSubResource() |
boolean |
matchesOperation(java.lang.String operation)
This will check if the request path matches the specified operation.
|
static RequestPath |
parse(RestRequest restRequest,
java.util.List<java.lang.String> prefixesToRemove,
java.lang.String clusterName)
Parse the request path (and additional headers in some cases).
|
static RequestPath |
parse(java.lang.String path,
java.util.Map<java.lang.String,java.lang.Object> args,
java.util.List<java.lang.String> prefixesToRemove,
java.lang.String clusterName)
This is similar to
parse(RestRequest, List, String) but allows usage with arbitrary paths that are not
part of a RestRequest . |
java.lang.String |
toString() |
public static RequestPath parse(RestRequest restRequest, java.util.List<java.lang.String> prefixesToRemove, java.lang.String clusterName) throws RestServiceException
{prefixToRemove}?{clusterNameSegment}?({operationOrBlobId}|{operationOrBlobId}/{subResource})
For example, something like /prefixOne/clusterA/parts/of/blobId/BlobInfo
, /clusterA/operation
,
or /blobId
, among others.restRequest
- RestRequest
containing metadata about the request.prefixesToRemove
- the list of prefixes that could precede the other parts of the URL. Removal of
prefixes earlier in the list will be preferred to removal of the ones later in the list.clusterName
- the cluster name to recognize and handle when parsing the URL. Case is ignored when matching
this path segment.RequestPath
object.RestServiceException
public static RequestPath parse(java.lang.String path, java.util.Map<java.lang.String,java.lang.Object> args, java.util.List<java.lang.String> prefixesToRemove, java.lang.String clusterName) throws RestServiceException
parse(RestRequest, List, String)
but allows usage with arbitrary paths that are not
part of a RestRequest
.path
- the pathargs
- a map containing any request arguments. This might be used to look for blob IDs supplied via query
parameters or headers.prefixesToRemove
- the list of prefixes that could precede the other parts of the URL. Removal of
prefixes earlier in the list will be preferred to removal of the ones later in the list.clusterName
- the cluster name to recognize and handle when parsing the URL. Case is ignored when matching
this path segment.RequestPath
object.RestServiceException
public java.lang.String getPrefix()
public java.lang.String getClusterName()
public java.lang.String getPathAfterPrefixes()
public java.lang.String getOperationOrBlobId(boolean stripLeadingSlash)
stripLeadingSlash
- true
to remove the leading slash, if present.public RestUtils.SubResource getSubResource()
RestUtils.SubResource
, or null
if no sub-resource was found in the request path.public int getBlobSegmentIdx()
public boolean matchesOperation(java.lang.String operation)
getOperationOrBlobId(boolean)
match the path segments in operation
. For example,
/op
or /op/sub
will match the operation op
.operation
- the operation name to check the path against.true
if this request path matches the specified operation.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object