- Timestamp:
- 03/05/15 09:43:40 (9 years ago)
- Location:
- SRUClient/trunk/src/main/java/eu/clarin/sru/client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUAbstractRequest.java
r6075 r6076 120 120 /** A map of extra request data parameters. */ 121 121 protected Map<String, String> extraRequestData; 122 private SRUVersion versionPerformed; 122 /* 123 * The version that was used to perform the request. 124 * It is set as a side-effect of makeURI(). 125 */ 126 private SRUVersion versionRequested; 127 /* 128 * The URI that was used to perform the request. 129 * It is set a a side-effect of makeURI(). 130 */ 131 private URI uriRequested; 123 132 124 133 … … 289 298 290 299 291 final SRUVersion getVersionPerformed() { 292 return versionPerformed; 293 } 294 295 296 final URI makeURI(SRUVersion defaultVersion) 300 /** 301 * Get the URI that was used to perform the request. This method may only be 302 * called <em>after</em> the request was carried out, otherwise it will 303 * throw an {@link IllegalStateException}. 304 * 305 * @return the URI that was used to carry out this request 306 * @throws IllegalStateException 307 * if the request was not yet carried out 308 */ 309 public final URI getRequestedURI() { 310 if (uriRequested == null) { 311 throw new IllegalStateException( 312 "The request was not yet carried out"); 313 } 314 return uriRequested; 315 } 316 317 318 /** 319 * Get the version that was used to carry out this request. This method may 320 * only be called <em>after</em> the request was carried out, otherwise it 321 * will throw an {@link IllegalStateException}. 322 * 323 * @return the version that was used to carry out this request 324 * @throws IllegalStateException 325 * if the request was not yet carried out 326 */ 327 public final SRUVersion getRequestedVersion() { 328 if (versionRequested == null) { 329 throw new IllegalStateException( 330 "The request was not yet carried out"); 331 } 332 return versionRequested; 333 } 334 335 336 /* 337 * This is not public API. 338 */ 339 protected final URI makeURI(SRUVersion defaultVersion) 297 340 throws SRUClientException { 298 341 if (defaultVersion == null) { … … 346 389 getExtraRequestData(X_MALFORMED_VERSION); 347 390 if (malformedVersion == null) { 348 version Performed = (version != null) ? version : defaultVersion;349 switch (version Performed) {391 versionRequested = (version != null) ? version : defaultVersion; 392 switch (versionRequested) { 350 393 case VERSION_1_1: 351 394 uriBuilder.append(PARAM_VERSION, VERSION_1_1); … … 356 399 default: 357 400 throw new SRUClientException("unsupported version: " + 358 version Performed);401 versionRequested); 359 402 } // switch 360 403 } else { … … 383 426 } 384 427 385 return uriBuilder.makeURI(); 428 final URI uri = uriBuilder.makeURI(); 429 uriRequested = uri; 430 return uri; 386 431 } catch (URISyntaxException e) { 387 432 throw new SRUClientException("error while building request URI", e); -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUSimpleClient.java
r5785 r6076 477 477 // explainResponse/version 478 478 SRUVersion version = parseVersion(reader); 479 logger.debug("version = {}, requested = {}", 480 version, request.getVersionPerformed());479 logger.debug("version = {}, requested = {}", version, 480 request.getRequestedVersion()); 481 481 482 482 // explainResponse/record … … 699 699 SRUVersion version = parseVersion(reader); 700 700 logger.debug("version = {}, requested = {}", version, 701 request.get VersionPerformed());701 request.getRequestedVersion()); 702 702 703 703 // scanResponse/terms … … 879 879 SRUVersion version = parseVersion(reader); 880 880 logger.debug("version = {}, requested = {}", version, 881 request.get VersionPerformed());881 request.getRequestedVersion()); 882 882 883 883 // searchRetrieveResponse/numberOfRecords
Note: See TracChangeset
for help on using the changeset viewer.