if (unp == null) unp = ""; // Use some other greek letter for empty str
String[] mimes = req.getParameterValues("mime"); // Grab any mimes
if (mimes == null) mimes = EMPTY_STRING_ARRAY; // None? Use empty array
if (xmlq.length() > 0) try { // Was there an xmlq?
return new XMLQuery(xmlq); // Use it in its entirety, ignoring the rest
} catch (SAXException ex) { // Can't parse it?
res.sendError(HttpServletResponse.SC_BAD_REQUEST, // Then that's a bad ...
"cannot parse xmlq: " + ex.getMessage()); // ... request, which I hate
return null; // so flag it with a null
} else if (q.length() > 0) { // Was there a q?
boolean unparsed = "true".equals(unp); // If so, was there also an unp?
return new XMLQuery(q, "wgq", "Web Grid Query", // Use it to make an XMLQuery
"Query from Web-Grid", /*ddID*/null, // And all of these extra
/*resultModeId*/null, /*propType*/null, // parameters really annoy
/*propLevels*/null, /*maxResults*/Integer.MAX_VALUE, // the poop out of me
Arrays.asList(mimes), !unparsed); // It's just a query for /sbin/fsck sake!
}