log.info(LogManager.getHeader(context, "view_bitstream", "invalid_bitstream_id=" + idString));  JSPManager.showInvalidIDError(request, response, idString, Constants.BITSTREAM);
log.info(LogManager.getHeader(context, "view_bitstream", "item has been withdrawn")); JSPManager.showJSP(request, response, "/tombstone.jsp");
    protected void doDSGet(Context context, HttpServletRequest request,            HttpServletResponse response) throws ServletException, IOException,            SQLException, AuthorizeException    {        Bitstream bitstream = null;        // Get the ID from the URL        String idString = request.getPathInfo();        String handle = "";        String sequence = "";        if (idString != null)        {             // Parse 'handle' and 'sequence' (bitstream seq. number) out             // of remaining URL path, which is typically of the format:             //    {handle}/{sequence}/{bitstream-name}             // But since the bitstream name MAY have any number of "/"s in             // it, and the handle is guaranteed to have one slash, we             // scan from the start to pick out handle and sequence:             // Remove leading slash if any:            if (idString.startsWith("/"))            {                idString = idString.substring(1);            }            // skip first slash within handle            int slashIndex = idString.indexOf('/');            if (slashIndex != -1)            {                slashIndex = idString.indexOf('/', slashIndex + 1);                if (slashIndex != -1)                {                    handle = idString.substring(0, slashIndex);                    int slash2 = idString.indexOf('/', slashIndex + 1);                    if (slash2 != -1)                        sequence = idString.substring(slashIndex+1,slash2);                    else                        sequence = idString.substring(slashIndex+1);                }                else                    handle = idString;            }                        // Find the corresponding bitstream            try            {                Item item = (Item) HandleManager.resolveToObject(context,                        handle);                if (item == null)                {                    log.info(LogManager.getHeader(context, "invalid_id",                            "path=" + handle));                    JSPManager                            .showInvalidIDError(request, response, handle, -1);                    return;                }                int sid = Integer.parseInt(sequence);                boolean found = false;                Bundle[] bundles = item.getBundles();                for (int i = 0; (i < bundles.length) && !found; i++)                {                    Bitstream[] bitstreams = bundles[i].getBitstreams();                    for (int k = 0; (k < bitstreams.length) && !found; k++)                    {                        if (sid == bitstreams[k].getSequenceID())                        {                            bitstream = bitstreams[k];                            found = true;                        }                    }                }            }            catch (NumberFormatException nfe)            {                // Invalid ID - this will be dealt with below            }        }        // Did we get a bitstream?        if (bitstream != null)        {            log.info(LogManager.getHeader(context, "view_bitstream",                    "bitstream_id=" + bitstream.getID()));            // Set the response MIME type            response.setContentType(bitstream.getFormat().getMIMEType());            // Response length            response.setHeader("Content-Length", String.valueOf(bitstream                    .getSize()));            // Pipe the bits            InputStream is = bitstream.retrieve();            Utils.bufferedCopy(is, response.getOutputStream());            is.close();            response.getOutputStream().flush();        }        else        {            // No bitstream - we got an invalid ID            log.info(LogManager.getHeader(context, "view_bitstream",                    "invalid_bitstream_id=" + idString));            JSPManager.showInvalidIDError(request, response, idString,                    Constants.BITSTREAM);        }    }