DAVResource resource) throws AuthorizeException, SQLException,
IOException
{
Element b = new Element("bitstream", DAV.NS_DSPACE);
long length = bitstream.getSize();
BitstreamFormat bf = bitstream.getFormat();
if (length > BITSTREAM_INLINE_THRESHOLD)
{
Element e = new Element("link", DAV.NS_DSPACE);
e.setAttribute("href", resource.hrefPrefix() + "retrieve_"
+ String.valueOf(bitstream.getID()));
b.addContent(e);
}
else
{
Element e = new Element("content", DAV.NS_DSPACE);
if (bf != null)
{
e.setAttribute("contenttype", bf.getMIMEType());
}
e.setAttribute("contentlength", String.valueOf(length));
e.setAttribute("contentencoding", "base64");
b.addContent(e);