Revision 9780
org.gvsig.online/trunk/org.gvsig.online/org.gvsig.online.lib/org.gvsig.online.lib.impl/src/main/java/org/gvsig/online/lib/impl/OnlineDownloaderImpl.java | ||
---|---|---|
254 | 254 |
DownloaderResponseHandler responseHandler = executeRequest(request); |
255 | 255 |
status = responseHandler.getStatus(); |
256 | 256 |
if(status >= 200 && status < 300) { |
257 |
//2xx success |
|
257 |
// 2xx success
|
|
258 | 258 |
return responseHandler.getFile(); |
259 | 259 |
|
260 | 260 |
} else if(status >= 300 && status < 400) { |
261 |
//3xx redirection |
|
261 |
// 3xx redirection
|
|
262 | 262 |
throw new IOExceptionWithStatus(status, "Can't call method "+method+" "+Objects.toString(url)+"' HTTPStatus = "+status); |
263 |
} else if(status == 401) { |
|
264 |
//401 Unauthorized |
|
263 |
} else if(status == 401 || status == 403) { |
|
264 |
// "401 Unauthorized" indicates that the request lacks valid authentication credentials |
|
265 |
// "403 Forbidden" the client doesn't have permission to access the requested resource |
|
266 |
// https://www.permit.io/blog/401-vs-403-error-whats-the-difference |
|
265 | 267 |
if( retries < numretries-1 ) { |
266 | 268 |
authorize(); |
267 | 269 |
} |
268 | 270 |
} else if(status == 409) { |
269 |
//409 Version Conflict |
|
271 |
// 409 Version Conflict
|
|
270 | 272 |
retries = numretries; |
271 | 273 |
throw new IOExceptionWithStatus(status, "Can't call method "+method+" "+Objects.toString(url)+"' "+status+" Version conflict"); |
272 | 274 |
} else if(status >= 400 && status < 500) { |
273 |
//4xx client errors |
|
275 |
// 4xx client errors
|
|
274 | 276 |
throw new IOExceptionWithStatus(status, "Can't call method "+method+" "+Objects.toString(url)+"' HTTPStatus = "+status); |
275 | 277 |
} else if(status >= 500 && status < 600) { |
276 |
//5xx server errors |
|
278 |
// 5xx server errors
|
|
277 | 279 |
throw new IOExceptionWithStatus(status, "Can't call method "+method+" "+Objects.toString(url)+"' HTTPStatus = "+status); |
278 | 280 |
} else { |
279 | 281 |
//Unknown |
Also available in: Unified diff