Hi,
On Tue, Jan 6, 2009 at 11:58 AM, iapilgrim <[email protected]> wrote:
> When I tried to add this line
> if(f.getName().endsWith(".txt")){
> metadata.add(Metadata.CONTENT_TYPE, "text/plain");
> }
> It runs OK.
Better yet, as suggested by Karl, just pass the original file name as
a part of the metadata:
metadata.add(Metadata.RESOURCE_NAME_KEY, f.getName());
The AutoDetectParser already knows about the ".txt" suffix, and it can
actually use the file name to guess a number of other content types as
well. No need for you to encode those rules in your application.
BR,
Jukka Zitting