@Test(expected = IllegalArgumentException.class) public void shouldNotBindOnNonWsAddress() throws Exception { String uri = "http: ResourceAddress address = resourceAddressFactory.newResourceAddress(uri); final IoHandlerAdapter<IoSession> acceptHandler = new IoHandlerAdapter<IoSession>() { }; wsAcceptor.bind(address, acceptHandler, null); }
@Override public void bind(ResourceAddress address, IoHandler handler, BridgeSessionInitializer<? extends IoFuture> initializer) { URI location = address.getResource(); String schemeName = location.getScheme(); if (!canBind(schemeName)) { throw new IllegalArgumentException(format("Unexpected scheme \"%s\" for URI: %s", schemeName, location)); } do { BridgeAcceptor bridgeAcceptor = selectWsAcceptor(address); if ( bridgeAcceptor != null ) { bridgeAcceptor.bind(address, handler, initializer); } else { if (logger.isDebugEnabled()) { String format = "No bridge acceptor found for address '%s'. Is the %s transport enabled?"; logger.warn(format(format, address.getExternalURI(), URIUtils.getScheme(address.getExternalURI()))); } } address = address.getOption(ALTERNATE); } while (address != null); }
WsAcceptor implements BridgeAcceptor { @Override public void bind(ResourceAddress address, IoHandler handler, BridgeSessionInitializer<? extends IoFuture> initializer) { URI location = address.getResource(); String schemeName = location.getScheme(); if (!canBind(schemeName)) { throw new IllegalArgumentException(format("Unexpected scheme \"%s\" for URI: %s", schemeName, location)); } do { BridgeAcceptor bridgeAcceptor = selectWsAcceptor(address); if ( bridgeAcceptor != null ) { bridgeAcceptor.bind(address, handler, initializer); } else { if (logger.isDebugEnabled()) { String format = "No bridge acceptor found for address '%s'. Is the %s transport enabled?"; logger.warn(format(format, address.getExternalURI(), URIUtils.getScheme(address.getExternalURI()))); } } address = address.getOption(ALTERNATE); } while (address != null); } }
WsAcceptor implements BridgeAcceptor { @Override public void bind(ResourceAddress address, IoHandler handler, BridgeSessionInitializer<? extends IoFuture> initializer) { URI location = address.getResource(); String schemeName = location.getScheme(); if (!canBind(schemeName)) { throw new IllegalArgumentException(format("Unexpected scheme \"%s\" for URI: %s", schemeName, location)); } do { BridgeAcceptor bridgeAcceptor = selectWsAcceptor(address); if ( bridgeAcceptor != null ) { bridgeAcceptor.bind(address, handler, initializer); } else { if (logger.isDebugEnabled()) { String format = "No bridge acceptor found for address '%s'. Is the %s transport enabled?"; logger.warn(format(format, address.getExternalURI(), URIUtils.getScheme(address.getExternalURI()))); } } address = address.getOption(ALTERNATE); } while (address != null); } WsAcceptor(WebSocketExtensionFactory extensionFactory); }
WsAcceptor implements BridgeAcceptor { @Override public void bind(ResourceAddress address, IoHandler handler, BridgeSessionInitializer<? extends IoFuture> initializer) { URI location = address.getResource(); String schemeName = location.getScheme(); if (!canBind(schemeName)) { throw new IllegalArgumentException(format("Unexpected scheme \"%s\" for URI: %s", schemeName, location)); } do { BridgeAcceptor bridgeAcceptor = selectWsAcceptor(address); if ( bridgeAcceptor != null ) { bridgeAcceptor.bind(address, handler, initializer); } else { if (logger.isDebugEnabled()) { String format = "No bridge acceptor found for address '%s'. Is the %s transport enabled?"; logger.warn(format(format, address.getExternalURI(), URIUtils.getScheme(address.getExternalURI()))); } } address = address.getOption(ALTERNATE); } while (address != null); } WsAcceptor(WebSocketExtensionFactory extensionFactory); @Resource(name = "configuration") void setConfiguration(Properties configuration); @Resource(name = "wseb.acceptor") void setWsebAcceptor(BridgeAcceptor wsebAcceptor); @Resource(name = "wsn.acceptor") void setWsnAcceptor(BridgeAcceptor wsnAcceptor); @Override void bind(ResourceAddress address,
                     IoHandler handler,
                     BridgeSessionInitializer<? extends IoFuture> initializer); @Override UnbindFuture unbind(ResourceAddress address); @Override IoHandler getHandler(ResourceAddress address); @Override void dispose(); WebSocketExtensionFactory getWebSocketExtensionFactory(); }
WsAcceptor implements BridgeAcceptor { @Override public void bind(ResourceAddress address, IoHandler handler, BridgeSessionInitializer<? extends IoFuture> initializer) { URI location = address.getResource(); String schemeName = location.getScheme(); if (!canBind(schemeName)) { throw new IllegalArgumentException(format("Unexpected scheme \"%s\" for URI: %s", schemeName, location)); } do { BridgeAcceptor bridgeAcceptor = selectWsAcceptor(address); if ( bridgeAcceptor != null ) { bridgeAcceptor.bind(address, handler, initializer); } else { if (logger.isDebugEnabled()) { String format = "No bridge acceptor found for address '%s'. Is the %s transport enabled?"; logger.warn(format(format, address.getExternalURI(), URIUtils.getScheme(address.getExternalURI()))); } } address = address.getOption(ALTERNATE); } while (address != null); } WsAcceptor(WebSocketExtensionFactory extensionFactory); @Resource(name = "configuration") void setConfiguration(Properties configuration); @Resource(name = "wseb.acceptor") void setWsebAcceptor(BridgeAcceptor wsebAcceptor); @Resource(name = "wsn.acceptor") void setWsnAcceptor(BridgeAcceptor wsnAcceptor); @Override void bind(ResourceAddress address,
                     IoHandler handler,
                     BridgeSessionInitializer<? extends IoFuture> initializer); @Override UnbindFuture unbind(ResourceAddress address); @Override IoHandler getHandler(ResourceAddress address); @Override void dispose(); WebSocketExtensionFactory getWebSocketExtensionFactory(); static final String CLOSE_FILTER; static final IoHandler API_PATH_HANDLER; }