1 28 29 package com.caucho.server.webapp; 30 31 import com.caucho.util.L10N; 32 33 import javax.annotation.PostConstruct; 34 import javax.servlet.ServletException ; 35 36 39 public class MimeMapping { 40 static L10N L = new L10N(MimeMapping.class); 41 42 private String _extension; 44 45 private String _mimeType; 47 48 51 public MimeMapping() 52 { 53 } 54 55 58 public void setExtension(String extension) 59 throws ServletException 60 { 61 if (! extension.startsWith(".")) 62 extension = "." + extension; 63 64 _extension = extension; 65 } 66 67 70 public String getExtension() 71 { 72 return _extension; 73 } 74 75 78 public void setMimeType(String mimeType) 79 { 80 _mimeType = mimeType; 81 } 82 83 86 public String getMimeType() 87 { 88 return _mimeType; 89 } 90 91 94 @PostConstruct 95 public void init() 96 throws ServletException 97 { 98 if (_extension == null) 99 throw new ServletException (L.l("mime-mapping needs 'extension' attribute.")); 100 if (_mimeType == null) 101 throw new ServletException (L.l("mime-mapping needs 'mime-type' attribute.")); 102 } 103 } 104 | Popular Tags |