@Override public <T> T setOption(ResourceOption<T> key, T value) { if (key == HttpResourceAddress.REALMS) return null; return options.setOption(key,value); }
@Override protected void setOptions(WsResourceAddress address, ResourceOptions options, Object qualifier) { // Extended websocket sessions do not have a codec, by design. options.setOption(CODEC_REQUIRED, Boolean.FALSE); super.setOptions(address, options, qualifier); }
@Override public ResourceOptions newResourceOptions(ResourceOptions defaults) { ResourceOptions newOptions = ResourceOptions.FACTORY.newResourceOptions(defaults); newOptions.setOption(NEXT_PROTOCOL, nextProtocol); return newOptions; }
@Override protected void setOptions(WsResourceAddress address, ResourceOptions options, Object qualifier) { // No codec for extended websocket sessions by design. options.setOption(WsResourceAddress.CODEC_REQUIRED, Boolean.FALSE); super.setOptions(address, options, qualifier); }
@Override protected void setOptions(WsResourceAddress address, ResourceOptions options, Object qualifier) { // No codec for extended websocket sessions by design. options.setOption(CODEC_REQUIRED, Boolean.FALSE); super.setOptions(address, options, qualifier); }
@Override protected void setOptions(WsResourceAddress address, ResourceOptions options, Object qualifier) { // Extended websocket sessions do not have a codec, by design. options.setOption(CODEC_REQUIRED, Boolean.FALSE); super.setOptions(address, options, qualifier); }
@Override public ResourceOptions newResourceOptions() { ResourceOptions newOptions = ResourceOptions.FACTORY.newResourceOptions(); newOptions.setOption(NEXT_PROTOCOL, nextProtocol); return newOptions; } });
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); }
protected void resolve(String oldPath, String newPath, ResourceOptions newOptions) { ResourceAddress transport = getOption(TRANSPORT); if (transport != null) { newOptions.setOption(TRANSPORT, transport.resolve(oldPath, newPath)); } ResourceAddress alternate = getOption(ALTERNATE); if (alternate != null) { newOptions.setOption(ALTERNATE, alternate.resolve(oldPath, newPath)); } }
@Override protected void setAlternateOption(String location, ResourceOptions options, Map<String, Object> optionsByName) { // Creating alternate SseResourceAddres with httpxe+ssl tranport location = SseHttpxeSslResourceAddressFactorySpi.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); }
@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); }
public ResourceAddress newResourceAddress(ResourceAddress uriAddress, ResourceAddress transportAddress) { ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(TRANSPORT, transportAddress); options.setOption(NEXT_PROTOCOL, uriAddress.getOption(NEXT_PROTOCOL)); return newResourceAddress(uriToString(uriAddress.getResource()), options); }
@Override protected void setOptions(WsResourceAddress address, ResourceOptions options, Object qualifier) { // WSE never should negotiate or support x-kaazing-handshake protocol options.setOption(SUPPORTED_PROTOCOLS, WseResourceAddressFactorySpi.removeStringArrayElement(options.getOption(SUPPORTED_PROTOCOLS), "x-kaazing-handshake")); super.setOptions(address, options, qualifier); }
@Override protected void setOptions(WsResourceAddress address, ResourceOptions options, Object qualifier) { // WSE never should negotiate or support x-kaazing-handshake protocol options.setOption(SUPPORTED_PROTOCOLS, removeStringArrayElement(options.getOption(SUPPORTED_PROTOCOLS), "x-kaazing-handshake")); super.setOptions(address, options, qualifier); }
private ResourceAddress getCandidateResourceAddress(IoSessionEx session) { // Build candidate address from session final ResourceAddress candidateTransportAddress = REMOTE_ADDRESS.get(session); URI candidateURI = candidateTransportAddress.getOption(TRANSPORTED_URI); ResourceOptions candidateOptions = ResourceOptions.FACTORY.newResourceOptions(); candidateOptions.setOption(NEXT_PROTOCOL, NEXT_PROTOCOL_KEY.get(session)); candidateOptions.setOption(TRANSPORT, candidateTransportAddress); return resourceAddressFactory.newResourceAddress(URIUtils.uriToString(candidateURI), candidateOptions); }
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 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 createReadAddress(URI readUri, HttpSession transport, WsebSession wsebSession) { ResourceAddress httpxeAddress = REMOTE_ADDRESS.get(transport); ResourceAddress readAddress = httpxeAddress.resolve(readUri.getPath()); String readSessionIdentity = format("%s#%sd", getTransportMetadata().getName(), wsebSession.getId()); IdentityResolver resolver = new FixedIdentityResolver(readSessionIdentity); ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(readAddress); options.setOption(ResourceAddress.IDENTITY_RESOLVER, resolver); return resourceAddressFactory.newResourceAddress(URIUtils.uriToString(readAddress.getResource()), options); }
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); }