- Timestamp:
- 05/29/13 18:32:21 (11 years ago)
- Location:
- SRUClient/trunk/src/main/java/eu/clarin/sru/client
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUAbstractRequest.java
r2955 r2959 109 109 } 110 110 } // class URIHelper 111 /** The URL of the endpoint. */112 protected final String endpointURI;111 /** The baseURI of the SRU server. */ 112 protected final URI baseURI; 113 113 /** 114 114 * The request should be processed in strict or non-strict SRU protocol … … 126 126 * Constructor. 127 127 * 128 * @param endpointURI129 * the URI of the endpoint128 * @param baseURI 129 * the baseURI of the SRU server 130 130 * @throws NullPointerException 131 131 * if any required argument is null 132 132 */ 133 protected SRUAbstractRequest(String endpointURI) { 134 if (endpointURI == null) { 135 throw new NullPointerException("endpointURI == null"); 136 } 137 this.endpointURI = endpointURI; 138 } 139 140 141 /** 142 * Get the endpoint URI. 143 * 144 * @return the endpoint URI 145 */ 146 public String getEndpointURI() { 147 return endpointURI; 133 protected SRUAbstractRequest(URI baseURI) { 134 if (baseURI == null) { 135 throw new NullPointerException("baseURI == null"); 136 } 137 this.baseURI = baseURI; 138 } 139 140 141 /** 142 * Constructor. 143 * 144 * @param baseURI 145 * the baseURI of the SRU server 146 * @throws NullPointerException 147 * if any required argument is null 148 * @throw IllegalArgumentException if the URI is invalid 149 */ 150 protected SRUAbstractRequest(String baseURI) { 151 if (baseURI == null) { 152 throw new NullPointerException("baseURI == null"); 153 } 154 if (baseURI.isEmpty()) { 155 throw new IllegalArgumentException("baseURI is empty"); 156 } 157 try { 158 this.baseURI = new URI(baseURI); 159 } catch (URISyntaxException e) { 160 throw new IllegalArgumentException("invalid URI", e); 161 } 162 } 163 164 165 /** 166 * Get the baseURI of the SRU server. 167 * 168 * @return the baseURI of the SRU server 169 */ 170 public URI getBaseURI() { 171 return baseURI; 148 172 } 149 173 … … 278 302 try { 279 303 final URIHelper uriBuilder = 280 new URIHelper(new URIBuilder( endpointURI));304 new URIHelper(new URIBuilder(baseURI)); 281 305 282 306 /* … … 285 309 * NB: Setting "x-malformed-operation" as an extra request parameter 286 310 * makes the client to send invalid requests. This is intended to 287 * use for testing endpoints for protocol conformance (i.e. provoke288 * an error) and SHOULD NEVER be used in production!311 * use for testing SRU servers for protocol conformance (i.e. 312 * provoke an error) and SHOULD NEVER be used in production! 289 313 */ 290 314 final String malformedOperation = … … 316 340 * NB: Setting "x-malformed-version" as an extra request parameter 317 341 * makes the client to send invalid requests. This is intended to 318 * use for testing endpoints for protocol conformance (i.e. provoke319 * an error) and SHOULD NEVER be used in production!342 * use for testing SRU servers for protocol conformance (i.e. 343 * provoke an error) and SHOULD NEVER be used in production! 320 344 */ 321 345 final String malformedVersion = -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUExplainRequest.java
r2948 r2959 17 17 package eu.clarin.sru.client; 18 18 19 import java.net.URI; 20 19 21 /** 20 22 * An object for performing a <em>explain</em> operation. … … 33 35 * the baseURI of the endpoint 34 36 */ 37 public SRUExplainRequest(URI baseURI) { 38 super(baseURI); 39 } 40 41 42 /** 43 * Constructor. 44 * 45 * @param baseURI 46 * the baseURI of the endpoint 47 */ 35 48 public SRUExplainRequest(String baseURI) { 36 49 super(baseURI); … … 40 53 /** 41 54 * Set the requested record packing. 42 * 55 * 43 56 * @param recordPacking 44 57 * the requested record packing -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUScanRequest.java
r2948 r2959 16 16 */ 17 17 package eu.clarin.sru.client; 18 19 import java.net.URI; 18 20 19 21 /** … … 49 51 * the baseURI of the endpoint 50 52 */ 53 public SRUScanRequest(URI baseURI) { 54 super(baseURI); 55 } 56 57 58 /** 59 * Constructor. 60 * 61 * @param baseURI 62 * the baseURI of the endpoint 63 */ 51 64 public SRUScanRequest(String baseURI) { 52 65 super(baseURI); -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUSearchRetrieveRequest.java
r2948 r2959 16 16 */ 17 17 package eu.clarin.sru.client; 18 19 import java.net.URI; 18 20 19 21 /** … … 57 59 * the baseURI of the endpoint 58 60 */ 61 public SRUSearchRetrieveRequest(URI baseURI) { 62 super(baseURI); 63 } 64 65 66 /** 67 * Constructor. 68 * 69 * @param baseURI 70 * the baseURI of the endpoint 71 */ 59 72 public SRUSearchRetrieveRequest(String baseURI) { 60 73 super(baseURI);
Note: See TracChangeset
for help on using the changeset viewer.