result = getTransport().findTransport(query); return null; } else { return getTransport().findTransport(query);
ResourceAddress tcpResourceAddress = resourceAddress.findTransport("tcp"); if (tcpResourceAddress != null) { URI resource = tcpResourceAddress.getResource();
/** * Get the IP address of the resource based on the parameter name * * @param acceptSession * @param parameterName can be either 'for' (the IP address of the client/server making the request to this * service), or 'by' (the IP address of this proxy) * @return the IP address based on the parameter name received */ private static String getResourceIpAddress(HttpAcceptSession acceptSession, String parameterName) { String resourceIpAddress = null; ResourceAddress resourceAddress = null; switch (parameterName) { case FORWARDED_FOR: resourceAddress = acceptSession.getRemoteAddress(); break; case FORWARDED_BY: resourceAddress = acceptSession.getLocalAddress(); break; } ResourceAddress tcpResourceAddress = resourceAddress.findTransport("tcp"); if (tcpResourceAddress != null) { URI resource = tcpResourceAddress.getResource(); resourceIpAddress = resource.getHost(); } return resourceIpAddress; }
@Override protected UnbindFuture unbindInternal(ResourceAddress address, IoHandler handler, BridgeSessionInitializer<? extends IoFuture> initializer) { unbindApiPath(address); final ResourceAddress transportAddress = address.getTransport(); BridgeAcceptor acceptor = bridgeServiceFactory.newBridgeAcceptor(transportAddress); UnbindFuture future = unbindCookiesHandler(address.findTransport("http[http/1.1]")); future = combineFutures(future, acceptor.unbind(transportAddress)); return future; }
final BridgeSessionInitializer<T> initializer) { try { bindCookiesHandler(address.findTransport("http[http/1.1]"));
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); }
ResourceAddress remoteHttp11Address = remoteAddress.findTransport("http[http/1.1]"); ResourceAddress localHttp11Address = localAddress.findTransport("http[http/1.1]"); if (remoteHttp11Address == null || localHttp11Address == null) { throw new RuntimeException("Cannot construct up- and down- stream urls: no http/1.1 transport found.");