public SolrSearcher(String solrBaseUrl) { baseUrl = solrBaseUrl; client = new BasicHttpClient(solrBaseUrl); }
/** * <p>Get the requested URL and return the GetMethod Object afterwards. * To access more info use its method: eg. GetMethod.getStatusCode() and * GetMethod.getResponseBodyAsString()</p> * * <p>Internally wraps a Fascinator BasicHttpClient Object, so any configured * proxy details from the system will be used automatically.</p> * * @param url The URL to retrieve * @return GetMethod The instantiated and executed GetMethod Object. * @throws IOException If any network errors occur accessing the URL. Note * this does not cover HTTP errors returned from the web server; use the * returned Object to check for these. */ private GetMethod getUrl(String url) throws IOException { BasicHttpClient client = new BasicHttpClient(url); GetMethod get = new GetMethod(url); client.executeMethod(get); return get; }
private JsonSimple getMintData(DateFormat solrDateFormat) throws IOException { String url = systemConfig.getString("http://localhost:9001/mint", "proxy-urls", "Published_Records_By_Type") + "&dateFrom=" + solrDateFormat.format(fromDate) + "&dateTo=" + solrDateFormat.format(toDate); BasicHttpClient client = new BasicHttpClient(url); GetMethod get = new GetMethod(url); client.executeMethod(get); JsonSimple mintResult = new JsonSimple(get.getResponseBodyAsString()); return mintResult; }
log.debug("openConnection: {}", url); String uri = url.toString(); BasicHttpClient client = new BasicHttpClient(uri); GetMethod getMethod = new GetMethod(uri); int retryCount = 0;
private void getMintStats(Stat stat, String query, StatisticalReport report) throws IOException { StringBuilder param = new StringBuilder(); param.append("dateFrom="); param.append(report.getStrStartDate()); param.append("&dateTo="); param.append(report.getStrEndDate()); param.append("&published="); param.append(report.getStrPublished()); String targetUrl = stat.getUrl() + param.toString(); log.debug("Using url"+targetUrl); BasicHttpClient client = new BasicHttpClient(targetUrl); GetMethod get = new GetMethod(targetUrl); client.executeMethod(get); JsonSimple mintResult = new JsonSimple(get.getResponseBodyAsString()); for (String fldKey : stat.getFields()) { StatResult result = stat.getResults().get(fldKey); if (fldKey.indexOf(":") >= 0) { JSONArray groupList = mintResult.getArray(fldKey); for (Object entry : groupList) { String groupName = (String) entry; int counts = mintResult.getInteger(new Integer("0"), fldKey+"counts", groupName).intValue(); result.getGroupMap().put(groupName, new Integer(counts)); result.setCounts(result.getCounts()+counts); } } else { int counts = mintResult.getInteger(new Integer(-1), fldKey); result.setCounts(counts); } } }