id = ParsedItemID.Parse(idStr);
id = ParsedItemID.parse(idStr);
    private void getCommand(HttpServletRequest req, HttpServletResponse resp, AuthToken authToken)    throws ServletException, IOException    {        String idStr = req.getParameter(PARAM_MSGID);        if (idStr == null) {            resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "missing id parameter");            return;        }                ParsedItemID id = null;                try {            id = ParsedItemID.Parse(idStr);        } catch (ServiceException e) {            resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "invalid id requested");            return;        }        String part = req.getParameter(PARAM_PART);        String fmt = req.getParameter(PARAM_FORMAT);                try {            Mailbox mbox;            if (!id.isLocal()) {                resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "wrong server");                return;            }            if (!id.hasMailboxID()) {                mbox = Mailbox.getMailboxByAccountId(authToken.getAccountId());            } else {                if (!authToken.isAdmin()) {                    resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "admin auth token required");                    return;                }                mbox = Mailbox.getMailboxById(id.getMailboxIDInt());            }            if (mbox == null) {                resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "mailbox not found");                return;				            }                        MailItem mi = mbox.getItemById(id.getItemIDInt(), MailItem.TYPE_UNKNOWN);            if (mi== null) {                resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "message not found");                return;				            }            try {                if (part == null) {                    if (mi instanceof Message) {                        Message msg = (Message)mi;                        resp.setContentType(Mime.CT_TEXT_PLAIN);                        if ("1".equals(req.getParameter(PARAM_SYNC))) {                            // for sync, return metadata as headers to avoid extra SOAP round-trips                            StringBuffer sb = new StringBuffer();                            sb.append("X-Zimbra-Tags: ").append(msg.getTagString()).append("\n");                            sb.append("X-Zimbra-Flags: ").append(msg.getFlagString()).append("\n");                            sb.append("X-Zimbra-Conv: ").append(msg.getConversationId()).append("\n");                            sb.append("X-Zimbra-Received: ").append(msg.getDate()).append("\n");                            resp.getOutputStream().write(sb.toString().getBytes());                        }                        InputStream is = msg.getRawMessage();                        ByteUtil.copy(is, resp.getOutputStream());                        is.close();                    } else if (mi instanceof Appointment) {                        resp.setContentType(Mime.CT_TEXT_PLAIN);                        if (id.hasSubId()) {                            MimeMessage mm = ((Appointment)mi).getMimeMessage(id.getSubIdInt());                            mm.writeTo(resp.getOutputStream());                        } else {                             InputStream is;                            is = ((Appointment)mi).getRawMessage();                            ByteUtil.copy(is, resp.getOutputStream());                            is.close();                        }                    }                    return;                } else {                    MimePart mp;                    if (mi instanceof Message) {                        mp = getMimePart((Message)mi, part);                     } else {                        if (id.hasSubId()) {                            MimeMessage mbp = ((Appointment)mi).getMimeMessage(id.getSubIdInt());                            mp = Mime.getMimePart(mbp, part);                        } else {                            mp = getMimePart((Appointment)mi, part);                        }                    }                    if (mp != null) {                        String contentType = mp.getContentType();                        if (contentType == null)                            contentType = Mime.CT_APPLICATION_OCTET_STREAM;                        //mLog.info(contentType+" "+fmt);                        if (contentType.toLowerCase().startsWith(Mime.CT_TEXT_HTML) && ("htmldf".equals(fmt) || "htmldfi".equals(fmt))) {                            sendbackDefangedHtml(mp, contentType, resp, fmt);                        } else {                            if (!isTrue(Provisioning.A_zimbraAttachmentsViewInHtmlOnly, mbox.getAccountId())) {                                sendbackOriginalDoc(mp, contentType, resp);                            } else {                                req.setAttribute(ATTR_MIMEPART, mp);                                req.setAttribute(ATTR_MSGDIGEST, mi.getDigest());                                RequestDispatcher dispatcher = this.getServletContext().getNamedDispatcher(CONVERSION_SERVLET);                                dispatcher.forward(req, resp);                            }                        }                        return;                    }                    resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "part not found");                }            } catch (MessagingException e) {                resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());            }         } catch (ServiceException e) {            throw new ServletException(e);		}        /*         out.println("hello world "+req.getParameter("id"));         out.println("path info: "+req.getPathInfo());         out.println("pathtrans: "+req.getPathTranslated());         */    }