Package com.caringo.client

Examples of com.caringo.client.BasicScspResponseOutputStream


            if (0 < clusterName.length()) {
                metaData.addValue("Scsp-Proxy-Cluster", clusterName);
            }

            ScspRequestHandler client = new ScspRequestHandler(httpCli, new LocatorRedirectHandler(subLocator), 3, 300, null);
            BasicScspResponseOutputStream output = new BasicScspResponseOutputStream(null);

            try {
                client.read("", metaData, "", output);
            }
            catch (Exception ex) {
                throw new NoCastorNodesLocatedException(String.format("Exception when communicating with SCSP Proxy (%s)", ex.toString()));
            }
           
            HashMap<String, String> proxyNodesInfo = new HashMap<String, String>();
            String nodesInfo = output.getHeader("Scsp-Proxy-Nodes");
           
            for (HeaderElement elem : HeaderElement.parseElements(nodesInfo)) {
                proxyNodesInfo.put(elem.getName(), elem.getValue());
            }

            Integer nodeCount = Integer.parseInt(proxyNodesInfo.get("count"));
            String outputBody = output.getBodyString();
           
            if ((0 == nodeCount) || (0 == outputBody.length())) {
                String reason = proxyNodesInfo.get("reason");
                throw new NoCastorNodesLocatedException(reason);
            }
View Full Code Here

TOP

Related Classes of com.caringo.client.BasicScspResponseOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.