ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(TRANSPORT, remoteBridgeAddress); final ResourceAddress remoteAddress = resourceAddressFactory.newResourceAddress(URIUtils.uriToString(remoteLocation), options, sessionId);
ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(TRANSPORT, transportAddress); options.setOption(NEXT_PROTOCOL, localAddress.getOption(NEXT_PROTOCOL));
ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(TRANSPORT, transportAddress); options.setOption(NEXT_PROTOCOL, localAddress.getOption(NEXT_PROTOCOL));
ResourceOptions candidateOptions = ResourceOptions.FACTORY.newResourceOptions(); candidateOptions.setOption(TRANSPORT, httpLocalAddress); ResourceOptions sseRemoteOptions = ResourceOptions.FACTORY.newResourceOptions(); sseRemoteOptions.setOption(TRANSPORT, newHttpBindAddress);
ResourceOptions options = optionsFactory.newResourceOptions(); ResourceOptions newOptions = ResourceOptions.FACTORY.newResourceOptions(options); newOptions.setOption(ALTERNATE, alternate); setOptions(address, location, newOptions, null);
ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(TRANSPORT, session.getLocalAddress().resolve(resource.getPath())); options.setOption(NEXT_PROTOCOL, nextProtocol);
T address = addresses.get(i); if (alternate != null) { ResourceOptions newOptions = ResourceOptions.FACTORY.newResourceOptions(options); newOptions.setOption(ALTERNATE, alternate); setOptions(address, location, newOptions, qualifier);
String candidateURI = boundAddress.getExternalURI(); ResourceOptions candidateOptions = ResourceOptions.FACTORY.newResourceOptions(boundAddress); String nextProtocol = NEXT_PROTOCOL_KEY.get(session); candidateOptions.setOption(NEXT_PROTOCOL, nextProtocol);
ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(TRANSPORT, session.getLocalAddress().resolve(resource.getPath())); options.setOption(NEXT_PROTOCOL, nextProtocol);
String candidateURI = boundAddress.getExternalURI(); ResourceOptions candidateOptions = ResourceOptions.FACTORY.newResourceOptions(boundAddress); String nextProtocol = NEXT_PROTOCOL_KEY.get(session); candidateOptions.setOption(NEXT_PROTOCOL, nextProtocol);
String nextProtocol) { ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(TRANSPORT, session.getLocalAddress()); options.setOption(NEXT_PROTOCOL, nextProtocol);
private List<ResourceAddress> asResourceAddressList(ResourceAddress addr) { List<ResourceAddress> result = new ArrayList<>(); List<ResourceAddress> topLevelAddresses = new ArrayList<>(); ResourceAddress cursor = addr; do { topLevelAddresses.add(cursor); cursor = cursor.getOption(ResourceAddress.ALTERNATE); } while (cursor != null); //recurse for ( ResourceAddress resourceAddress: topLevelAddresses ) { ResourceAddress transport = resourceAddress.getTransport(); if ( transport != null ) { for (ResourceAddress transportAddress: asResourceAddressList(transport)) { ResourceOptions newResultOptions = ResourceOptions.FACTORY.newResourceOptions(resourceAddress); newResultOptions.setOption(TRANSPORT, transportAddress); ResourceAddress newResult = addressFactory.newResourceAddress(resourceAddress.getExternalURI(), newResultOptions); result.add(newResult); } } else { result.add(resourceAddress); } } return result; } }
private void setOptions(T address, String location, ResourceOptions options, Object qualifier) { // default the transport ResourceAddress transport = options.getOption(TRANSPORT); String transportURI = options.getOption(TRANSPORT_URI); if (transport == null && addressFactory != null) { ResourceOptions newOptions = ResourceOptions.FACTORY.newResourceOptions(options); if (transportURI == null) { ResourceFactory factory = getTransportFactory(); if (factory != null) { transportURI = factory.createURI(location); newOptions.setOption(TRANSPORT_URI, transportURI); } } if (transportURI != null) { // TODO: make ResourceOptions hierarchical to provide options here? ResourceOptions transportOptions = ResourceOptions.FACTORY.newResourceOptions(); transportOptions.setOption(NEXT_PROTOCOL, getProtocolName()); URI locationURI = URI.create(location); transportOptions.setOption(TRANSPORTED_URI, locationURI); transport = addressFactory.newResourceAddress(transportURI, transportOptions); } newOptions.setOption(TRANSPORT, transport); options = newOptions; } setOptions(address, options, qualifier); }
private ResourceAddress httpxeAddressNoSecurity(ResourceAddress httpxeAddress, IdentityResolver resolver) { // Remove REALM_NAME option at http layer (upstream and downstream requests shouldn't have to // go through authentication/authorization) ResourceAddress httpAddress = httpxeAddress.getTransport(); ResourceOptions noSecurityOptions = new NoSecurityResourceOptions(httpAddress); noSecurityOptions.setOption(ResourceAddress.IDENTITY_RESOLVER, resolver); ResourceAddress httpAddressNoSecurity = resourceAddressFactory.newResourceAddress( httpAddress.getExternalURI(), noSecurityOptions, httpAddress.getOption(ResourceAddress.QUALIFIER)); // Remove REALM_NAME option at httpxe layer but preserve all other options like // ORIGIN_SECURITY etc. Otherwise, upstream and downstream requests will be subjected // to different origin security constraints. Then finally add http as transport to httpxe ResourceOptions httpxeOptions = ResourceOptions.FACTORY.newResourceOptions(httpxeAddress); httpxeOptions.setOption(TRANSPORT, httpAddressNoSecurity); httpxeOptions.setOption(ResourceAddress.IDENTITY_RESOLVER, resolver); httpxeOptions = new NoSecurityResourceOptions(httpxeOptions); return resourceAddressFactory.newResourceAddress(URIUtils.uriToString(httpxeAddress.getResource()), httpxeOptions); }
private ResourceAddress createCandidateAddress(IoSession session, HttpRequestMessage httpRequest, String nextProtocol) { URI requestURI = httpRequest.getRequestURI(); String authority = httpRequest.getHeader(HEADER_HOST); String scheme = httpRequest.isSecure() ? "https" : "http"; // handle missing Host header if (authority == null) { return null; } URI candidateURI = URI.create(format("%s://%s/", scheme, authority)).resolve(requestURI); ResourceAddress transport = LOCAL_ADDRESS.get(session); if (transport == null) { throw new NullPointerException("transport"); } ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(NEXT_PROTOCOL, nextProtocol); options.setOption(TRANSPORT, transport); return addressFactory.newResourceAddress(URIUtils.uriToString(candidateURI), options); }
protected final ResourceAddress resolve(String oldPath, String newPath) { URI addressURI = getResource(); String externalURI = getExternalURI(); boolean newPathDiffersFromOld = !oldPath.equals(newPath); if ( !newPathDiffersFromOld ) { return this; } boolean shouldResolveNewPath = oldPath.equals(addressURI.getPath()); if (!shouldResolveNewPath) { return this; } URI newResourceURI = addressURI.resolve(newPath); String newExternalURI = URIUtils.resolve(externalURI, newPath); ResourceOptions newOptions = FACTORY.newResourceOptions(this); resolve(oldPath, newPath, newOptions); String externalUriToString = newExternalURI; String newResourceUriToString = URIUtils.uriToString(newResourceURI); return factory.newResourceAddress0(externalUriToString, newResourceUriToString, newOptions); }
private ResourceAddress getSslSessionLocalAddress(IoSession session) { // note: bound address is unified in SSL options during bind to avoid conflicts like different cipher suites ResourceAddress boundAddress = SslAcceptor.SSL_RESOURCE_ADDRESS.remove(session); assert (boundAddress != null); // construct the candidate address with observed transport and next protocol String candidateURI = boundAddress.getExternalURI(); ResourceOptions candidateOptions = ResourceOptions.FACTORY.newResourceOptions(boundAddress); candidateOptions.setOption(NEXT_PROTOCOL, NEXT_PROTOCOL_KEY.get(session)); candidateOptions.setOption(TRANSPORT, LOCAL_ADDRESS.get(session)); ResourceAddress candidateAddress = resourceAddressFactory.newResourceAddress(candidateURI, candidateOptions); // lookup the binding for this candidate address Binding binding = bindings.getBinding(candidateAddress); return (binding != null) ? binding.bindAddress() : null; }
private ResourceAddress createWsrRtmpAddress(ResourceAddress address) { // wsr[wsr/1.0] | tcp or wsr[wsr/1.0] | ssl // so find http[http/1.1] layer's transport either way and you'll get ssl or tcp. ResourceAddress wsrRtmpTransportAddress; wsrRtmpTransportAddress = address.findTransport("http[http/1.1]").getTransport(); ResourceOptions wsrRtmpTransportAddressOptions = ResourceOptions.FACTORY.newResourceOptions(wsrRtmpTransportAddress); wsrRtmpTransportAddressOptions.setOption(NEXT_PROTOCOL, "rtmp/1.0"); wsrRtmpTransportAddressOptions.setOption(ResourceAddress.ALTERNATE, null); wsrRtmpTransportAddress = resourceAddressFactory.newResourceAddress(wsrRtmpTransportAddress.getExternalURI(), wsrRtmpTransportAddressOptions); ResourceOptions wsrRtmpAddressOptions = ResourceOptions.FACTORY.newResourceOptions(address); wsrRtmpAddressOptions.setOption(TRANSPORT, wsrRtmpTransportAddress); return resourceAddressFactory.newResourceAddress(address.getExternalURI(), wsrRtmpAddressOptions); }
private ResourceAddress getResourcesAddress(HttpBinding newHttpBinding) { ResourceAddress bindAddress = newHttpBinding.bindAddress(); String location = bindAddress.getExternalURI(); String resourcesURI = URIUtils.resolve(location, "/;resource"); ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(TRANSPORT_URI, bindAddress.getOption(TRANSPORT_URI)); options.setOption(TRANSPORT, bindAddress.getOption(TRANSPORT)); options.setOption(TEMP_DIRECTORY, bindAddress.getOption(TEMP_DIRECTORY)); options.setOption(NEXT_PROTOCOL, bindAddress.getOption(NEXT_PROTOCOL)); options.setOption(ORIGIN_SECURITY, bindAddress.getOption(ORIGIN_SECURITY)); options.setOption(GATEWAY_ORIGIN_SECURITY, bindAddress.getOption(GATEWAY_ORIGIN_SECURITY)); options.setOption(BALANCE_ORIGINS, bindAddress.getOption(BALANCE_ORIGINS)); return addressFactory.newResourceAddress(resourcesURI, options); }
public NoSecurityResourceOptions(ResourceOptions defaultsAddress) { options = ResourceOptions.FACTORY.newResourceOptions(defaultsAddress); }