public void handle(HttpServletRequest req, HttpServletResponse res, String name) throws IOException {
final HANDLER_NAMES handlerName = HANDLER_NAMES.valueOf(name);
if (handlerName != null) {
try {
Context context = initializeRequest(req, res);
if ((context.m_params.get(CommonParams.Q) != null) || (context.m_params.get(CommonParams.FQ) != null)) {
switch (handlerName) {
case SolrSelect:
context.m_index.select(res, context.m_cms, context.m_query, true);
break;
case SolrSpell:
context.m_index.spellCheck(res, context.m_cms, context.m_query);
break;
default:
break;
}
}
} catch (Exception e) {
res.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
String message = Messages.get().getBundle().key(Messages.GUI_SOLR_UNEXPECTED_ERROR_0);
String formattedException = CmsException.getStackTraceAsString(e).replace("\n", "<br/>");
res.getWriter().println(
Messages.get().getBundle().key(Messages.GUI_SOLR_ERROR_HTML_1, message + formattedException));
}
}
}