Source Code Cross Referenced for WmsException.java in  » GIS » GeoServer » org » vfny » geoserver » wms » 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 » GeoServer » org.vfny.geoserver.wms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
002:         * This code is licensed under the GPL 2.0 license, availible at the root
003:         * application directory.
004:         */
005:        package org.vfny.geoserver.wms;
006:
007:        import org.vfny.geoserver.ServiceException;
008:        import org.vfny.geoserver.global.GeoServer;
009:        import org.vfny.geoserver.util.Requests;
010:        import javax.servlet.http.HttpServletRequest;
011:
012:        /**
013:         * This defines an exception that can be turned into a valid xml service
014:         * exception that wms clients will expect.  All errors should be wrapped in
015:         * this before returning to clients.
016:         *
017:         * @author Gabriel Rold?n
018:         * @version $Id: WmsException.java 7639 2007-10-22 15:18:58Z aaime $
019:         */
020:        public class WmsException extends ServiceException {
021:            /**
022:             * The fixed MIME type of a WMS exception.
023:             */
024:            private static final String SE_XML = "application/vnd.ogc.se_xml";
025:
026:            /**
027:             * Enum of exception codes defined in Anex A.3 of WMS 1.1.1 spec
028:            public static class ExceptionCodeEnum{
029:                    private String exceptionCode;
030:                    private ExceptionCodeEnum(String code){
031:                            this.exceptionCode = code;
032:                    }
033:                    public String toString(){
034:                            return exceptionCode;
035:                    }
036:            }
037:            public static final ExceptionCodeEnum InvalidFormat = new ExceptionCodeEnum("InvalidFormat");
038:            public static final ExceptionCodeEnum InvalidSRS = new ExceptionCodeEnum("InvalidSRS");
039:            public static final ExceptionCodeEnum LayerNotDefined = new ExceptionCodeEnum("LayerNotDefined");
040:            public static final ExceptionCodeEnum StyleNotDefined = new ExceptionCodeEnum("StyleNotDefined");
041:            public static final ExceptionCodeEnum LayerNotQueryable = new ExceptionCodeEnum("LayerNotQueryable");
042:            public static final ExceptionCodeEnum CurrentUpdateSequence = new ExceptionCodeEnum("CurrentUpdateSequence");
043:            public static final ExceptionCodeEnum InvalidUpdateSequence = new ExceptionCodeEnum("InvalidUpdateSequence");
044:            public static final ExceptionCodeEnum MissingDimensionValue = new ExceptionCodeEnum("MissingDimensionValue");
045:            public static final ExceptionCodeEnum InvalidDimensionValue = new ExceptionCodeEnum("InvalidDimensionValue");
046:             */
047:
048:            /**
049:             * Empty constructor.
050:             */
051:            public WmsException() {
052:                super ();
053:            }
054:
055:            /**
056:             * constructor with exception message
057:             *
058:             * @param message The message for the exception
059:             */
060:            public WmsException(String message) {
061:                super (message);
062:            }
063:
064:            public WmsException(ServiceException e) {
065:                super (e);
066:            }
067:
068:            /**
069:             * Empty constructor.
070:             *
071:             * @param e The message for the .
072:             */
073:            public WmsException(Throwable e) {
074:                super (e.getMessage(), e);
075:            }
076:
077:            /**
078:             * Empty constructor.
079:             *
080:             * @param message The message for the .
081:             * @param locator The message for the .
082:             */
083:            public WmsException(String message, String code) {
084:                super (message);
085:                setCode(code);
086:            }
087:
088:            /**
089:             * Empty constructor.
090:             *
091:             * @param message The message for the .
092:             * @param locator The message for the .
093:             */
094:            public WmsException(String message, String code, Exception e) {
095:                super (message, e);
096:                setCode(code);
097:            }
098:
099:            /**
100:             * DOCUMENT ME!
101:             *
102:             * @param e The message for the .
103:             * @param preMessage The message to tack on the front.
104:             * @param locator The message for the .
105:             */
106:            public WmsException(Throwable e, String preMessage, String locator) {
107:                super (e, preMessage, locator);
108:            }
109:
110:            public WmsException(Throwable e, String preMessage, String locator,
111:                    String code) {
112:                this (e, preMessage, locator);
113:                setCode(code);
114:            }
115:
116:            /**
117:             * Return request type.
118:             *
119:             * @param printStackTrace whether the stack trace should be included.
120:             *
121:             * @return The ServiceExceptionReport of this error.
122:             *
123:             * @task REVISIT: adapt it to handle WMS too
124:             */
125:            public String getXmlResponse(boolean printStackTrace,
126:                    HttpServletRequest request, GeoServer geoserver) {
127:                StringBuffer returnXml = new StringBuffer(
128:                        "<?xml version=\"1.0\"");
129:                returnXml.append(" encoding=\"UTF-8\" standalone=\"no\" ?>");
130:
131:                String dtdUrl = Requests.getSchemaBaseUrl(request, geoserver)
132:                        + "/wms/1.1.1/WMS_exception_1_1_1.dtd";
133:                returnXml.append("<!DOCTYPE ServiceExceptionReport SYSTEM \""
134:                        + dtdUrl + "\"> ");
135:                returnXml.append("<ServiceExceptionReport version=\"1.1.1\">");
136:
137:                // Write exception code
138:                returnXml
139:                        .append("    <ServiceException"
140:                                + ((getCode() != null) ? (" code=\""
141:                                        + getCode() + "\"") : "") + ">"
142:                                + getXmlMessage(printStackTrace)
143:                                + "</ServiceException>");
144:
145:                // Write footer
146:                returnXml.append("  </ServiceExceptionReport>");
147:
148:                return returnXml.toString();
149:            }
150:
151:            /**
152:             * Returns the MIME type of a WMS exception.
153:             *
154:             * @return <code>"application/vnd.ogc.se_xml"</code>
155:             */
156:            public String getMimeType(GeoServer geoserver) {
157:                return SE_XML;
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.