Add isContainedIn methods on all types of Resource, mostly with default impls

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@383 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Jan Bartel 2009-06-12 02:28:05 +00:00
parent 1ec23181fa
commit 3af9418add
3 changed files with 22 additions and 1 deletions

View File

@ -278,7 +278,10 @@ public abstract class Resource implements Serializable
return newResource(url,useCaches);
}
public static boolean isContainedIn (Resource r, Resource containingResource) throws MalformedURLException
{
return r.isContainedIn(containingResource);
}
/* ------------------------------------------------------------ */
protected void finalize()
@ -286,6 +289,9 @@ public abstract class Resource implements Serializable
release();
}
public abstract boolean isContainedIn (Resource r) throws MalformedURLException;
/* ------------------------------------------------------------ */
/** Release any resources held by the resource.
*/
@ -592,4 +598,7 @@ public abstract class Resource implements Serializable
in.close();
}
}
}

View File

@ -439,4 +439,11 @@ public class ResourceCollection extends Resource
return buffer.toString();
}
public boolean isContainedIn(Resource r) throws MalformedURLException
{
// TODO could look at implementing the semantic of is this collection a subset of the Resource r?
return false;
}
}

View File

@ -289,4 +289,9 @@ public class URLResource extends Resource
{
return _useCaches;
}
public boolean isContainedIn (Resource containingResource) throws MalformedURLException
{
return false; //TODO gregw check this!
}
}