import javax.net.ssl.SSLException;
import org.apache.commons.httpclient.ConnectTimeoutException;
+import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.jackrabbit.webdav.DavException;
public class RemoteOperationResult implements Serializable {
/** Generated - should be refreshed every time the class changes!! */
- private static final long serialVersionUID = 6106167714625712390L;
+ private static final long serialVersionUID = 3267227833178885664L;
private static final String TAG = "RemoteOperationResult";
private int mHttpCode = -1;
private Exception mException = null;
private ResultCode mCode = ResultCode.UNKNOWN_ERROR;
+ private String mRedirectedLocation;
public RemoteOperationResult(ResultCode code) {
mCode = code;
break;
default:
mCode = ResultCode.UNHANDLED_HTTP_CODE;
- Log_OC.d(TAG, "RemoteOperationResult has prcessed UNHANDLED_HTTP_CODE: " + httpCode);
+ Log_OC.d(TAG, "RemoteOperationResult has processed UNHANDLED_HTTP_CODE: " + httpCode);
}
}
}
+
+ public RemoteOperationResult(boolean success, int httpCode, Header[] headers) {
+ this(success, httpCode);
+ if (headers != null) {
+ Header current;
+ for (int i=0; i<headers.length; i++) {
+ current = headers[i];
+ if ("Location".equals(current.getName())) {
+ mRedirectedLocation = current.getValue();
+ break;
+ }
+ }
+ }
+ }
public RemoteOperationResult(Exception e) {
mException = e;
return (mException != null);
}
+ public boolean isTemporalRedirection() {
+ return (mHttpCode == 302 || mHttpCode == 307);
+ }
+
+ public String getRedirectedLocation() {
+ return mRedirectedLocation;
+ }
+
+ public boolean isIdPRedirection() {
+ return (mRedirectedLocation.toUpperCase().contains("SAML") ||
+ mRedirectedLocation.toLowerCase().contains("wayf"));
+ }
+
}