@Override
protected XMLQuery getQuery(HttpServletRequest req, HttpServletResponse res) throws IOException {
// if DIS-style parameters are found, default to standard processing
if (req.getParameter("xmlq") !=null || req.getParameter("q")!=null) {
XMLQuery xmlQuery = super.getQuery(req, res);
return xmlQuery;
// combine all HTTP (name, value) pairs into XML query string with logical AND
} else {
StringBuffer q = new StringBuffer("");
Enumeration<String> parameterNames = req.getParameterNames();
while (parameterNames.hasMoreElements()) {
String paramName = parameterNames.nextElement();
String[] paramValues = req.getParameterValues(paramName);
for (int i = 0; i < paramValues.length; i++) {
if (q.length()>0) q.append(" AND ");
q.append(paramName+" EQ "+paramValues[i]);
}
}
// build XMLQuery object from HTTP parameters
// no need to URL-encode since this request doesn't go over the network
System.out.println("Executing query="+q.toString());
return new XMLQuery(q.toString(), "wgq", "Web Grid Query",
"Query from Web-Grid", /*ddID*/null,
/*resultModeId*/null, /*propType*/null,
/*propLevels*/null, /*maxResults*/Integer.MAX_VALUE,
new ArrayList<String>(), true);
}