public class HttpFileSystem extends WebFileSystem
FileSystem.DirectoryEntry, FileSystem.FileSystemOfflineException| Modifier and Type | Field and Description |
|---|---|
protected static java.util.logging.Logger |
logger |
HTTP_CHECK_TIMESTAMP_LIMIT_MS, id, LISTING_TIMEOUT_MS, localRoot, MEMORY_LISTING_TIMEOUT_MS, offline, offlineMessage, offlineResponseCode, PROP_OFFLINE, PROP_READ_ONLY_CACHE, protocolloggerUrl, NULL, PROP_CASE_INSENSITIVE, properties| Modifier | Constructor and Description |
|---|---|
protected |
HttpFileSystem(java.net.URI root,
java.io.File localRoot)
Create a new HttpFileSystem mirroring the root, a URL pointing to "http" or "https",
in the local folder.
|
| Modifier and Type | Method and Description |
|---|---|
static HttpFileSystem |
createHttpFileSystem(java.net.URI rooturi)
Create a filesystem from the URI.
|
protected java.util.Map<java.lang.String,java.lang.String> |
downloadFile(java.lang.String filename,
java.io.File targetFile,
java.io.File partFile,
ProgressMonitor monitor)
Transfers the file from the remote store to a local copy f.
|
protected java.lang.String |
getCookie()
return the cookie needed.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getHeadMeta(java.lang.String f)
this is introduced to support checking if the symbol foo/bar is a folder by checking
for a 303 redirect.
|
boolean |
isDirectory(java.lang.String filename)
dumb method looks for / in parent directory's listing.
|
static boolean |
isRegexNoWild(java.lang.String regex)
return true if the regular expression for the file is actually a single
file with no wildcards.
|
java.lang.String[] |
listDirectory(java.lang.String directory)
list the directory, using the cached entry from listDirectoryFromMemory, or
by HtmlUtil.getDirectoryListing.
|
java.lang.String[] |
listDirectory(java.lang.String directory,
java.lang.String regex)
returns a list of the names of the files in a directory that match regex.
|
FileSystem.DirectoryEntry |
maybeUpdateDirectoryEntry(java.lang.String filename,
boolean force)
HTTP listings are really done by querying the single file, so support this by issuing a head request
|
protected java.util.Map<java.lang.String,java.lang.String> |
reduceMeta(java.net.URLConnection connect)
pull out some of the headers to record ETag and Content_Type.
|
addPropertyChangeListener, addRoCacheEntries, cacheListing, consumeStream, copyStream, getDownloadDirectory, getDownloadLock, getFileObject, getLastAccessed, getLocalName, getLocalName, getLocalRoot, getLocalRootAbsPath, getOfflineMessage, getOfflineResponseCode, getPartFile, getProtocol, getReadOnlyCache, getRootURL, getURI, getURL, isAppletMode, isGitClone, isListingCached, isOffline, listDirectoryFromMemory, listingFile, localRoot, removePropertyChangeListener, resetListCache, resetListingCache, setAppletMode, setOffline, setReadOnlyCache, toStringcreate, create, create, create, create, create, createFileSystem, getExceptionHandler, getListing, getListing, getProperty, getRootURI, listDirectory, listDirectory, listDirectoryDeep, peek, peekInstances, recreate, recreate, registerFileSystemFactory, reset, reset, setExceptionHandler, settings, splitUrl, toCanonicalFilename, toCanonicalFolderName, toCanonicalFolderNameprotected HttpFileSystem(java.net.URI root,
java.io.File localRoot)
root - the root of the filesystemlocalRoot - the local root where files are downloaded.protected java.lang.String getCookie()
public static HttpFileSystem createHttpFileSystem(java.net.URI rooturi) throws FileSystem.FileSystemOfflineException, java.net.UnknownHostException, java.io.FileNotFoundException
rooturi - FileSystem.FileSystemOfflineExceptionjava.net.UnknownHostExceptionjava.io.FileNotFoundExceptionprotected java.util.Map<java.lang.String,java.lang.String> reduceMeta(java.net.URLConnection connect)
connect - protected java.util.Map<java.lang.String,java.lang.String> downloadFile(java.lang.String filename,
java.io.File targetFile,
java.io.File partFile,
ProgressMonitor monitor)
throws java.io.IOException
WebFileSystemdownloadFile in class WebFileSystemfilename - filename within the filesystem.targetFile - the target filename where the file is to be download.partFile - use this file to stage the downloadmonitor - monitor the progress.java.io.IOExceptionWebProtocol.getMetadata(org.das2.util.filesystem.WebFileObject)protected java.util.Map<java.lang.String,java.lang.Object> getHeadMeta(java.lang.String f)
throws java.io.IOException,
CancelledOperationException
others are just HTTP header fields like (see wget --server-response https://raw.githubusercontent.com/autoplot/jyds/master/dd.jyds):EXIST->Boolean REAL_NAME->String
Content-Length the length in bytes of the resource. Cache-Control max-age=300 Date: Fri, 18 Jul 2014 12:07:18 GMT time stamp. ETag: "750d4f66c58a0ac7fef2784253bf6954d4d38a85" Accept-Ranges accepts requests for part of a file.
f - the name within the filesystemjava.io.IOExceptionCancelledOperationExceptionpublic boolean isDirectory(java.lang.String filename)
throws java.io.IOException
isDirectory in class WebFileSystemfilename - the namejava.io.IOExceptionpublic java.lang.String[] listDirectory(java.lang.String directory)
throws java.io.IOException
listDirectory in class WebFileSystemdirectory - name within the filesystemjava.io.IOExceptionfor listings constrained by regular expressions.public static boolean isRegexNoWild(java.lang.String regex)
regex - public java.lang.String[] listDirectory(java.lang.String directory,
java.lang.String regex)
throws java.io.IOException
FileSystemlistDirectory in class WebFileSystemdirectory - the directoryregex - regular expressionjava.io.IOExceptionpublic FileSystem.DirectoryEntry maybeUpdateDirectoryEntry(java.lang.String filename, boolean force) throws java.io.IOException
maybeUpdateDirectoryEntry in class WebFileSystemfilename - filename within the systemforce - if true, then guarantee a listing and throw an IOException if it cannot be done.java.io.IOException