@Override public int compare(ResourceAddress addr1, ResourceAddress addr2) { URI location1 = addr1.getResource(); URI location2 = addr2.getResource(); assert (location1 != null); assert (location2 != null); return (location1.compareTo(location2)); }
@Override public NamedPipeAddress createSocketAddress(ResourceAddress address) { URI location = address.getResource(); assert ("pipe".equals(location.getScheme())); assert (location.getAuthority() != null); assert (location.getPath() == null || location.getPath().isEmpty()); assert (location.getQuery() == null); assert (location.getFragment() == null); return new NamedPipeAddress(location.getAuthority()); }
public final ResourceAddress resolve(String newPath) { if ( newPath == null ) { throw new NullPointerException(newPath); } URI addressURI = getResource(); return resolve(addressURI.getPath(), newPath); }
private URI locateSecureAcceptURI(HttpAcceptSession session) throws Exception { // TODO: same-origin requests must consider cross-origin access control // internal redirect to secure resource should not trigger 403 Forbidden ResourceAddress localAddress = session.getLocalAddress(); URI resource = localAddress.getResource(); String scheme = resource.getScheme(); return (scheme.equals("sse+ssl") || scheme.equals("wss")) ? resource : null; }
@Deprecated // this is only needed to determine external scheme, use ResourceAddress.getExternalURI() instead public static boolean isSecure(IoSession session) { ResourceAddress address = BridgeSession.LOCAL_ADDRESS.get(session); while (address != null && !"ssl".equals(address.getResource().getScheme())) { address = address.getTransport(); } return address != null; }
@Override public String toString() { String nextProtocol = bindAddress.getOption(NEXT_PROTOCOL); nextProtocol = (nextProtocol == null ? "" : " "+nextProtocol); return format("([%s%s],0x%x,0x%x,#%d)", bindAddress.getResource(), nextProtocol, identityHashCode(handler), identityHashCode(initializer), referenceCount()); }
private IoHandler selectConnectHandler(ResourceAddress address) { Protocol protocol = bridgeServiceFactory.getTransportFactory().getProtocol(address.getResource()); if ( protocol instanceof HttpProtocol ) { return createHandler; } throw new RuntimeException(getClass()+ ": Cannot select a connect handler for address "+address); }
private IoHandler selectConnectHandler(ResourceAddress address) { Protocol protocol = bridgeServiceFactory.getTransportFactory().getProtocol(address.getResource()); if ( protocol instanceof HttpProtocol ) { return httpHandler; } throw new RuntimeException(getClass()+ ": Cannot select a connect handler for address "+address); }
private IoHandler selectTransportHandler(ResourceAddress address) { Protocol protocol = bridgeServiceFactory.getTransportFactory().getProtocol(address.getResource()); if ( protocol instanceof HttpProtocol ) { return bridgeHandler; } throw new RuntimeException(getClass()+": Cannot find handler for address "+address); }
private IoHandler selectConnectHandler(ResourceAddress address) { Protocol protocol = bridgeServiceFactory.getTransportFactory().getProtocol(address.getResource()); if ( protocol instanceof HttpProtocol) { return createHandler; } throw new RuntimeException(getClass()+ ": Cannot select a connect handler for address "+address); }
private IoHandler selectConnectHandler(ResourceAddress address) { Protocol protocol = bridgeServiceFactory.getTransportFactory().getProtocol(address.getResource()); if ( protocol instanceof HttpProtocol) { return httpBridgeHandler; } throw new RuntimeException(getClass()+ ": Cannot select a connect handler for address "+address); }
private IoHandler selectCreateHandler(ResourceAddress transport) { Protocol protocol = bridgeServiceFactory.getTransportFactory().getProtocol(transport.getResource()); if ( protocol instanceof HttpProtocol) { return wsrCreateHandler; } throw new RuntimeException("Unable to locate a WSR create handler for address "+transport); }
@Override public Binding getBinding(ResourceAddress address) { HttpBinding httpBinding = super.getBinding0(address); if (httpBinding != null) { URI location = address.getResource(); String path = location.getPath(); return httpBinding.get(path); } return null; }
private IoHandler selectReadHandler(ResourceAddress readAddress, WsebSession session) { Protocol protocol = bridgeServiceFactory.getTransportFactory().getProtocol(readAddress.getResource()); if ( protocol instanceof HttpProtocol ) { return new ReadHandler(session); } throw new RuntimeException("Cannot select read handler for address "+readAddress); }
private URI locateSecureAcceptURI(HttpAcceptSession session) throws Exception { // TODO: same-origin requests must consider cross-origin access control // internal redirect to secure resource should not trigger 403 Forbidden ResourceAddress localAddress = session.getLocalAddress(); URI resource = localAddress.getResource(); Protocol resourceProtocol = bridgeServiceFactory.getTransportFactory().getProtocol(resource); if (WsebProtocol.WSEB_SSL == resourceProtocol || WsProtocol.WSS == resourceProtocol) { return resource; } return null; }
@Override protected boolean unbindAdditionalAddressesIfNecessary(ResourceAddress address, HttpBinding newHttpBinding) { ResourceAddress resourcesAddress = getResourcesAddress(newHttpBinding); if ( newHttpBinding.size()==1 && newHttpBinding.get(resourcesAddress.getResource().getPath()) != null) { HttpAcceptor.this.unbind(resourcesAddress); return true; } return false; }
private ResourceAddress createWsrCreateAddress(ResourceAddress address) { ResourceAddress wsrTransportAddress = address.getTransport(); URI wsrTransportBindURI = wsrTransportAddress.getResource(); return wsrTransportAddress.resolve(createResolvePath(wsrTransportBindURI, CREATE_SUFFIX)); }
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); }
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); }
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); }