if (msProxyURI != null) {
mediaTypeStr += (";sep" + Boolean.toString(doSEP));
}
MimeType resMediaType = MimeType.parse(mediaTypeStr);
ResolverState state = new ResolverState();
XRDS xrds = null;
XRD xrd = null;
try {
if (doSEP) {
if (resMediaType.isType(MimeType.URI_LIST)) {
String text = resolver.resolveSEPToTextURIList(msTargetXRI.toString(), trustType, xrdT, xrdM, followRefs, state);
if (text.length() <= 0)
sOutput.append("ERROR: SEP_NOT_FOUND(code=241): no url found\n");
else
sOutput.append(text);
}
else if (resMediaType.isType(MimeType.XRDS_XML)) {
xrds = resolver.resolveSEPToXRDS(msTargetXRI, trustType, xrdT, xrdM, followRefs, state);
sOutput.append(xrds.toString());
}
else if (resMediaType.isType(MimeType.XRD_XML)) {
xrd = resolver.resolveSEPToXRD(msTargetXRI, trustType, xrdT, xrdM, followRefs, state);
sOutput.append(xrd.toResultString());
}
else {
sOutput.append("Unknown resolution media type (sep=true)");
}
}
else {
if (resMediaType.isType(MimeType.XRDS_XML)) {
xrds = resolver.resolveAuthToXRDS(msTargetXRI, trustType, followRefs, state);
sOutput.append(xrds.toString());
}
else if (resMediaType.isType(MimeType.XRD_XML)) {
xrd = resolver.resolveAuthToXRD(msTargetXRI, trustType, followRefs, state);
sOutput.append(xrd.toString());
}
else if (resMediaType.isType(MimeType.URI_LIST)) {
// ignore (must do SEP when text/uri-list is specified)
sOutput.append("ERROR: text/uri-list must only be used with service selection (sep=true)\n");
}
else {
sOutput.append("ERROR: Unknown resolution media type (sep=false)");
}
}
}
catch (PartialResolutionException pre) {
xrds = pre.getPartialXRDS();
xrd = xrds.getFinalXRD();
if (resMediaType == null || resMediaType.isType(MimeType.URI_LIST)) {
sOutput.append("ERROR: resolution failed. Partial XRDS:\n" + xrds.toString());
}
else if (resMediaType.isType(MimeType.XRDS_XML)) {
sOutput.append("ERROR: resolution failed. Partial XRDS:\n" + xrds.toString());
}
else if (resMediaType.isType(MimeType.XRD_XML)) {
sOutput.append("ERROR: resolution failed. Partial XRDS:\n" + xrds.toString());
}
}
finally {
if (mbIsVerbose)
sOutput.append("\n\nSTATISTICS:\n" + state.toString() + "\n");
}
}