![JAR search and dependency download from the Maven repository](/logo.png)
io.tus.java.client.ProtocolException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tus-java-client Show documentation
Show all versions of tus-java-client Show documentation
Java client for tus, the resumable file uploading protocol.
package io.tus.java.client;
import java.io.IOException;
import java.net.HttpURLConnection;
/**
* This exception is thrown if the server sends a request with an unexpected status code or
* missing/invalid headers.
*/
public class ProtocolException extends Exception {
private HttpURLConnection connection;
public ProtocolException(String message) {
super(message);
}
public ProtocolException(String message, HttpURLConnection connection) {
super(message);
this.connection = connection;
}
public HttpURLConnection getCausingConnection() {
return connection;
}
public boolean shouldRetry() {
if(connection == null) {
return false;
}
try {
int responseCode = connection.getResponseCode();
// 5XX and 423 Resource Locked status codes should be retried.
return (responseCode >= 500 && responseCode < 600) || responseCode == 423;
} catch(IOException e) {
return false;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy