}
@Override
public Status onInitStream(File f) throws StorageServletException
{
StorageMime mime;
File mimeFile;
int i;
String s;
try
{
mimeFile = new File(f.getAbsolutePath() + ".mime");
mime = StorageMime.load(mimeFile);
}
catch (Exception e)
{
mime = new StorageMime();
i = f.getAbsolutePath().lastIndexOf(".");
if (i >= 0)
{
s = f.getAbsolutePath().substring(i + 1);
if (defaultMime.containsKey(s))
mime.setContentType(defaultMime.get(s));
else
log.info("no mime for '" + f.getAbsolutePath() + "', using none.");
}
}
this.response.setContentLength((int) f.length());
this.response.setStatus(mime.getStatus());
this.response.setContentType(mime.getContentType());
return StorageServletEvents.Status.CONTINUE;
}