Package org.eclipse.jetty.util.resource
Class URLResource
- java.lang.Object
-
- org.eclipse.jetty.util.resource.Resource
-
- org.eclipse.jetty.util.resource.URLResource
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ResourceFactory
- Direct Known Subclasses:
JarResource
@Deprecated(since="2021-05-27") public class URLResource extends Resource
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.URL resource class.
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.util.resource.Resource
__defaultUseCaches
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Resource
addPath(String path)
Deprecated.Returns the resource contained inside the current resource with the given namevoid
close()
Deprecated.Release any resources held by the resource.boolean
delete()
Deprecated.Deletes the given resourceboolean
equals(Object o)
Deprecated.boolean
exists()
Deprecated.Returns true if the represented resource exists.File
getFile()
Deprecated.Returns an File representing the given resource or NULL if this is not possible.InputStream
getInputStream()
Deprecated.Returns an input stream to the resource.String
getName()
Deprecated.Returns the name of the resourceReadableByteChannel
getReadableByteChannel()
Deprecated.Readable ByteChannel for the resource.URL
getURL()
Deprecated.Returns a URL representing the given resourceboolean
getUseCaches()
Deprecated.int
hashCode()
Deprecated.boolean
isContainedIn(Resource containingResource)
Deprecated.boolean
isDirectory()
Deprecated.Returns true if the represented resource is a container/directory.long
lastModified()
Deprecated.Returns the last modified timelong
length()
Deprecated.Return the length of the resourceString[]
list()
Deprecated.Returns a list of resource names contained in the given resourceboolean
renameTo(Resource dest)
Deprecated.Rename the given resourceString
toString()
Deprecated.-
Methods inherited from class org.eclipse.jetty.util.resource.Resource
copyTo, encode, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getListHTML, getResource, getURI, getWeakETag, getWeakETag, isAlias, isContainedIn, isSame, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeTo
-
-
-
-
Method Detail
-
close
public void close()
Deprecated.Release any resources held by the resource.
-
exists
public boolean exists()
Deprecated.Returns true if the represented resource exists.
-
isDirectory
public boolean isDirectory()
Deprecated.Returns true if the represented resource is a container/directory. If the resource is not a file, resources ending with "/" are considered directories.- Specified by:
isDirectory
in classResource
- Returns:
- true if the represented resource is a container/directory. if the resource is not a file, resources ending with "/" are considered directories.
-
lastModified
public long lastModified()
Deprecated.Returns the last modified time- Specified by:
lastModified
in classResource
- Returns:
- the last modified time as milliseconds since unix epoch
-
length
public long length()
Deprecated.Return the length of the resource
-
getURL
public URL getURL()
Deprecated.Returns a URL representing the given resource
-
getFile
public File getFile() throws IOException
Deprecated.Returns an File representing the given resource or NULL if this is not possible.- Specified by:
getFile
in classResource
- Returns:
- an File representing the given resource or NULL if this is not possible.
- Throws:
IOException
- if unable to get the resource due to permissions
-
getName
public String getName()
Deprecated.Returns the name of the resource
-
getInputStream
public InputStream getInputStream() throws IOException
Deprecated.Returns an input stream to the resource. The underlying url connection will be nulled out to prevent re-use.- Specified by:
getInputStream
in classResource
- Returns:
- an input stream to the resource
- Throws:
IOException
- if unable to open the input stream
-
getReadableByteChannel
public ReadableByteChannel getReadableByteChannel() throws IOException
Deprecated.Description copied from class:Resource
Readable ByteChannel for the resource.- Specified by:
getReadableByteChannel
in classResource
- Returns:
- an readable bytechannel to the resource or null if one is not available.
- Throws:
IOException
- if unable to open the readable bytechannel for the resource.
-
delete
public boolean delete() throws SecurityException
Deprecated.Deletes the given resource- Specified by:
delete
in classResource
- Returns:
- true if resource was found and successfully deleted, false if resource didn't exist or was unable to be deleted.
- Throws:
SecurityException
- if unable to delete due to permissions
-
renameTo
public boolean renameTo(Resource dest) throws SecurityException
Deprecated.Rename the given resource- Specified by:
renameTo
in classResource
- Parameters:
dest
- the destination name for the resource- Returns:
- true if the resource was renamed, false if the resource didn't exist or was unable to be renamed.
- Throws:
SecurityException
- if unable to rename due to permissions
-
list
public String[] list()
Deprecated.Returns a list of resource names contained in the given resource
-
addPath
public Resource addPath(String path) throws IOException
Deprecated.Returns the resource contained inside the current resource with the given name- Specified by:
addPath
in classResource
- Parameters:
path
- The path segment to add, which is not encoded- Returns:
- the Resource for the resolved path within this Resource.
- Throws:
IOException
- if unable to resolve the pathMalformedURLException
- if the resolution of the path fails because the input path parameter is malformed.
-
getUseCaches
public boolean getUseCaches()
Deprecated.
-
isContainedIn
public boolean isContainedIn(Resource containingResource) throws MalformedURLException
Deprecated.- Specified by:
isContainedIn
in classResource
- Throws:
MalformedURLException
-
-