@Test public void testBadSegmentSubResourceNumber() throws UnsupportedEncodingException, URISyntaxException { String requestPath = "/mediaExpectedOpOrId/Segment/notAnInteger"; List<String> prefixesToRemove = new ArrayList<>(); RestRequest restRequest = RestUtilsTest.createRestRequest(RestMethod.GET, requestPath, null); try { RequestPath.parse(restRequest, prefixesToRemove, CLUSTER_NAME); fail(); } catch (RestServiceException e) { assertEquals(RestServiceErrorCode.BadRequest, e.getErrorCode()); } }
public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) throws RestServiceException { String blobIdHeader = RestUtils.getHeader(restRequest.getArgs(), Headers.BLOB_ID, false); if (blobIdHeader != null) { String blobIdStr = parse(blobIdHeader, Collections.emptyMap(), prefixesToRemove, clusterName).getOperationOrBlobId(false); restRequest.setArg(Headers.BLOB_ID, blobIdStr); } return parse(restRequest.getPath(), restRequest.getArgs(), prefixesToRemove, clusterName); }
RequestPath { public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) throws RestServiceException { String blobIdHeader = RestUtils.getHeader(restRequest.getArgs(), Headers.BLOB_ID, false); if (blobIdHeader != null) { String blobIdStr = parse(blobIdHeader, Collections.emptyMap(), prefixesToRemove, clusterName).getOperationOrBlobId(false); restRequest.setArg(Headers.BLOB_ID, blobIdStr); } return parse(restRequest.getPath(), restRequest.getArgs(), prefixesToRemove, clusterName); } }
RequestPath { public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) throws RestServiceException { String blobIdHeader = RestUtils.getHeader(restRequest.getArgs(), Headers.BLOB_ID, false); if (blobIdHeader != null) { String blobIdStr = parse(blobIdHeader, Collections.emptyMap(), prefixesToRemove, clusterName).getOperationOrBlobId(false); restRequest.setArg(Headers.BLOB_ID, blobIdStr); } return parse(restRequest.getPath(), restRequest.getArgs(), prefixesToRemove, clusterName); } RequestPath(String prefix, String clusterName, String pathAfterPrefixes, String operationOrBlobId,
      SubResource subResource, int blobSegmentIdx); }
RequestPath { public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) throws RestServiceException { String blobIdHeader = RestUtils.getHeader(restRequest.getArgs(), Headers.BLOB_ID, false); if (blobIdHeader != null) { String blobIdStr = parse(blobIdHeader, Collections.emptyMap(), prefixesToRemove, clusterName).getOperationOrBlobId(false); restRequest.setArg(Headers.BLOB_ID, blobIdStr); } return parse(restRequest.getPath(), restRequest.getArgs(), prefixesToRemove, clusterName); } RequestPath(String prefix, String clusterName, String pathAfterPrefixes, String operationOrBlobId,
      SubResource subResource, int blobSegmentIdx); static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName); static RequestPath parse(String path, Map<String, Object> args, List<String> prefixesToRemove,
      String clusterName); String getPrefix(); String getClusterName(); String getPathAfterPrefixes(); String getOperationOrBlobId(boolean stripLeadingSlash); SubResource getSubResource(); int getBlobSegmentIdx(); boolean matchesOperation(String operation); @Override boolean equals(Object o); @Override String toString(); }
RequestPath { public static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName) throws RestServiceException { String blobIdHeader = RestUtils.getHeader(restRequest.getArgs(), Headers.BLOB_ID, false); if (blobIdHeader != null) { String blobIdStr = parse(blobIdHeader, Collections.emptyMap(), prefixesToRemove, clusterName).getOperationOrBlobId(false); restRequest.setArg(Headers.BLOB_ID, blobIdStr); } return parse(restRequest.getPath(), restRequest.getArgs(), prefixesToRemove, clusterName); } RequestPath(String prefix, String clusterName, String pathAfterPrefixes, String operationOrBlobId,
      SubResource subResource, int blobSegmentIdx); static RequestPath parse(RestRequest restRequest, List<String> prefixesToRemove, String clusterName); static RequestPath parse(String path, Map<String, Object> args, List<String> prefixesToRemove,
      String clusterName); String getPrefix(); String getClusterName(); String getPathAfterPrefixes(); String getOperationOrBlobId(boolean stripLeadingSlash); SubResource getSubResource(); int getBlobSegmentIdx(); boolean matchesOperation(String operation); @Override boolean equals(Object o); @Override String toString();  }