Hi all,

Is there an easy way to get bitstream URLs from a DSpace item? I'm doing some 
funky stuff to get it here (ignore the lines about PDF; in this case I'm only 
want the URL if the bitstream is a PDF):

        itemURL = HandleManager.resolveToURL(new Context(), item.getHandle());

        boolean pdf = false;
        String bsLink = "";

        Bundle[] bunds = item.getBundles("ORIGINAL");

        if (bunds[0] != null)
        {
            Bitstream[] bits = bunds[0].getBitstreams();

            for (int i = 0; (i < bits.length) && !pdf; i++)
            {
                if (bits[i].getFormat().getMIMEType().equals("application/pdf"))
                {
                    pdf = true;
                    bsLink = ConfigurationManager.getProperty("dspace.url")
                            + "/bitstream/handle/"
                            + item.getHandle() + "/"
                            + bits[i].getName() + "?sequence="
                            + bits[i].getSequenceID();
                }
            }
        }

        String pdfURL = bsLink;



Thanks!
Bill
--
Bill Ingram
Scholarly Communication and
Repository Services
University of Illinois at Urbana-Champaign
135 GELIC, MC274
1301 W. Springfield Ave.
Urbana, IL 61801
217-333-4648
wingr...@illinois.edu

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to