Revision 59849
Added by Miriam Baglioni over 3 years ago
modules/dnet-collector-plugins/trunk/src/main/java/eu/dnetlib/data/collector/plugins/rest/RestIterator.java | ||
---|---|---|
256 | 256 |
log.debug("authMethod :" + authMethod); |
257 | 257 |
if (this.authMethod == "bearer") { |
258 | 258 |
log.trace("authMethod before inputStream: " + resultXml); |
259 |
log.debug("authMethod :" + authMethod); |
|
260 | 259 |
HttpURLConnection conn = (HttpURLConnection) qUrl.openConnection(); |
261 | 260 |
conn.setRequestProperty("Authorization","Bearer "+authToken); |
262 | 261 |
conn.setRequestProperty("Content-Type","application/json"); |
... | ... | |
264 | 263 |
theHttpInputStream = conn.getInputStream(); |
265 | 264 |
}else if (BASIC.equalsIgnoreCase(this.authMethod)) { |
266 | 265 |
log.trace("authMethod before inputStream: " + resultXml); |
267 |
log.debug("authMethod :" + authMethod); |
|
268 | 266 |
HttpURLConnection conn = (HttpURLConnection) qUrl.openConnection(); |
269 | 267 |
conn.setRequestProperty("Authorization","Basic "+authToken); |
270 | 268 |
conn.setRequestProperty("accept","application/xml"); |
271 | 269 |
conn.setRequestMethod("GET"); |
272 |
log.debug("header :" + conn.getHeaderFields()); |
|
273 |
log.debug("url : " + qUrl.getPath()); |
|
274 | 270 |
theHttpInputStream = conn.getInputStream(); |
275 | 271 |
} else { |
276 | 272 |
theHttpInputStream = qUrl.openStream(); |
... | ... | |
380 | 376 |
try { |
381 | 377 |
if (resultTotal == -1) { |
382 | 378 |
resultTotal = Integer.parseInt(xprResultTotalPath.evaluate(resultNode)); |
383 |
if (resumptionType.toLowerCase().equals("page")) { resultTotal += 1; } // to correct the upper bound |
|
379 |
if (resumptionType.toLowerCase().equals("page") && !BASIC.equalsIgnoreCase(authMethod)) { resultTotal += 1; } // to correct the upper bound
|
|
384 | 380 |
log.info("resultTotal was -1 is now: " + resultTotal); |
385 | 381 |
} |
386 | 382 |
} catch(Exception e) { |
Also available in: Unified diff
removede some logs and added check to fix issue with fct rest template