flags.setNoDefaultM(nodefault_m);
flags.setNoDefaultP(nodefault_p);
flags.setNoDefaultT(nodefault_t);
// resolve
XRDS xrds = null;
XRD xrd = null;
try
{
if (sep) {
if (resMediaType == null) {
// see section 7.6 for special redirect rule
// ArrayList<?> uris = this.resolver.resolveSEPToURIList(oXRI.toString(), trustType, serviceType, serviceMediaType, refs);
ArrayList<?> uris = this.resolver.resolveSEPToURIList(oXRI, serviceType, serviceMediaType, flags, state);
if (uris == null || uris.size() == 0) {
sendError(request, response, qxri, 241, "SEP_NOT_FOUND(code=241): no url found", null);
return;
}
String s = (String) uris.get(0);
if (onResolutionSuccess(qxri, state, s, request, response)) {
log.trace("processProxyRequest - onResolutionSuccess returned true, assuming request is fully handled, returning");
return;
}
log.trace("Sending redirect to '" + s + "'");
if (this.config.getSetting("RedirectCode").equals("301"))
send301(response, s);
else if (this.config.getSetting("RedirectCode").equals("303"))
send303(response, s);
else
response.sendRedirect(s);
}
else if (resMediaType.isType(MimeType.URI_LIST)) {
// String text = this.resolver.resolveSEPToTextURIList(oXRI.toString(), trustType, serviceType, serviceMediaType, refs);
String text = this.resolver.resolveSEPToTextURIList(oXRI, serviceType, serviceMediaType, flags, state);
if (onResolutionSuccess(qxri, state, text, request, response)) {
log.trace("processProxyRequest - onResolutionSuccess returned true, assuming request is fully handled, returning");
return;
}
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 = this.resolver.resolveSEPToXRDS(oXRI, trustType, serviceType, serviceMediaType, refs);
xrds = this.resolver.resolveSEPToXRDS(oXRI, serviceType, serviceMediaType, flags, state);
if (onResolutionSuccess(qxri, state, xrds, request, response)) {
log.trace("processProxyRequest - onResolutionSuccess returned true, assuming request is fully handled, returning");
return;
}
sendResponse(response, debug, resMediaType.getType(), xrds.toString(), trustType);
}
else if (resMediaType.isType(MimeType.XRD_XML)) {
// xrd = this.resolver.resolveSEPToXRD(oXRI, trustType, serviceType, serviceMediaType, refs);
xrd = this.resolver.resolveSEPToXRD(oXRI, serviceType, serviceMediaType, flags, state);
if (onResolutionSuccess(qxri, state, xrd, request, response)) {
log.trace("processProxyRequest - onResolutionSuccess returned true, assuming request is fully handled, returning");
return;
}
sendResponse(response, debug, 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 = this.resolver.resolveAuthToXRDS(oXRI, trustType, refs);
xrds = this.resolver.resolveAuthToXRDS(oXRI, flags, state);
if (onResolutionSuccess(qxri, state, xrds, request, response)) {
log.trace("processProxyRequest - onResolutionSuccess returned true, assuming request is fully handled, returning");
return;
}
sendResponse(response, debug, resMediaType.getType(), xrds.toString(), trustType);
return;
}
else if (resMediaType.isType(MimeType.XRD_XML)) {
// xrd = this.resolver.resolveAuthToXRD(oXRI, trustType, refs);
xrd = this.resolver.resolveAuthToXRD(oXRI, flags, state);