Source Code Cross Referenced for MimeTypeService.java in  » Web-Framework » TURBINE » org » apache » turbine » services » mimetype » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » TURBINE » org.apache.turbine.services.mimetype 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.turbine.services.mimetype;
002:
003:        /*
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *   http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:
022:        import java.io.File;
023:        import java.util.Locale;
024:
025:        import org.apache.turbine.services.Service;
026:        import org.apache.turbine.services.mimetype.util.MimeType;
027:
028:        /**
029:         * The MimeType Service maintains mappings between MIME types and
030:         * the corresponding file name extensions, and between locales and
031:         * character encodings. The mappings are typically defined in
032:         * properties or files located in user's home directory, Java home
033:         * directory or the current class jar depending on the implementation.
034:         *
035:         * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
036:         * @version $Id: MimeTypeService.java 534527 2007-05-02 16:10:59Z tv $
037:         */
038:        public interface MimeTypeService extends Service {
039:            /**
040:             * The name of the service.
041:             */
042:            String SERVICE_NAME = "MimeTypeService";
043:
044:            /**
045:             * Sets a MIME content type mapping to extensions to the map.
046:             * The extension is specified by a MIME type name followed
047:             * by a list of file name extensions separated by a whitespace.
048:             *
049:             * @param spec a MIME type extension specification to add.
050:             */
051:            void setContentType(String spec);
052:
053:            /**
054:             * Gets the MIME content type for a file as a string.
055:             *
056:             * @param file the file.
057:             * @return the MIME type string.
058:             */
059:            String getContentType(File file);
060:
061:            /**
062:             * Gets the MIME content type for a named file as a string.
063:             *
064:             * @param name the name of the file.
065:             * @return the MIME type string.
066:             */
067:            String getContentType(String name);
068:
069:            /**
070:             * Gets the MIME content type for a file name extension as a string.
071:             *
072:             * @param ext the file name extension.
073:             * @param def the default type if none is found.
074:             * @return the MIME type string.
075:             */
076:            String getContentType(String ext, String def);
077:
078:            /**
079:             * Gets the MIME content type for a file.
080:             *
081:             * @param file the file.
082:             * @return the MIME type.
083:             */
084:            MimeType getMimeContentType(File file);
085:
086:            /**
087:             * Gets the MIME content type for a named file.
088:             *
089:             * @param name the name of the file.
090:             * @return the MIME type.
091:             */
092:            MimeType getMimeContentType(String name);
093:
094:            /**
095:             * Gets the MIME content type for a file name extension.
096:             *
097:             * @param ext the file name extension.
098:             * @param def the default type if none is found.
099:             * @return the MIME type.
100:             */
101:            MimeType getMimeContentType(String ext, String def);
102:
103:            /**
104:             * Gets the default file name extension for a MIME type.
105:             * Note that the mappers are called in the reverse order.
106:             *
107:             * @param type the MIME type as a string.
108:             * @return the file name extension or null.
109:             */
110:            String getDefaultExtension(String type);
111:
112:            /**
113:             * Gets the default file name extension for a MIME type.
114:             * Note that the mappers are called in the reverse order.
115:             *
116:             * @param mime the MIME type.
117:             * @return the file name extension or null.
118:             */
119:            String getDefaultExtension(MimeType mime);
120:
121:            /**
122:             * Sets a locale-charset mapping.
123:             *
124:             * @param key the key for the charset.
125:             * @param charset the corresponding charset.
126:             */
127:            void setCharSet(String key, String charset);
128:
129:            /**
130:             * Gets the charset for a locale. First a locale specific charset
131:             * is searched for, then a country specific one and lastly a language
132:             * specific one. If none is found, the default charset is returned.
133:             *
134:             * @param locale the locale.
135:             * @return the charset.
136:             */
137:            String getCharSet(Locale locale);
138:
139:            /**
140:             * Gets the charset for a locale with a variant. The search
141:             * is performed in the following order:
142:             * "lang"_"country"_"variant"="charset",
143:             * _"counry"_"variant"="charset",
144:             * "lang"__"variant"="charset",
145:             * __"variant"="charset",
146:             * "lang"_"country"="charset",
147:             * _"country"="charset",
148:             * "lang"="charset".
149:             * If nothing of the above is found, the default charset is returned.
150:             *
151:             * @param locale the locale.
152:             * @param variant a variant field.
153:             * @return the charset.
154:             */
155:            String getCharSet(Locale locale, String variant);
156:
157:            /**
158:             * Gets the charset for a specified key.
159:             *
160:             * @param key the key for the charset.
161:             * @return the found charset or the default one.
162:             */
163:            String getCharSet(String key);
164:
165:            /**
166:             * Gets the charset for a specified key.
167:             *
168:             * @param key the key for the charset.
169:             * @param def the default charset if none is found.
170:             * @return the found charset or the given default.
171:             */
172:            String getCharSet(String key, String def);
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.