public object get(object @base, bool check)
{
// if we have a relative uri, we need to resolve against
// the base object's uri
Uri uri = this;
if (m_scheme == null)
{
if (@base == null) throw UnresolvedErr.make("Relative uri with no base: " + this).val;
Uri baseUri = null;
try
{
baseUri = (Uri)trap(@base, "uri", null);
if (baseUri == null)
throw UnresolvedErr.make("Base object's uri is null: " + this).val;
}
catch (System.Exception e)
{
throw UnresolvedErr.make("Cannot access base '" + FanObj.@typeof(@base) + ".uri' to normalize: " + this, e).val;
}
if (baseUri.m_scheme == null)
throw UnresolvedErr.make("Base object's uri is not absolute: " + baseUri).val;
uri = baseUri.plus(this);
}
// resolve scheme handler
UriScheme scheme = UriScheme.find(uri.m_scheme);
// route to scheme
try
{
return scheme.get(uri, @base);
}
catch (UnresolvedErr.Val e)
{
if (check) throw e;
return null;
}
}