Package com.trustyoram.web.storage.config

Examples of com.trustyoram.web.storage.config.StorageMime


  }
 
  @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;
  }
View Full Code Here

TOP

Related Classes of com.trustyoram.web.storage.config.StorageMime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.