/** * Creates a new resource address for the given location and options * * @param options cannot be null, otherwise NullPointerException is thrown * @return resource address */ public ResourceAddress newResourceAddress(String location, ResourceOptions options) { return newResourceAddress(location, options, null /* qualifier */); }
private ResourceAddress newResourceAddress(InetSocketAddress inetSocketAddress, final String transportName) { InetAddress inetAddress = inetSocketAddress.getAddress(); String hostAddress = inetAddress.getHostAddress(); String addressFormat = (inetAddress instanceof Inet6Address) ? "%s://[%s]:%s" : "%s://%s:%s"; int port = inetSocketAddress.getPort(); String transport = format(addressFormat, transportName, hostAddress, port); return addressFactory.newResourceAddress(transport); } }
private ResourceAddress newResourceAddress(NamedPipeAddress namedPipeAddress, final String transportName, String nextProtocol) { String addressFormat = "%s://%s"; String pipeName = namedPipeAddress.getPipeName(); String transport = format(addressFormat, transportName, pipeName); return resourceAddressFactory.newResourceAddress(transport, nextProtocol); }
private ResourceAddress newResourceAddress(NamedPipeAddress namedPipeAddress, final String transportName) { String addressFormat = "%s://%s"; String pipeName = namedPipeAddress.getPipeName(); String transport = format(addressFormat, transportName, pipeName); return addressFactory.newResourceAddress(transport); }
protected ResourceAddress createResourceAddress(InetSocketAddress inetSocketAddress) { String transport = asResourceURI(inetSocketAddress); return resourceAddressFactory.newResourceAddress(transport); }
private ResourceAddress createResourceAddress(InetSocketAddress inetSocketAddress, String nextProtocol) { String transportName = getTransportName(); InetAddress inetAddress = inetSocketAddress.getAddress(); String hostAddress = inetAddress.getHostAddress(); String addressFormat = (inetAddress instanceof Inet6Address) ? "%s://[%s]:%s" : "%s://%s:%s"; int port = inetSocketAddress.getPort(); String transport = format(addressFormat, transportName, hostAddress, port); return addressFactory.newResourceAddress(transport, nextProtocol); }
private ResourceAddress createResourceAddress(InetSocketAddress inetSocketAddress, String nextProtocol) { String transportName = getTransportName(); InetAddress inetAddress = inetSocketAddress.getAddress(); String hostAddress = inetAddress.getHostAddress(); String addressFormat = (inetAddress instanceof Inet6Address) ? "%s://[%s]:%s" : "%s://%s:%s"; int port = inetSocketAddress.getPort(); String transport = format(addressFormat, transportName, hostAddress, port); return resourceAddressFactory.newResourceAddress(transport, nextProtocol); } });
public ResourceAddress newResourceAddress(String location, String nextProtocol) { if (nextProtocol != null) { ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(NEXT_PROTOCOL, nextProtocol); return newResourceAddress(location, options); } else { return newResourceAddress(location); } }
private ResourceAddress createResourceAddress(NamedPipeAddress namedPipeAddress, String nextProtocol) { String transportName = getTransportName(); String addressFormat = "%s://%s"; String pipeName = namedPipeAddress.getPipeName(); String transport = format(addressFormat, transportName, pipeName); return addressFactory.newResourceAddress(transport, nextProtocol); }
private ResourceAddress createResourceAddress(NamedPipeAddress namedPipeAddress, String nextProtocol) { String transportName = getTransportName(); String addressFormat = "%s://%s"; String pipeName = namedPipeAddress.getPipeName(); String transport = format(addressFormat, transportName, pipeName); return resourceAddressFactory.newResourceAddress(transport, nextProtocol); }
@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 public void unbindConnectsIfNecessary(Collection<String> connectURIs) { for (String connectURI : connectURIs) { // TODO: services should bind ResourceAddress directly, rather than passing URIs here Map<String, Object> connectOptions = buildResourceAddressOptions(connectURI, connectOptionsContext); ResourceAddress connectAddress = resourceAddressFactory.newResourceAddress(connectURI, connectOptions); unbindConnectIfNecessary(connectAddress); } }
private ResourceAddress createResourceAddress(MulticastAddress multicastAddress, String nextProtocol) { String transportName = getTransportName(); InetAddress inetAddress = multicastAddress.getGroupAddress(); String hostAddress = inetAddress.getHostAddress(); String addressFormat = (inetAddress instanceof Inet6Address) ? "%s://[%s]:%s" : "%s://%s:%s"; int port = multicastAddress.getBindPort(); String transport = format(addressFormat, transportName, hostAddress, port); return resourceAddressFactory.newResourceAddress(transport, nextProtocol); }
@Override protected void setAlternateOption(String location, ResourceOptions options, Map<String, Object> optionsByName) { // Creating alternate SseResourceAddres with httpxe tranport location = SSE_HTTPXE_RESOURCE_FACTORY.createURI(location); // copying optionsByName to so that the alternate address has its own to work with optionsByName = new HashMap<>(optionsByName); ResourceAddress alternateAddress = getResourceAddressFactory().newResourceAddress(location, optionsByName); options.setOption(ResourceAddress.ALTERNATE, alternateAddress); }
private ResourceAddress createWriteAddress(URI writeUri, HttpSession transport, WsebSession wsebSession) { ResourceAddress httpxeAddress = REMOTE_ADDRESS.get(transport); ResourceAddress writeAddress = httpxeAddress.resolve(writeUri.getPath()); String writeSessionIdentity = format("%s#%su", getTransportMetadata().getName(), wsebSession.getId()); IdentityResolver resolver = new FixedIdentityResolver(writeSessionIdentity); ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(writeAddress); options.setOption(ResourceAddress.IDENTITY_RESOLVER, resolver); return resourceAddressFactory.newResourceAddress(URIUtils.uriToString(writeAddress.getResource()), options); }
private ResourceAddress httpAddressNoSecurity(ResourceAddress httpAddress, ResourceAddress httpxeAddressNoSecurity, IdentityResolver resolver) { ResourceOptions noSecurityOptions = new NoSecurityResourceOptions(httpAddress); noSecurityOptions.setOption(ALTERNATE, httpxeAddressNoSecurity); noSecurityOptions.setOption(ResourceAddress.IDENTITY_RESOLVER, resolver); noSecurityOptions.setOption(HttpResourceAddress.REALMS, new HttpRealmInfo[0]); return resourceAddressFactory.newResourceAddress(httpAddress.getExternalURI(), noSecurityOptions, httpAddress.getOption(ResourceAddress.QUALIFIER)); }
private ResourceAddress createCookiesAddress(ResourceAddress httpAddress) { // /;e/cookies is a terminal endpoint so next protocol should == null ResourceOptions cookieOptions = ResourceOptions.FACTORY.newResourceOptions(httpAddress); cookieOptions.setOption(NEXT_PROTOCOL, null); cookieOptions.setOption(TRANSPORT, httpAddress.getTransport()); cookieOptions.setOption(BIND_ALTERNATE, Boolean.FALSE); URI cookiesLocation = appendURI(httpAddress.getResource(), COOKIES_SUFFIX); return resourceAddressFactory.newResourceAddress(URIUtils.uriToString(cookiesLocation), cookieOptions); }
private ResourceAddress createApiHttpAddress(ResourceAddress httpTransport) { String path = URIUtils.getPath(appendURI(ensureTrailingSlash(httpTransport.getExternalURI()), HttpProtocolCompatibilityFilter.API_PATH)); String httpLocation = modifyURIPath(httpTransport.getExternalURI(), path); ResourceOptions httpOptions = ResourceOptions.FACTORY.newResourceOptions(httpTransport); httpOptions.setOption(NEXT_PROTOCOL, null); // terminal endpoint, so next protocol null httpOptions.setOption(ALTERNATE, null); return resourceAddressFactory.newResourceAddress(httpLocation, httpOptions); }
private ResourceAddress createApiHttpxeAddress(ResourceAddress httpxeTransport) { String path = URIUtils.getPath(appendURI(ensureTrailingSlash(httpxeTransport.getExternalURI()), HttpProtocolCompatibilityFilter.API_PATH)); httpxeTransport = httpxeTransport.resolve(path); String httpxeLocation = modifyURIPath(httpxeTransport.getExternalURI(), path); ResourceOptions httpxeOptions = ResourceOptions.FACTORY.newResourceOptions(httpxeTransport); httpxeOptions.setOption(NEXT_PROTOCOL, null); // terminal endpoint, so next protocol null return resourceAddressFactory.newResourceAddress(httpxeLocation, httpxeOptions); }
private ResourceAddress createApiAddress(ResourceAddress address) { ResourceAddress transport = address.getTransport(); ResourceOptions apiAddressOptions = ResourceOptions.FACTORY.newResourceOptions(transport); // /;api/operation is a terminal endpoint so next protocol should be null apiAddressOptions.setOption(NEXT_PROTOCOL, null); // even if the address has an alternate, do not bind the alternate apiAddressOptions.setOption(BIND_ALTERNATE, Boolean.FALSE); String path = URIUtils.getPath(appendURI(ensureTrailingSlash(address.getExternalURI()), HttpProtocolCompatibilityFilter.API_PATH)); String apiLocation = URIUtils.modifyURIPath(URIUtils.uriToString(transport.getResource()), path); return resourceAddressFactory.newResourceAddress(apiLocation, apiAddressOptions); }