@Override public String getServiceName() { String name = serviceContext.getServiceName(); return name == null ? "" : name; }
@Override public String getServiceName() { return serviceContext.getServiceName(); } }
public MonitoredServiceImpl(ServiceContext serviceContext) { this.serviceName = serviceContext.getServiceName(); }
private void validateProperties(ServiceContext serviceContext) { ServiceProperties properties = serviceContext.getProperties(); // validate all properties: rewrite-cookie-domain, rewrite-cookie-path, rewrite-location Iterable<String> simpleProperties = properties.simplePropertyNames(); Set<String> unknownProperties = StreamSupport.stream(simpleProperties.spliterator(), false) .filter(p -> !KNOWN_SIMPLE_PROPERTIES.contains(p)) .collect(Collectors.toSet()); Iterable<String> nestedProperties = properties.nestedPropertyNames(); StreamSupport.stream(nestedProperties.spliterator(), false) .filter(p -> !KNOWN_NESTED_PROPERTIES.contains(p)) .forEach(unknownProperties::add); if (!unknownProperties.isEmpty()) { throw new IllegalArgumentException(serviceContext.getServiceName() + " http.proxy service specifies unknown properties : " + unknownProperties); } }
private void checkForTrailingSlashes(ServiceContext serviceContext) { Collection<String> acceptURIs = serviceContext.getAccepts(); Collection<String> connectURIs = serviceContext.getConnects(); assert acceptURIs.size() == 1; assert connectURIs.size() == 1; String acceptURI = acceptURIs.iterator().next(); String connectURI = connectURIs.iterator().next(); String acceptPath = URIUtils.getPath(acceptURI); String connectPath = URIUtils.getPath(connectURI); boolean acceptPathIsSlash = acceptPath.endsWith("/"); boolean connectPathIsSlash = connectPath.endsWith("/"); if (!acceptPathIsSlash) { String msg = String.format("The path %s of accept URI %s for service %s needs to end with /", acceptPath, acceptURI, serviceContext.getServiceName()); throw new IllegalArgumentException(msg); } if (!connectPathIsSlash) { String msg = String.format("The path %s of connect URI %s for service %s needs to end with /", connectPath, connectURI, serviceContext.getServiceName()); throw new IllegalArgumentException(msg); } }
void init() { ServiceContext serviceContext = getServiceContext(); serviceName = serviceContext.getServiceName(); throw new IllegalArgumentException(serviceContext.getServiceName() + " http.proxy service specifies unknown property value : " + useForwarded + " for use-forwarded");