@Test public void shouldCreateWsResourceAddressWithDefaultBindAlternate() { ResourceAddressFactory addressFactory = newResourceAddressFactory(); addressFactorySpi.setResourceAddressFactory(addressFactory); ResourceAddress address = addressFactory.newResourceAddress(addressURI); assertEquals(URI.create(addressURI), address.getResource()); assertFalse(address.getOption(BIND_ALTERNATE)); }
@Override public void setResourceAddressFactory(ResourceAddressFactory addressFactory) { super.setResourceAddressFactory(addressFactory); Map<String, ResourceAddressFactorySpi<?>> alternateAddressFactories = addressFactory.getAlternateAddressFactories(getSchemeName()); alternateAddressFactories = new HashMap<>(alternateAddressFactories); List<ResourceFactory> alternateResourceFactories = new ArrayList<>(); for(String scheme : WS_ALTERNATE_SCHEMES) { if (alternateAddressFactories.get(scheme) != null) { alternateResourceFactories.add(changeSchemeOnly(scheme)); alternateAddressFactories.remove(scheme); } } for(String scheme : alternateAddressFactories.keySet()) { alternateResourceFactories.add(changeSchemeOnly(scheme)); } this.alternateResourceFactories = Collections.unmodifiableList(alternateResourceFactories); }
WsResourceAddressFactorySpi extends ResourceAddressFactorySpi<WsResourceAddress> { @Override public void setResourceAddressFactory(ResourceAddressFactory addressFactory) { super.setResourceAddressFactory(addressFactory); Map<String, ResourceAddressFactorySpi<?>> alternateAddressFactories = addressFactory.getAlternateAddressFactories(getSchemeName()); alternateAddressFactories = new HashMap<>(alternateAddressFactories); List<ResourceFactory> alternateResourceFactories = new ArrayList<>(); for(String scheme : WS_ALTERNATE_SCHEMES) { if (alternateAddressFactories.get(scheme) != null) { alternateResourceFactories.add(changeSchemeOnly(scheme)); alternateAddressFactories.remove(scheme); } } for(String scheme : alternateAddressFactories.keySet()) { alternateResourceFactories.add(changeSchemeOnly(scheme)); } this.alternateResourceFactories = Collections.unmodifiableList(alternateResourceFactories); } }
WsResourceAddressFactorySpi extends ResourceAddressFactorySpi<WsResourceAddress> { @Override public void setResourceAddressFactory(ResourceAddressFactory addressFactory) { super.setResourceAddressFactory(addressFactory); Map<String, ResourceAddressFactorySpi<?>> alternateAddressFactories = addressFactory.getAlternateAddressFactories(getSchemeName()); alternateAddressFactories = new HashMap<>(alternateAddressFactories); List<ResourceFactory> alternateResourceFactories = new ArrayList<>(); for(String scheme : WS_ALTERNATE_SCHEMES) { if (alternateAddressFactories.get(scheme) != null) { alternateResourceFactories.add(changeSchemeOnly(scheme)); alternateAddressFactories.remove(scheme); } } for(String scheme : alternateAddressFactories.keySet()) { alternateResourceFactories.add(changeSchemeOnly(scheme)); } this.alternateResourceFactories = Collections.unmodifiableList(alternateResourceFactories); }  }
WsResourceAddressFactorySpi extends ResourceAddressFactorySpi<WsResourceAddress> { @Override public void setResourceAddressFactory(ResourceAddressFactory addressFactory) { super.setResourceAddressFactory(addressFactory); Map<String, ResourceAddressFactorySpi<?>> alternateAddressFactories = addressFactory.getAlternateAddressFactories(getSchemeName()); alternateAddressFactories = new HashMap<>(alternateAddressFactories); List<ResourceFactory> alternateResourceFactories = new ArrayList<>(); for(String scheme : WS_ALTERNATE_SCHEMES) { if (alternateAddressFactories.get(scheme) != null) { alternateResourceFactories.add(changeSchemeOnly(scheme)); alternateAddressFactories.remove(scheme); } } for(String scheme : alternateAddressFactories.keySet()) { alternateResourceFactories.add(changeSchemeOnly(scheme)); } this.alternateResourceFactories = Collections.unmodifiableList(alternateResourceFactories); }  @Override String getSchemeName(); @Override void setResourceAddressFactory(ResourceAddressFactory addressFactory); }
WsResourceAddressFactorySpi extends ResourceAddressFactorySpi<WsResourceAddress> { @Override public void setResourceAddressFactory(ResourceAddressFactory addressFactory) { super.setResourceAddressFactory(addressFactory); Map<String, ResourceAddressFactorySpi<?>> alternateAddressFactories = addressFactory.getAlternateAddressFactories(getSchemeName()); alternateAddressFactories = new HashMap<>(alternateAddressFactories); List<ResourceFactory> alternateResourceFactories = new ArrayList<>(); for(String scheme : WS_ALTERNATE_SCHEMES) { if (alternateAddressFactories.get(scheme) != null) { alternateResourceFactories.add(changeSchemeOnly(scheme)); alternateAddressFactories.remove(scheme); } } for(String scheme : alternateAddressFactories.keySet()) { alternateResourceFactories.add(changeSchemeOnly(scheme)); } this.alternateResourceFactories = Collections.unmodifiableList(alternateResourceFactories); }  @Override String getSchemeName(); @Override void setResourceAddressFactory(ResourceAddressFactory addressFactory);  }