@Test public void testBindPutLogic() throws Exception { String bindUri = "http: ResourceAddress bindAddress = addressFactory.newResourceAddress(bindUri, makeOpts()); Bindings.Binding binding = new Bindings.Binding(bindAddress, new IoHandlerAdapter()); Bindings.Binding oldBinding = httpBindings.addBinding(binding); assertNull(oldBinding); ResourceAddress bindAddress2 = addressFactory.newResourceAddress(bindUri, makeOpts()); Bindings.Binding binding2 = new Bindings.Binding(bindAddress2, binding.handler()); oldBinding = httpBindings.addBinding(binding2); assertNull(oldBinding); String fooBindUri = "http: ResourceAddress fooBindAddress = addressFactory.newResourceAddress(fooBindUri, makeOpts()); Bindings.Binding fooBinding = new Bindings.Binding(fooBindAddress, new IoHandlerAdapter()); oldBinding = httpBindings.addBinding(fooBinding); assertNull(oldBinding); Bindings.Binding fooBinding2 = new Bindings.Binding(fooBindAddress, new IoHandlerAdapter()); oldBinding = httpBindings.addBinding(fooBinding2); assertNotNull(oldBinding); String wsFooBindUri = "ws: ResourceAddress wsFooBindAddress = addressFactory.newResourceAddress(wsFooBindUri); Bindings.Binding wsFooBinding = new Bindings.Binding(wsFooBindAddress, new IoHandlerAdapter()); oldBinding = httpBindings.addBinding(wsFooBinding); assertNotSame(oldBinding, fooBinding); }
@Override public Binding addBinding(Binding newBinding) { ResourceAddress bindAddress = newBinding.bindAddress(); HttpBinding httpBinding = getBinding0(bindAddress); if (httpBinding == null) { HttpBinding newHttpBinding = new HttpBinding(bindAddress); httpBinding = bindAdditionalAddressesIfNecessary(newHttpBinding); if (httpBinding == null) { httpBinding = newHttpBinding; } } URI location = bindAddress.getResource(); String path = location.getPath(); Binding binding = httpBinding.put(path, newBinding); if (binding != null) { if (equivalent(newBinding, binding)) { binding.incrementReferenceCount(); binding = null; } } else { newBinding.incrementReferenceCount(); } return binding; }
HttpBindings extends Bindings<HttpBinding> { @Override public Binding addBinding(Binding newBinding) { ResourceAddress bindAddress = newBinding.bindAddress(); HttpBinding httpBinding = getBinding0(bindAddress); if (httpBinding == null) { HttpBinding newHttpBinding = new HttpBinding(bindAddress); httpBinding = bindAdditionalAddressesIfNecessary(newHttpBinding); if (httpBinding == null) { httpBinding = newHttpBinding; } } URI location = bindAddress.getResource(); String path = location.getPath(); Binding binding = httpBinding.put(path, newBinding); if (binding != null) { if (equivalent(newBinding, binding)) { binding.incrementReferenceCount(); binding = null; } } else { newBinding.incrementReferenceCount(); } return binding; } }
HttpBindings extends Bindings<HttpBinding> { @Override public Binding addBinding(Binding newBinding) { ResourceAddress bindAddress = newBinding.bindAddress(); HttpBinding httpBinding = getBinding0(bindAddress); if (httpBinding == null) { HttpBinding newHttpBinding = new HttpBinding(bindAddress); httpBinding = bindAdditionalAddressesIfNecessary(newHttpBinding); if (httpBinding == null) { httpBinding = newHttpBinding; } } URI location = bindAddress.getResource(); String path = location.getPath(); Binding binding = httpBinding.put(path, newBinding); if (binding != null) { if (equivalent(newBinding, binding)) { binding.incrementReferenceCount(); binding = null; } } else { newBinding.incrementReferenceCount(); } return binding; } HttpBindings(); }
HttpBindings extends Bindings<HttpBinding> { @Override public Binding addBinding(Binding newBinding) { ResourceAddress bindAddress = newBinding.bindAddress(); HttpBinding httpBinding = getBinding0(bindAddress); if (httpBinding == null) { HttpBinding newHttpBinding = new HttpBinding(bindAddress); httpBinding = bindAdditionalAddressesIfNecessary(newHttpBinding); if (httpBinding == null) { httpBinding = newHttpBinding; } } URI location = bindAddress.getResource(); String path = location.getPath(); Binding binding = httpBinding.put(path, newBinding); if (binding != null) { if (equivalent(newBinding, binding)) { binding.incrementReferenceCount(); binding = null; } } else { newBinding.incrementReferenceCount(); } return binding; } HttpBindings(); @Override Binding addBinding(Binding newBinding); @Override Binding getBinding(ResourceAddress address); @Override boolean removeBinding(ResourceAddress address, Binding oldBinding); String toString(); }
HttpBindings extends Bindings<HttpBinding> { @Override public Binding addBinding(Binding newBinding) { ResourceAddress bindAddress = newBinding.bindAddress(); HttpBinding httpBinding = getBinding0(bindAddress); if (httpBinding == null) { HttpBinding newHttpBinding = new HttpBinding(bindAddress); httpBinding = bindAdditionalAddressesIfNecessary(newHttpBinding); if (httpBinding == null) { httpBinding = newHttpBinding; } } URI location = bindAddress.getResource(); String path = location.getPath(); Binding binding = httpBinding.put(path, newBinding); if (binding != null) { if (equivalent(newBinding, binding)) { binding.incrementReferenceCount(); binding = null; } } else { newBinding.incrementReferenceCount(); } return binding; } HttpBindings(); @Override Binding addBinding(Binding newBinding); @Override Binding getBinding(ResourceAddress address); @Override boolean removeBinding(ResourceAddress address, Binding oldBinding); String toString();  }