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 ResourceaddPath(String path)Deprecated.Returns the resource contained inside the current resource with the given namevoidclose()Deprecated.Release any resources held by the resource.booleandelete()Deprecated.Deletes the given resourcebooleanequals(Object o)Deprecated.booleanexists()Deprecated.Returns true if the represented resource exists.FilegetFile()Deprecated.Returns an File representing the given resource or NULL if this is not possible.InputStreamgetInputStream()Deprecated.Returns an input stream to the resource.StringgetName()Deprecated.Returns the name of the resourceReadableByteChannelgetReadableByteChannel()Deprecated.Readable ByteChannel for the resource.URLgetURL()Deprecated.Returns a URL representing the given resourcebooleangetUseCaches()Deprecated.inthashCode()Deprecated.booleanisContainedIn(Resource containingResource)Deprecated.booleanisDirectory()Deprecated.Returns true if the represented resource is a container/directory.longlastModified()Deprecated.Returns the last modified timelonglength()Deprecated.Return the length of the resourceString[]list()Deprecated.Returns a list of resource names contained in the given resourcebooleanrenameTo(Resource dest)Deprecated.Rename the given resourceStringtoString()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:
isDirectoryin 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:
lastModifiedin 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:
getFilein 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:
getInputStreamin 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:ResourceReadable ByteChannel for the resource.- Specified by:
getReadableByteChannelin 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 SecurityExceptionDeprecated.Deletes the given resource- Specified by:
deletein 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:
renameToin 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:
addPathin classResource- Parameters:
path- The path segment to add, which is not encoded. The path may be non canonical, but if so then the resulting Resource will return true fromResource.isAlias().- 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, or a relative path attempts to access above the root resource.
-
getUseCaches
public boolean getUseCaches()
Deprecated.
-
isContainedIn
public boolean isContainedIn(Resource containingResource) throws MalformedURLException
Deprecated.- Specified by:
isContainedInin classResource- Throws:
MalformedURLException
-
-