throw new ServletException("No queue URI specified");
}
String msgId = request.getParameter("msgId");
if (msgId == null) {
MessageRenderer renderer = getMessageRenderer(request);
configureRenderer(request, renderer);
String selector = getSelector(request);
QueueBrowser browser = session.createBrowser(queue, selector);
renderer.renderMessages(request, response, browser);
}
else {
XmlMessageRenderer renderer = new XmlMessageRenderer();
QueueBrowser browser = session.createBrowser(queue, "JMSMessageID='" + msgId + "'");
if (!browser.getEnumeration().hasMoreElements()) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
Message message = (Message) browser.getEnumeration().nextElement();
PrintWriter writer = response.getWriter();
renderer.renderMessage(writer, request, response, browser, message);
writer.flush();
}
}
catch (JMSException e) {
throw new ServletException(e);