private void outputRequestInfo(String sMessage, RpcRequest request) { String sCRLF = System.getProperty("line.separator"); StringBuffer sbText = new StringBuffer(); sbText.append(sMessage + sCRLF); sbText.append("RpcTemplate: Dumping contents of request: " + sCRLF + sCRLF); sbText.append( "Got here by the following trace: " + Arrays.toString(Thread.currentThread().getStackTrace()) + sCRLF + sCRLF); if (request != null) { sbText.append(" credentials: " + request.getCredentials() + sCRLF); sbText.append(" rpcContext: " + request.getRpcContext() + sCRLF); sbText.append(" rpcName: " + request.getRpcName() + sCRLF); sbText.append(" rpcVersion: " + request.getRpcVersion() + sCRLF); sbText.append(" timeout: " + request.getTimeout() + sCRLF); sbText.append(" uriString: " + request.getUriString() + sCRLF); if ((request.getParams() != null) && (request.getParams().size() > 0)) { int i = 0; for (RpcParam oRpcParam : request.getParams()) { sbText.append(" rpcParam[" + i + "]:" + sCRLF); sbText.append(" type: " + oRpcParam.getType() + sCRLF); sbText.append(" value: " + oRpcParam.getValue() + sCRLF); i++; } } if (request.getHost() != null) { sbText.append(" host:" + sCRLF); sbText.append(" hostname: " + request.getHost().getHostname() + sCRLF); sbText.append(" port: " + request.getHost().getPort() + sCRLF); sbText.append(" scheme: " + request.getHost().getScheme() + sCRLF); } } else { sbText.append(" request was null" + sCRLF); } logger.debug(sbText.toString()); }
protected RpcRequest validateRequest(RpcRequest request) { RpcHost host = request.getHost(); if (host == null || host.getPort() == -1) { Assert.notNull( getHostResolver(), "[Assertion failed] - attempted to resolve ambiguous host, but hostResolver was null"); host = getHostResolver().resolve(host != null ? host.getHostname() : null); } if (requiresCredentials(request)) { String credentials = request.getCredentials(); if (!StringUtils.hasText(credentials)) { Assert.notNull( getCredentialsProvider(), "[Assertion failed] - attempted to provide credentials for RPC request without them, but credentialsProvider was null"); credentials = getCredentialsProvider().getCredentials(host, credentials); } return request = new RpcRequest(host, credentials, request); } else { return request = new RpcRequest(host, null, request); } }
protected ConnectionSpec createConnectionSpec(RpcRequest request) { return ConnectionSpecFactory.create(request.getCredentials()); }