@Test public void testUriStrip() { String[][] textMatrix = { { "/service/v1.2", "/service/v1"}, { "/service/V1.2", "/service/V1"}, { "/service/v1.0/foo", "/service/v1/foo" }, { "/service/v1/foo", "/service/v1/foo" }, { "/service/v20.3/foo", "/service/v20/foo"}, { "/v1/foo", "/v1/foo"}, { "/v20.3/foo", "/v20/foo"}, { "/service/v1.3/foo?action=add&sky=blue", "/service/v1/foo?action=add&sky=blue"} }; for (String[] pair : textMatrix) { assertEquals(pair[1], commandProcessor.stripMinorVersionFromUri(pair[0])); } }
protected String stripMinorVersionFromUri(String uri) { Matcher m = VERSION_REMOVAL_PATTERN.matcher(uri); if (m.matches()) { StringBuilder sb = new StringBuilder(); sb.append(m.group(1)); String group2 = m.group(2); if (group2 != null && group2.length() > 0) { sb.append(m.group(2)); } return sb.toString(); } else { LOGGER.warn("Unable to remove minor version from URI: [" + uri + "], returning unmodified"); return uri; } }
AbstractHttpCommandProcessor extends
		AbstractCommandProcessor<HttpCommand> implements HttpCommandProcessor,
		GateListener { protected String stripMinorVersionFromUri(String uri) { Matcher m = VERSION_REMOVAL_PATTERN.matcher(uri); if (m.matches()) { StringBuilder sb = new StringBuilder(); sb.append(m.group(1)); String group2 = m.group(2); if (group2 != null && group2.length() > 0) { sb.append(m.group(2)); } return sb.toString(); } else { LOGGER.warn("Unable to remove minor version from URI: [" + uri + "], returning unmodified"); return uri; } } }
AbstractHttpCommandProcessor extends
		AbstractCommandProcessor<HttpCommand> implements HttpCommandProcessor,
		GateListener { protected String stripMinorVersionFromUri(String uri) { Matcher m = VERSION_REMOVAL_PATTERN.matcher(uri); if (m.matches()) { StringBuilder sb = new StringBuilder(); sb.append(m.group(1)); String group2 = m.group(2); if (group2 != null && group2.length() > 0) { sb.append(m.group(2)); } return sb.toString(); } else { LOGGER.warn("Unable to remove minor version from URI: [" + uri + "], returning unmodified"); return uri; } } protected  AbstractHttpCommandProcessor(Protocol protocol, DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); }
AbstractHttpCommandProcessor extends
		AbstractCommandProcessor<HttpCommand> implements HttpCommandProcessor,
		GateListener { protected String stripMinorVersionFromUri(String uri) { Matcher m = VERSION_REMOVAL_PATTERN.matcher(uri); if (m.matches()) { StringBuilder sb = new StringBuilder(); sb.append(m.group(1)); String group2 = m.group(2); if (group2 != null && group2.length() > 0) { sb.append(m.group(2)); } return sb.toString(); } else { LOGGER.warn("Unable to remove minor version from URI: [" + uri + "], returning unmodified"); return uri; } } protected  AbstractHttpCommandProcessor(Protocol protocol, DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); void setStartingGate(CougarStartingGate startingGate); void setRequestLogger(RequestLogger requestLogger); @ManagedAttribute boolean isHardFailEnumDeserialisation(); void setHardFailEnumDeserialisation(boolean hardFailEnumDeserialisation); @Override @ManagedAttribute String getName(); void setName(String name); @Override @ManagedAttribute int getPriority(); void setPriority(int priority); @Override void bind(ServiceBindingDescriptor bindingDescriptor); void writeIdentity(List<IdentityToken> tokens, IdentityTokenIOAdapter ioAdapter); ContentTypeNormaliser getContentTypeNormaliser(); void setContentTypeNormaliser(ContentTypeNormaliser contentTypeNormaliser); void setValidatorRegistry(CommandValidatorRegistry<HttpCommand> validatorRegistry); @ManagedAttribute long getMaxPostBodyLength(); void setMaxPostBodyLength(long maxPostBodyLength); }
AbstractHttpCommandProcessor extends
		AbstractCommandProcessor<HttpCommand> implements HttpCommandProcessor,
		GateListener { protected String stripMinorVersionFromUri(String uri) { Matcher m = VERSION_REMOVAL_PATTERN.matcher(uri); if (m.matches()) { StringBuilder sb = new StringBuilder(); sb.append(m.group(1)); String group2 = m.group(2); if (group2 != null && group2.length() > 0) { sb.append(m.group(2)); } return sb.toString(); } else { LOGGER.warn("Unable to remove minor version from URI: [" + uri + "], returning unmodified"); return uri; } } protected  AbstractHttpCommandProcessor(Protocol protocol, DehydratedExecutionContextResolution contextResolution, String requestTimeoutHeader); void setStartingGate(CougarStartingGate startingGate); void setRequestLogger(RequestLogger requestLogger); @ManagedAttribute boolean isHardFailEnumDeserialisation(); void setHardFailEnumDeserialisation(boolean hardFailEnumDeserialisation); @Override @ManagedAttribute String getName(); void setName(String name); @Override @ManagedAttribute int getPriority(); void setPriority(int priority); @Override void bind(ServiceBindingDescriptor bindingDescriptor); void writeIdentity(List<IdentityToken> tokens, IdentityTokenIOAdapter ioAdapter); ContentTypeNormaliser getContentTypeNormaliser(); void setContentTypeNormaliser(ContentTypeNormaliser contentTypeNormaliser); void setValidatorRegistry(CommandValidatorRegistry<HttpCommand> validatorRegistry); @ManagedAttribute long getMaxPostBodyLength(); void setMaxPostBodyLength(long maxPostBodyLength);  }