protected void getResumeResponseHeaderValues() throws IOException { if (getResponseCode() != HttpURLConnection.HTTP_PARTIAL) throw new IOException(); if (lastModifiedTime != getLastModifiedTimeFromHeader()) throw new IOException(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_FILE_MODIFIED_SINCE_LAST_ACCESS); }
protected void getResumeResponseHeaderValues() throws IOException { if (getResponseCode() != HttpURLConnection.HTTP_PARTIAL) throw new IOException(); if (lastModifiedTime != getLastModifiedTimeFromHeader()) throw new IOException(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_FILE_MODIFIED_SINCE_LAST_ACCESS); }
protected void getResponseHeaderValues() throws IOException { if (getResponseCode() == -1) throw new IOException(Messages.HttpClientRetrieveFileTransfer_INVALID_SERVER_RESPONSE_TO_PARTIAL_RANGE_REQUEST); Header lastModifiedHeader = httpResponse.getLastHeader(LAST_MODIFIED_HEADER); if (lastModifiedHeader != null) { setLastModifiedTime(getLastModifiedTimeFromHeader()); } setFileLength(httpResponse.getEntity().getContentLength()); fileid = new FileTransferID(getRetrieveNamespace(), getRemoteFileURL()); // Get content disposition header and get remote file name from it if possible. Header contentDispositionHeader = httpResponse.getLastHeader(HttpHelper.CONTENT_DISPOSITION_HEADER); if (contentDispositionHeader != null) { remoteFileName = HttpHelper.getRemoteFileNameFromContentDispositionHeader(contentDispositionHeader.getValue()); } // If still null, get the path from httpclient.getMethod() if (remoteFileName == null) { // No name could be extracted using Content-Disposition. Let's try the // path from the getMethod. String pathStr = getMethod.getRequestLine().getUri(); if (pathStr != null && pathStr.length() > 0) { IPath path = Path.fromPortableString(pathStr); if (path.segmentCount() > 0) remoteFileName = path.lastSegment(); } // If still null, use the input file name if (remoteFileName == null) // Last resort. Use the path of the initial URL request remoteFileName = super.getRemoteFileName(); } }
protected void getResponseHeaderValues() throws IOException { if (getResponseCode() == -1) throw new IOException(Messages.HttpClientRetrieveFileTransfer_INVALID_SERVER_RESPONSE_TO_PARTIAL_RANGE_REQUEST); Header lastModifiedHeader = httpResponse.getLastHeader(LAST_MODIFIED_HEADER); if (lastModifiedHeader != null) { setLastModifiedTime(getLastModifiedTimeFromHeader()); } setFileLength(httpResponse.getEntity().getContentLength()); fileid = new FileTransferID(getRetrieveNamespace(), getRemoteFileURL()); // Get content disposition header and get remote file name from it if possible. Header contentDispositionHeader = httpResponse.getLastHeader(HttpHelper.CONTENT_DISPOSITION_HEADER); if (contentDispositionHeader != null) { remoteFileName = HttpHelper.getRemoteFileNameFromContentDispositionHeader(contentDispositionHeader.getValue()); } // If still null, get the path from httpclient.getMethod() if (remoteFileName == null) { // No name could be extracted using Content-Disposition. Let's try the // path from the getMethod. String pathStr = getMethod.getRequestLine().getUri(); if (pathStr != null && pathStr.length() > 0) { IPath path = Path.fromPortableString(pathStr); if (path.segmentCount() > 0) remoteFileName = path.lastSegment(); } // If still null, use the input file name if (remoteFileName == null) // Last resort. Use the path of the initial URL request remoteFileName = super.getRemoteFileName(); } }