org.mortbay.resource
Class BadResource

java.lang.Object
  extended by org.mortbay.resource.Resource
      extended by org.mortbay.resource.URLResource
          extended by org.mortbay.resource.BadResource
All Implemented Interfaces:
Serializable

 class BadResource
extends URLResource

Bad Resource. A Resource that is returned for a bade URL. Acts as a resource that does not exist and throws appropriate exceptions.

Author:
Greg Wilkins (gregw)

Field Summary
private  String _message
           
 
Fields inherited from class org.mortbay.resource.URLResource
_connection, _in, _url, _urlString
 
Fields inherited from class org.mortbay.resource.Resource
_associate
 
Constructor Summary
BadResource(URL url, String message)
           
 
Method Summary
 boolean delete()
          Deletes the given resource
 boolean exists()
          Returns true if the respresened resource exists.
 File getFile()
          Returns an File representing the given resource or NULL if this is not possible.
 InputStream getInputStream()
          Returns an input stream to the resource
 OutputStream getOutputStream()
          Returns an output stream to the resource
 boolean isDirectory()
          Returns true if the respresenetd resource is a container/directory.
 long lastModified()
          Returns the last modified time
 long length()
          Return the length of the resource
 String[] list()
          Returns a list of resource names contained in the given resource
 boolean renameTo(Resource dest)
          Rename the given resource
 String toString()
           
 
Methods inherited from class org.mortbay.resource.URLResource
addPath, checkConnection, equals, getName, getURL, hashCode, release
 
Methods inherited from class org.mortbay.resource.Resource
encode, finalize, getAlias, getAssociate, getListHTML, newResource, newResource, newSystemResource, setAssociate, writeTo
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_message

private String _message
Constructor Detail

BadResource

BadResource(URL url,
            String message)
Method Detail

exists

public boolean exists()
Description copied from class: URLResource
Returns true if the respresened resource exists.

Overrides:
exists in class URLResource

lastModified

public long lastModified()
Description copied from class: URLResource
Returns the last modified time

Overrides:
lastModified in class URLResource

isDirectory

public boolean isDirectory()
Description copied from class: URLResource
Returns true if the respresenetd resource is a container/directory. If the resource is not a file, resources ending with "/" are considered directories.

Overrides:
isDirectory in class URLResource

length

public long length()
Description copied from class: URLResource
Return the length of the resource

Overrides:
length in class URLResource

getFile

public File getFile()
Description copied from class: URLResource
Returns an File representing the given resource or NULL if this is not possible.

Overrides:
getFile in class URLResource

getInputStream

public InputStream getInputStream()
                           throws IOException
Description copied from class: URLResource
Returns an input stream to the resource

Overrides:
getInputStream in class URLResource
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException,
                                    SecurityException
Description copied from class: URLResource
Returns an output stream to the resource

Overrides:
getOutputStream in class URLResource
Throws:
IOException
SecurityException

delete

public boolean delete()
               throws SecurityException
Description copied from class: URLResource
Deletes the given resource

Overrides:
delete in class URLResource
Throws:
SecurityException

renameTo

public boolean renameTo(Resource dest)
                 throws SecurityException
Description copied from class: URLResource
Rename the given resource

Overrides:
renameTo in class URLResource
Throws:
SecurityException

list

public String[] list()
Description copied from class: URLResource
Returns a list of resource names contained in the given resource

Overrides:
list in class URLResource

toString

public String toString()
Overrides:
toString in class URLResource