@Test public void testRestrictedEndpointWhenEndpointIsNotRestricted() { final HttpServerExchange exchange = makeHttpServerExchange("/containers/containerId", "GET"); final String containerId = "containerId"; final boolean isRestricted = restrictionPolicy.restrictedEndpoint(exchange, containerId); assertFalse(isRestricted); }
@Override public boolean restrictedEndpoint(final HttpServerExchange exchange, final String containerId) { final String relativePath = exchange.getRelativePath(); final boolean isReadOnlyRequest = isGet(exchange.getRequestMethod()); final boolean isContainerResource = relativePath.endsWith("/containers/" + containerId); final boolean isScannerResource = relativePath.endsWith("/scanner"); final boolean isReleaseIdResource = relativePath.endsWith("/release-id"); if (!isReadOnlyRequest && (isContainerResource || isScannerResource || isReleaseIdResource)) { return true; } return false; }
DefaultRestrictionPolicy implements RestrictionPolicy { @Override public boolean restrictedEndpoint(final HttpServerExchange exchange, final String containerId) { final String relativePath = exchange.getRelativePath(); final boolean isReadOnlyRequest = isGet(exchange.getRequestMethod()); final boolean isContainerResource = relativePath.endsWith("/containers/" + containerId); final boolean isScannerResource = relativePath.endsWith("/scanner"); final boolean isReleaseIdResource = relativePath.endsWith("/release-id"); if (!isReadOnlyRequest && (isContainerResource || isScannerResource || isReleaseIdResource)) { return true; } return false; } }
DefaultRestrictionPolicy implements RestrictionPolicy { @Override public boolean restrictedEndpoint(final HttpServerExchange exchange, final String containerId) { final String relativePath = exchange.getRelativePath(); final boolean isReadOnlyRequest = isGet(exchange.getRequestMethod()); final boolean isContainerResource = relativePath.endsWith("/containers/" + containerId); final boolean isScannerResource = relativePath.endsWith("/scanner"); final boolean isReleaseIdResource = relativePath.endsWith("/release-id"); if (!isReadOnlyRequest && (isContainerResource || isScannerResource || isReleaseIdResource)) { return true; } return false; }  }
DefaultRestrictionPolicy implements RestrictionPolicy { @Override public boolean restrictedEndpoint(final HttpServerExchange exchange, final String containerId) { final String relativePath = exchange.getRelativePath(); final boolean isReadOnlyRequest = isGet(exchange.getRequestMethod()); final boolean isContainerResource = relativePath.endsWith("/containers/" + containerId); final boolean isScannerResource = relativePath.endsWith("/scanner"); final boolean isReleaseIdResource = relativePath.endsWith("/release-id"); if (!isReadOnlyRequest && (isContainerResource || isScannerResource || isReleaseIdResource)) { return true; } return false; }  @Override boolean restrictedEndpoint(final HttpServerExchange exchange,
                                      final String containerId); @Override String toString(); }
DefaultRestrictionPolicy implements RestrictionPolicy { @Override public boolean restrictedEndpoint(final HttpServerExchange exchange, final String containerId) { final String relativePath = exchange.getRelativePath(); final boolean isReadOnlyRequest = isGet(exchange.getRequestMethod()); final boolean isContainerResource = relativePath.endsWith("/containers/" + containerId); final boolean isScannerResource = relativePath.endsWith("/scanner"); final boolean isReleaseIdResource = relativePath.endsWith("/release-id"); if (!isReadOnlyRequest && (isContainerResource || isScannerResource || isReleaseIdResource)) { return true; } return false; }  @Override boolean restrictedEndpoint(final HttpServerExchange exchange,
                                      final String containerId); @Override String toString();  }