Kevin and I have been having an off-list conversation. Thought it
worthwhile cc'ing onto the list.
~~~
Kevin,
within
On 07/04/2011 14:57, Kevin Meyer wrote:
@MimeType("application/pdf")
public MimeValue getDocument() { ... }
Mrr.. I suspect MimeValue would need to be generic enough that the
"MimeType" would be a property that can be determined by looking at
(for example) the byte stream (a la *nix's Magic Number engine) or
by media name... I'm assuming that Name would correspond to the filename.
Not sure about that idea.
My idea was motivated from thinking about how HTTP responses work, where
the mime-type is specified as a content header before the body of the
response (ie the stream). If it works well enough for HTTP, it ought to
do for us.
Just did a little digging into the JDK... looks like
javax.activation.DataSource sort of represents what I meant. One of the
out-of-the-box implementations is URLDataSource, or we could provide a
ByteArrayDataSource etc.
Worth raising a ticket for?
I guess the iconName() method could be used to return the
thumbnail... then the "value" would be actual content, and handled by
the browser already (provided the correct content type was sent to the
browser?).
Yes, it can be used as well; but I think it should only be considered as
a hint to the content of an object (in the same way that an object's
title is a hint also). And... there can only be one icon, whereas you
might want to have multiple mime values for an object (eg
front/side/back elevations of a Building, say).
Actually, I'm saying that the thumbnail *is* a representation of the
content, not the fact that is a (e.g. PDF, vs spreadsheet). Like the
thumbnail that you see in Nautilus... For images, this is dead easy,
for other document formats, a little more tricky..?
But this would require (for example) that if iconName() returns a string
beginning with ^ (or whatever), look in an alternate directory for the
icon.... ? Otherwise it must "just" return a full, absolute (server
relative) path.
Yes, understood. Rather than invent lots of new conventions, I think a
good first pass would simply be to allow the iconName() to return a URL,
that the viewer could fetch and render appropriately.
Worth raising a (different) ticket for?