private InetSocketAddress parseBindAddress(Object bindAddress) { if (bindAddress instanceof InetSocketAddress) { return (InetSocketAddress) bindAddress; } else if (bindAddress instanceof String) { return ResolutionUtils.parseBindAddress((String) bindAddress); } throw new IllegalArgumentException(BIND_ADDRESS.name()); }
private InetSocketAddress parseBindAddress(Object bindAddress) { if (bindAddress instanceof InetSocketAddress) { return (InetSocketAddress) bindAddress; } else if (bindAddress instanceof String) { return ResolutionUtils.parseBindAddress((String) bindAddress); } throw new IllegalArgumentException(BIND_ADDRESS.name()); }
/** * These options are removed and set in {@link #parseNamedOptions(java.net.URI, ResourceOptions, java.util.Map } * above, so we need to include them in the new options by name map used for alternate construction. */ @SuppressWarnings("JavadocReference") protected Map<String, Object> getNewOptionsByName(ResourceOptions options, Map<String, Object> optionsByName) { Map<String,Object> clonedOptionsByName = new HashMap<>(optionsByName); clonedOptionsByName.put(NEXT_PROTOCOL.name(), options.getOption(NEXT_PROTOCOL)); clonedOptionsByName.put(QUALIFIER.name(), options.getOption(QUALIFIER)); clonedOptionsByName.put(TRANSPORT_URI.name(), options.getOption(TRANSPORT_URI)); clonedOptionsByName.put(BIND_ALTERNATE.name(), options.getOption(BIND_ALTERNATE)); clonedOptionsByName.put(RESOLVER.name(), options.getOption(RESOLVER)); return clonedOptionsByName; }
@SuppressWarnings("unchecked") protected T newResourceAddressWithAlternate(String location, Map<String, Object> optionsByName, ResourceAddress alternateAddress) { optionsByName.put(ALTERNATE.name(), alternateAddress); return (T) getResourceAddressFactory().newResourceAddress(location, optionsByName); }
@Override protected void parseNamedOptions0(String location, ResourceOptions options, Map<String, Object> optionsByName) { Object bindAddress = optionsByName.remove(BIND_ADDRESS.name()); if (bindAddress != null) { InetSocketAddress bindAddress0 = parseBindAddress(bindAddress); options.setOption(BIND_ADDRESS, bindAddress0); } Long maximumOutboundRate = (Long) optionsByName.remove(MAXIMUM_OUTBOUND_RATE.name()); if (maximumOutboundRate != null) { options.setOption(MAXIMUM_OUTBOUND_RATE, maximumOutboundRate); } String realm = (String) optionsByName.remove(REALM.name()); if (realm != null) { options.setOption(REALM, realm); } LoginContextFactory loginContextFactory = (LoginContextFactory) optionsByName.remove(LOGIN_CONTEXT_FACTORY.name()); if (loginContextFactory != null) { options.setOption(LOGIN_CONTEXT_FACTORY, loginContextFactory); } }
@Override protected void parseNamedOptions0(String location, ResourceOptions options, Map<String, Object> optionsByName) { Object bindAddress = optionsByName.remove(BIND_ADDRESS.name()); if (bindAddress != null) { InetSocketAddress bindAddress0 = parseBindAddress(bindAddress); options.setOption(BIND_ADDRESS, bindAddress0); } Long maximumOutboundRate = (Long) optionsByName.remove(MAXIMUM_OUTBOUND_RATE.name()); if (maximumOutboundRate != null) { options.setOption(MAXIMUM_OUTBOUND_RATE, maximumOutboundRate); } String udpInterface = (String) optionsByName.remove(INTERFACE.name()); if (udpInterface != null) { options.setOption(INTERFACE, udpInterface); } Integer align = (Integer) optionsByName.remove(PADDING_ALIGNMENT.name()); if (align != null) { options.setOption(PADDING_ALIGNMENT, align); } }
Boolean codecRequired = (Boolean) optionsByName.remove(CODEC_REQUIRED.name()); if (codecRequired != null) { options.setOption(CODEC_REQUIRED, codecRequired); Boolean lightweight = (Boolean) optionsByName.remove(LIGHTWEIGHT.name()); if (lightweight != null) { options.setOption(LIGHTWEIGHT, lightweight); Integer maxMessageSize = (Integer) optionsByName.remove(MAX_MESSAGE_SIZE.name()); if (maxMessageSize != null) { options.setOption(MAX_MESSAGE_SIZE, maxMessageSize); Long inactivityTimeout = (Long) optionsByName.remove(INACTIVITY_TIMEOUT.name()); if (inactivityTimeout != null) { options.setOption(INACTIVITY_TIMEOUT, inactivityTimeout); String[] supportedProtocols = (String[]) optionsByName.remove(SUPPORTED_PROTOCOLS.name()); if (supportedProtocols != null) { options.setOption(SUPPORTED_PROTOCOLS, supportedProtocols); String[] requiredProtocols = (String[]) optionsByName.remove(REQUIRED_PROTOCOLS.name()); if (requiredProtocols != null) { options.setOption(REQUIRED_PROTOCOLS, requiredProtocols);
@Override protected void parseNamedOptions0(String location, ResourceOptions options, Map<String, Object> optionsByName) { Object ciphers = optionsByName.remove(CIPHERS.name()); if (ciphers instanceof String) { options.setOption(CIPHERS, SslCipherSuites.resolveCSV((String) ciphers)); Boolean encryption = (Boolean) optionsByName.remove(ENCRYPTION_ENABLED.name()); if (encryption != null) { options.setOption(ENCRYPTION_ENABLED, encryption); Boolean wantClientAuth = (Boolean) optionsByName.remove(WANT_CLIENT_AUTH.name()); if (wantClientAuth != null) { options.setOption(WANT_CLIENT_AUTH, wantClientAuth); Boolean needClientAuth = (Boolean) optionsByName.remove(NEED_CLIENT_AUTH.name()); if (needClientAuth != null) { options.setOption(NEED_CLIENT_AUTH, needClientAuth); KeySelector keySelector = (KeySelector) optionsByName.remove(KEY_SELECTOR.name()); if (keySelector != null) { options.setOption(KEY_SELECTOR, keySelector); String[] protocols = (String[]) optionsByName.remove(PROTOCOLS.name()); if ( protocols != null ) { options.setOption(PROTOCOLS, protocols);
String nextProtocol = (String) optionsByName.remove(NEXT_PROTOCOL.name()); if (nextProtocol != null) { options.setOption(NEXT_PROTOCOL, nextProtocol); Object qualifier = optionsByName.remove(QUALIFIER.name()); if (qualifier != null) { options.setOption(QUALIFIER, qualifier); String transportURI = (String) optionsByName.remove(TRANSPORT.name()); if (transportURI == null) { ResourceFactory factory = getTransportFactory(); ResourceAddress alternate = (ResourceAddress) optionsByName.remove(ALTERNATE.name()); if (alternate != null) { options.setOption(ALTERNATE, alternate); NameResolver resolver = (NameResolver) optionsByName.remove(RESOLVER.name()); if (resolver != null) { options.setOption(RESOLVER, resolver); Boolean bindAlternate = (Boolean) optionsByName.remove(BIND_ALTERNATE.name()); if (bindAlternate != null) { options.setOption(BIND_ALTERNATE, bindAlternate); URI transportedURI = (URI) optionsByName.remove(TRANSPORTED_URI.name()); if (transportedURI != null) { options.setOption(TRANSPORTED_URI, transportedURI); optionsByName.put(TRANSPORTED_URI.name(), locationURI);
Boolean keepAlive = (Boolean) optionsByName.remove(KEEP_ALIVE.name()); if (keepAlive != null) { options.setOption(KEEP_ALIVE, keepAlive); Object maxRedirects = optionsByName.remove(MAXIMUM_REDIRECTS.name()); if (maxRedirects != null) { options.setOption(MAXIMUM_REDIRECTS, maxRedirects instanceof String ? Integer.parseInt((String) maxRedirects) : (Integer) maxRedirects); Integer keepAliveTimeout = (Integer) optionsByName.remove(KEEP_ALIVE_TIMEOUT.name()); if (keepAliveTimeout != null) { options.setOption(KEEP_ALIVE_TIMEOUT, keepAliveTimeout); Integer keepAliveConnections = (Integer) optionsByName.remove(KEEP_ALIVE_CONNECTIONS.name()); if (keepAliveConnections != null) { options.setOption(KEEP_ALIVE_CONNECTIONS, keepAliveConnections); String[] requiredRoles = (String[]) optionsByName.remove(REQUIRED_ROLES.name()); if (requiredRoles != null) { options.setOption(REQUIRED_ROLES, requiredRoles); String authenticationConnect = (String) optionsByName.remove(AUTHENTICATION_CONNECT.name()); if (authenticationConnect != null) { options.setOption(AUTHENTICATION_CONNECT, authenticationConnect); String authenticationIdentifier = (String) optionsByName.remove(AUTHENTICATION_IDENTIFIER.name()); if (authenticationIdentifier != null) { options.setOption(AUTHENTICATION_IDENTIFIER, authenticationIdentifier); String encryptionKeyAlias = (String) optionsByName.remove(ENCRYPTION_KEY_ALIAS.name());