public class HttpPath extends FilesystemPath
TODO: support WEBDAV, enabling the full Path API.
Path.FileChannelFactory
Modifier and Type | Field and Description |
---|---|
protected static LruCache<java.lang.String,com.caucho.vfs.HttpPath.CacheEntry> |
_cache |
protected com.caucho.vfs.HttpPath.CacheEntry |
_cacheEntry |
protected java.lang.String |
_host |
protected int |
_port |
protected java.lang.String |
_query |
protected java.lang.String |
_virtualHost |
protected static L10N |
L |
_bindRoot, _pathname, _root, _userPath
_pathSeparatorChar, _schemeMap, _separatorChar
Constructor and Description |
---|
HttpPath(java.lang.String host,
int port)
Creates a new HTTP root path with a host and a port.
|
Modifier and Type | Method and Description |
---|---|
protected Path |
cacheCopy()
Copy for caching.
|
boolean |
canRead()
Returns true if the file is readable.
|
protected HttpPath |
create(FilesystemPath root,
java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> newAttributes,
java.lang.String path,
java.lang.String query) |
protected HttpPath |
create(java.lang.String host,
int port) |
boolean |
equals(java.lang.Object o)
Overrides equals to test for equality with an HTTP path.
|
boolean |
exists()
Returns true if the file exists.
|
Path |
fsWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String uri)
Scans the path portion of the URI, i.e.
|
protected com.caucho.vfs.HttpPath.CacheEntry |
getCache() |
java.lang.String |
getHost()
Returns the host part of the url.
|
long |
getLastModified()
Returns the last modified time.
|
long |
getLength()
Returns the file's length
|
int |
getPort()
Returns the port part of the url.
|
java.lang.String |
getQuery()
Returns the query string.
|
java.lang.String |
getScheme()
Returns the scheme, http.
|
java.lang.String |
getURL()
Returns a full URL for the path.
|
java.lang.String |
getUserPath()
Returns the user's path.
|
java.lang.String |
getVirtualHost()
Returns the virtual host, if any.
|
int |
hashCode()
Returns a hashCode for the path.
|
boolean |
isDirectory()
Returns the last modified time.
|
boolean |
isFile()
Returns true if the file exists.
|
Path |
lookupImpl(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> newAttributes,
boolean isAllowRoot)
Overrides the default lookup to parse the host and port
before parsing the path.
|
StreamImpl |
openReadImpl()
Returns a read stream for a GET request.
|
StreamImpl |
openReadWriteImpl()
Returns a read/write pair for a POST request.
|
Path |
schemeWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String uri,
int offset)
Walk down the path starting from the portion immediately following
the scheme.
|
java.lang.String |
toString()
Returns the string form of the http path.
|
bind, createRoot, getFullPath, getParent, getPath, getRoot, getTail, init, normalizePath, normalizePath, setUserPath
canExecute, canWrite, changeGroup, changeGroup, changeOwner, changeOwner, chmod, clearStatusCache, compareTo, copy, createDepend, createLink, createNewFile, createRoot, createTempFile, escapeURL, fileChannelFactory, getAttribute, getAttributeNames, getBlockCount, getBlockSize, getCache, getCertificates, getContentType, getCrc64, getCreateTime, getDevice, getDeviceId, getDiskSpaceFree, getDiskSpaceTotal, getFileSeparatorChar, getGroup, getInode, getLastAccessTime, getLastStatusChangeTime, getMode, getNativePath, getNewlineString, getNumberOfLinks, getObject, getOwner, getPathSeparatorChar, getRelativePath, getResources, getResources, getSchemeMap, getSeparatorChar, getUser, getUserDir, getValue, isBlockDevice, isCharacterDevice, isExecutable, isFIFO, isHardLink, isLink, isObject, isPathCacheable, isSocket, isSymbolicLink, isWindows, isWindowsInsecure, iterator, list, lookup, lookup, lookup, lookupChild, lookupNative, lookupNative, lookupRelativeNativePath, mkdir, mkdirs, openAppend, openAppendImpl, openFileRandomAccess, openMemoryMappedFile, openRandomAccess, openRead, openReadWrite, openReadWrite, openReadWrite, openWrite, openWriteImpl, putCache, readLink, realPath, remove, removeAll, renameTo, renameTo, scanScheme, sendfile, setDefaultSchemeMap, setExecutable, setLastModified, setObject, setTestWindows, setValue, truncate, truncate, unbind, unwrap, writeToStream, writeToStream
protected static L10N L
protected static LruCache<java.lang.String,com.caucho.vfs.HttpPath.CacheEntry> _cache
protected java.lang.String _host
protected int _port
protected java.lang.String _query
protected java.lang.String _virtualHost
protected com.caucho.vfs.HttpPath.CacheEntry _cacheEntry
public HttpPath(java.lang.String host, int port)
host
- the target hostport
- the target port, if zero, uses port 80.public Path lookupImpl(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> newAttributes, boolean isAllowRoot)
lookupImpl
in class Path
userPath
- the path passed in by the usernewAttributes
- attributes passed by the userpublic Path schemeWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String uri, int offset)
schemeWalk
in class FilesystemPath
userPath
- the user's passed in pathattributes
- the attributes for the new pathuri
- the normalized full urioffset
- offset into the uri to start processing, i.e. after the
scheme.public Path fsWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String uri)
fsWalk
in class FilesystemPath
userPath
- the user's supplied pathattributes
- the attributes for the new pathuri
- the full uri for the new path.protected HttpPath create(java.lang.String host, int port)
protected HttpPath create(FilesystemPath root, java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> newAttributes, java.lang.String path, java.lang.String query)
public java.lang.String getScheme()
public java.lang.String getURL()
public java.lang.String getHost()
public java.lang.String getUserPath()
getUserPath
in class FilesystemPath
public java.lang.String getVirtualHost()
public java.lang.String getQuery()
public long getLastModified()
getLastModified
in class Path
public long getLength()
public boolean canRead()
public boolean isDirectory()
isDirectory
in class Path
protected com.caucho.vfs.HttpPath.CacheEntry getCache()
public StreamImpl openReadImpl() throws java.io.IOException
openReadImpl
in class Path
java.io.IOException
public StreamImpl openReadWriteImpl() throws java.io.IOException
openReadWriteImpl
in class Path
java.io.IOException
public java.lang.String toString()
public int hashCode()
hashCode
in class FilesystemPath
public boolean equals(java.lang.Object o)
equals
in class FilesystemPath