Source Code Cross Referenced for MimeTypeMapper.java in  » GIS » deegree » org » deegree » framework » util » 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 » GIS » deegree » org.deegree.framework.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/framework/util/MimeTypeMapper.java $
002:        /*----------------    FILE HEADER  ------------------------------------------
003:
004:         This file is part of deegree.
005:         Copyright (C) 2001-2008 by:
006:         EXSE, Department of Geography, University of Bonn
007:         http://www.giub.uni-bonn.de/deegree/
008:         lat/lon GmbH
009:         http://www.lat-lon.de
010:
011:         This library is free software; you can redistribute it and/or
012:         modify it under the terms of the GNU Lesser General Public
013:         License as published by the Free Software Foundation; either
014:         version 2.1 of the License, or (at your option) any later version.
015:
016:         This library is distributed in the hope that it will be useful,
017:         but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019:         Lesser General Public License for more details.
020:
021:         You should have received a copy of the GNU Lesser General Public
022:         License along with this library; if not, write to the Free Software
023:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:
025:         Contact:
026:
027:         Andreas Poth
028:         lat/lon GmbH
029:         Aennchenstr. 19
030:         53115 Bonn
031:         Germany
032:         E-Mail: poth@lat-lon.de
033:
034:         Prof. Dr. Klaus Greve
035:         Department of Geography
036:         University of Bonn
037:         Meckenheimer Allee 166
038:         53115 Bonn
039:         Germany
040:         E-Mail: greve@giub.uni-bonn.de
041:
042:        
043:         ---------------------------------------------------------------------------*/
044:        package org.deegree.framework.util;
045:
046:        /**
047:         *
048:         * <p>
049:         * @author <a href="mailto:schaefer@lat-lon.de">Axel Schaefer</a>
050:         ** @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
051:         * @version
052:         */
053:        public class MimeTypeMapper {
054:
055:            /**
056:             * returns true if the submitted content type is defined by the OGC
057:             *
058:             * @param contentType 
059:             *
060:             * @return 
061:             */
062:            public static boolean isOGCType(String contentType) {
063:                return contentType.startsWith("application/vnd.ogc");
064:            }
065:
066:            /**
067:             * returns true if the submitted content type is an image type
068:             *
069:             * @param contentType 
070:             *
071:             * @return 
072:             */
073:            public static boolean isImageType(String contentType) {
074:                return contentType.startsWith("image");
075:            }
076:
077:            /**
078:             * returns true if the submitted image content type is known by the deegree 
079:             * implementations
080:             *
081:             * @param contentType 
082:             *
083:             * @return 
084:             */
085:            public static boolean isKnownImageType(String contentType) {
086:                return contentType.equalsIgnoreCase("image/jpeg")
087:                        || contentType.equalsIgnoreCase("image/jpg")
088:                        || contentType.equalsIgnoreCase("image/gif")
089:                        || contentType.equalsIgnoreCase("image/tif")
090:                        || contentType.equalsIgnoreCase("image/tiff")
091:                        || contentType.equalsIgnoreCase("image/bmp")
092:                        || contentType.equalsIgnoreCase("image/svg+xml")
093:                        || contentType.equalsIgnoreCase("image/png");
094:            }
095:
096:            /**
097:             * returns true if the submitted content type is known by the deegree OWS
098:             * implementations
099:             *
100:             * @param contentType 
101:             *
102:             * @return 
103:             */
104:            public static boolean isKnownMimeType(String contentType) {
105:                return contentType.equalsIgnoreCase("image/jpeg")
106:                        || contentType.equalsIgnoreCase("image/jpg")
107:                        || contentType.equalsIgnoreCase("image/gif")
108:                        || contentType.equalsIgnoreCase("image/tif")
109:                        || contentType.equalsIgnoreCase("image/tiff")
110:                        || contentType.equalsIgnoreCase("image/png")
111:                        || contentType.equalsIgnoreCase("text/html")
112:                        || contentType.equalsIgnoreCase("text/text")
113:                        || contentType.equalsIgnoreCase("text/plain")
114:                        || contentType.equalsIgnoreCase("text/xml")
115:                        || contentType.equalsIgnoreCase("image/bmp")
116:                        || contentType.equalsIgnoreCase("application/xml")
117:                        || contentType
118:                                .equalsIgnoreCase("application/vnd.ogc.se_xml")
119:                        || contentType
120:                                .equalsIgnoreCase("application/vnd.ogc.se_inimage")
121:                        || contentType
122:                                .equalsIgnoreCase("application/vnd.ogc.se_blank")
123:                        || contentType
124:                                .equalsIgnoreCase("application/vnd.ogc.wms_xml")
125:                        || contentType
126:                                .equalsIgnoreCase("application/vnd.ogc.gml")
127:                        || contentType
128:                                .equalsIgnoreCase("application/vnd.gdinrw.session_xml")
129:                        || contentType
130:                                .equalsIgnoreCase("application/vnd.gdinrw.secure_xml")
131:                        || contentType.equalsIgnoreCase("image/svg+xml");
132:            }
133:
134:            /**
135:             * returns true if the submitted content type is a mime type defined by a
136:             * OGC specifiction
137:             *
138:             * @param contentType 
139:             *
140:             * @return 
141:             */
142:            public static boolean isKnownOGCType(String contentType) {
143:                return contentType.equalsIgnoreCase("application/xml")
144:                        || contentType
145:                                .equalsIgnoreCase("application/vnd.ogc.se_xml")
146:                        || contentType
147:                                .equalsIgnoreCase("application/vnd.ogc.se_inimage")
148:                        || contentType
149:                                .equalsIgnoreCase("application/vnd.ogc.se_blank")
150:                        || contentType
151:                                .equalsIgnoreCase("application/vnd.ogc.wms_xml")
152:                        || contentType
153:                                .equalsIgnoreCase("application/vnd.gdinrw.session_xml")
154:                        || contentType
155:                                .equalsIgnoreCase("application/vnd.gdinrw.secure_xml")
156:                        || contentType
157:                                .equalsIgnoreCase("application/vnd.ogc.gml");
158:            }
159:
160:            /**
161:             * maps a 'simple' format name like gif, jpg or text to the corresponding
162:             * mime type --> e.g. image/gif, image/jpeg or text/plain
163:             *
164:             * @param contentType 
165:             *
166:             * @return 
167:             */
168:            public static String toMimeType(String contentType) {
169:
170:                String mimetype = "";
171:
172:                if (isKnownMimeType(contentType)) {
173:                    mimetype = contentType;
174:                } else {
175:                    if (contentType.equalsIgnoreCase("jpeg")) {
176:                        mimetype = "image/jpeg";
177:                    } else if (contentType.equalsIgnoreCase("jpg")) {
178:                        mimetype = "image/jpeg";
179:                    } else if (contentType.equalsIgnoreCase("gif")) {
180:                        mimetype = "image/gif";
181:                    } else if (contentType.equalsIgnoreCase("png")) {
182:                        mimetype = "image/png";
183:                    } else if (contentType.equalsIgnoreCase("bmp")) {
184:                        mimetype = "image/bmp";
185:                    } else if (contentType.equalsIgnoreCase("tif")) {
186:                        mimetype = "image/tiff";
187:                    } else if (contentType.equalsIgnoreCase("tiff")) {
188:                        mimetype = "image/tiff";
189:                    } else if (contentType.equalsIgnoreCase("svg")) {
190:                        mimetype = "image/svg+xml";
191:                    } else if (contentType.equalsIgnoreCase("xml")) {
192:                        mimetype = "text/xml";
193:                    } else if (contentType.equalsIgnoreCase("gml")) {
194:                        mimetype = "text/gml";
195:                    } else if (contentType.equalsIgnoreCase("text")) {
196:                        mimetype = "text/plain";
197:                    } else if (contentType.equalsIgnoreCase("inimage")) {
198:                        mimetype = "application/vnd.ogc.se_inimage";
199:                    } else if (contentType.equalsIgnoreCase("blank")) {
200:                        mimetype = "application/vnd.ogc.se_blank";
201:                    } else if (contentType.equalsIgnoreCase("gml")) {
202:                        mimetype = "application/vnd.ogc.gml";
203:                    } else {
204:                        // unknown mimetype
205:                        mimetype = "unknown/unknown";
206:                    }
207:                }
208:
209:                return mimetype;
210:            }
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.