public int getStatusCode() { if (status == null) { return -1; } return HttpStatus.valueOfStatusLine(status).getCode(); }
/** * Get a Propstat instance contained within this response that has the * provided criteria. * * @param status the Http status code of the propstat to retrieve * @param description the description of the propstat to retrieve * @param error the error of the propstat to retrieve. Note that when * searching for a matching propstat, errors are considered the * same only if both errors are null. * @return the Propstat instance if a match is found, or null if no * propstats matches all criteria */ public Propstat getPropstat(int status, String description, Error error) { // try to find an existing propstat for given status, error and // description for (Propstat propstat : getPropstat()) { Error pError = propstat.getError(); String pDescription = propstat.getResponsedescription(); int pStatus = HttpStatus.valueOfStatusLine(propstat.getStatus()).getCode(); // compare given propstat if (pStatus == status && pError == error && // ... do not compare // errors - only if both // are null (the same) ((pDescription == description) || (pDescription.equals(description)))) { return propstat; } } return null; }