}
}
// set the request preferences on the resolver before querying.
XRDS xrds = null;
XRD xrd = null;
try
{
if (sep) {
if (resMediaType == null) {
// see section 7.6 for special redirect rule
ArrayList uris = resolver.resolveSEPToURIList(oXRI.toString(), trustType, serviceType, serviceMediaType, refs);
if (uris == null || uris.size() == 0) {
sendResponse(response, HTTP_ERROR_CONTENT_TYPE, "SEP_NOT_FOUND(code=241): no url found", null);
return;
}
String s = (String) uris.get(0);
log.trace("Sending redirect to '" + s + "'");
response.sendRedirect(s);
}
else if (resMediaType.isType(MimeType.URI_LIST)) {
String text = resolver.resolveSEPToTextURIList(oXRI.toString(), trustType, serviceType, serviceMediaType, refs);
if (text.length() <= 0)
sendResponse(response, HTTP_ERROR_CONTENT_TYPE, "SEP_NOT_FOUND(code=241): no url found", null);
else
sendResponse(response, resMediaType.getType(), text, null);
}
else if (resMediaType.isType(MimeType.XRDS_XML)) {
xrds = resolver.resolveSEPToXRDS(oXRI, trustType, serviceType, serviceMediaType, refs);
sendResponse(response, isDumbBrowser, resMediaType.getType(), xrds.toString(), trustType);
}
else if (resMediaType.isType(MimeType.XRD_XML)) {
xrd = resolver.resolveSEPToXRD(oXRI, trustType, serviceType, serviceMediaType, refs);
sendResponse(response, isDumbBrowser, resMediaType.getType(), xrd.toResultString(), trustType);
}
else {
// else - we should have taken care of it in checkSupportedMediaTypes
log.error("processProxyRequest - should not reach here (sep=true)");
}
}
else {
//// authority resolution only
if(resMediaType == null) {
resMediaType = new MimeType(MimeType.XRDS_XML);
}
if (resMediaType.isType(MimeType.XRDS_XML)) {
xrds = resolver.resolveAuthToXRDS(oXRI, trustType, refs);
sendResponse(response, isDumbBrowser, resMediaType.getType(), xrds.toString(), trustType);
return;
}
else if (resMediaType.isType(MimeType.XRD_XML)) {
xrd = resolver.resolveAuthToXRD(oXRI, trustType, refs);
sendResponse(response, isDumbBrowser, resMediaType.getType(), xrd.toString(), trustType);
}
else if (resMediaType.isType(MimeType.URI_LIST)) {
// ignore (must do SEP when text/uri-list is specified)
log.warn("text/uri-list given but does not want to do service selection");
// TODO: do we return an error?