// get the requested MmiUri:
// after the following block mmiUriTest will be NON-null only if the requested
// URI (either from the "uri" parameter if given, or from the fullRequestedUri)
// is "ont"-resolvable (OntUtil.isOntResolvableUri) and a syntactically valid MmiUri:
MmiUri mmiUriTest = null;
try {
if ( Util.yes(request, "uri") ) {
// when the "uri" parameter is passed, its value is used.
String entityUri = Util.getParam(request, "uri", "");
if ( OntUtil.isOntResolvableUri(entityUri) ) {
mmiUriTest = new MmiUri(entityUri, true); // allowing only until authority
}
}
else {
mmiUriTest = new MmiUri(fullRequestedUri, true); // allowing only until authority
}
}
catch (URISyntaxException e) {
// Ok, not a regular MmiUri request.
}
String outFormatTest;
String versionTest = null;
if ( mmiUriTest != null ) {
// get output format to be used:
outFormatTest = OntServlet.getOutFormatForMmiUri(formParam, accept, mmiUriTest.getExtension(), log);
}
else {
// NOT a regular MmiUri request.
outFormatTest = OntServlet.getOutFormatForNonMmiUri(formParam, log);
}
if ( outFormatTest.length() == 0 ) {
// No explicit outFormat.
// use content negotiation:
outFormatTest = Util.getOutFormatByContentNegotiation(accept);
log.debug("Not explicit output format given (either file extension or form parameter). " +
"Using [" +outFormatTest+ "] by content negotiation."
);
}
if ( Util.yes(request, "version") ) {
// explicit version given:
versionTest = Util.getParam(request, "version", null);
}
String authorityTest = null;
if ( mmiUriTest != null && mmiUriTest.getTopic() == "" ) {
// it is only until the authority. Just keep the authority
authorityTest = mmiUriTest.getAuthority();
mmiUriTest = null;
}
authority = authorityTest;