FileDocCategorySizeDatePackage
ViewMsgReqHandler.javaAPI DocExample1548Sun Sep 02 14:59:06 BST 2001com.oreilly.forum.servlet

ViewMsgReqHandler

public class ViewMsgReqHandler extends ReqHandler
Handle a request to view a message.

Fields Summary
Constructors Summary
Methods Summary
protected RendererdoGet(javax.servlet.http.HttpServlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        try {
            DataAdapter adapter = DataAdapter.getInstance();

            // msgID is a required parameter and must be valid
            String msgIDStr = request.getParameter("msgID");

            if (msgIDStr == null) {
                servlet.log("Required parameter 'msgID' was missing");
                return new ErrorRenderer("Invalid request");
            }

            Message msg = adapter.getMessage(Long.parseLong(msgIDStr));
            MessageSummary inResponseTo = null;
            if (msg.getInReplyTo() > -1) {
                inResponseTo = adapter.getMessage(msg.getInReplyTo());
            }
            return new ViewMsgRenderer(msg, inResponseTo);
        } catch (NumberFormatException nfe) {
            servlet.log("'msgID' parameter was not a number");
            return new ErrorRenderer("Invalid request");
        } catch (DataException de) {
            return new ErrorRenderer(de);
        }
    
protected java.lang.StringgetPathInfo()

        return "viewMsg";