Source Code Cross Referenced for CapabilitiesXmlReader.java in  » GIS » GeoServer » org » vfny » geoserver » wcs » requests » readers » 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.wcs.requests.readers 
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.wcs.requests.readers;
006:
007:        import org.vfny.geoserver.Request;
008:        import org.vfny.geoserver.util.requests.CapabilitiesHandler;
009:        import org.vfny.geoserver.util.requests.readers.XmlRequestReader;
010:        import org.vfny.geoserver.wcs.WcsException;
011:        import org.vfny.geoserver.wcs.requests.WCSCapabilitiesRequest;
012:        import org.vfny.geoserver.wcs.servlets.WCService;
013:        import org.xml.sax.InputSource;
014:        import org.xml.sax.SAXException;
015:        import org.xml.sax.helpers.ParserAdapter;
016:        import java.io.IOException;
017:        import java.io.Reader;
018:        import javax.servlet.http.HttpServletRequest;
019:        import javax.xml.parsers.ParserConfigurationException;
020:        import javax.xml.parsers.SAXParser;
021:        import javax.xml.parsers.SAXParserFactory;
022:
023:        /**
024:         * reads a WCS GetCapabilities request from an XML stream
025:         *
026:         * @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last modification)
027:         * @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last modification)
028:         * @version $Id: CapabilitiesXmlReader.java 6326 2007-03-15 18:36:40Z jdeolive $
029:         */
030:        public class CapabilitiesXmlReader extends XmlRequestReader {
031:            /**
032:             * Constructs a new reader.
033:             *
034:             * @param service The WFS service handling the request.
035:             */
036:            public CapabilitiesXmlReader(WCService service) {
037:                super (service);
038:            }
039:
040:            /**
041:             * Reads the Capabilities XML request into a CapabilitiesRequest object.
042:             *
043:             * @param reader The plain POST text from the client.
044:             *
045:             * @return The read CapabilitiesRequest object.
046:             *
047:             * @throws WmsException For any problems reading the request
048:             */
049:            public Request read(Reader reader, HttpServletRequest req)
050:                    throws WcsException {
051:                InputSource requestSource = new InputSource(reader);
052:
053:                // instantiante parsers and content handlers
054:                CapabilitiesHandler currentRequest = new CapabilitiesHandler(
055:                        new WCSCapabilitiesRequest(getServiceRef()));
056:
057:                // read in XML file and parse to content handler
058:                try {
059:                    SAXParserFactory factory = SAXParserFactory.newInstance();
060:                    SAXParser parser = factory.newSAXParser();
061:                    ParserAdapter adapter = new ParserAdapter(parser
062:                            .getParser());
063:                    adapter.setContentHandler(currentRequest);
064:                    adapter.parse(requestSource);
065:                    LOGGER.fine("just parsed: " + requestSource);
066:                } catch (SAXException e) {
067:                    throw new WcsException(e,
068:                            "XML capabilities request parsing error",
069:                            getClass().getName());
070:                } catch (IOException e) {
071:                    throw new WcsException(e,
072:                            "XML capabilities request input error", getClass()
073:                                    .getName());
074:                } catch (ParserConfigurationException e) {
075:                    throw new WcsException(e,
076:                            "Some sort of issue creating parser", getClass()
077:                                    .getName());
078:                }
079:
080:                Request r = currentRequest.getRequest(req);
081:
082:                if (r.getService() != null) {
083:                    final String service = r.getService();
084:
085:                    if (!service.trim().toUpperCase().startsWith("WCS")) {
086:                        throw new WcsException("SERVICE parameter is wrong.");
087:                    }
088:                } else {
089:                    throw new WcsException("SERVICE parameter is mandatory.");
090:                }
091:
092:                if (r.getVersion() != null) {
093:                    final String version = r.getVersion();
094:
095:                    if (!version.equals("1.0.0")) {
096:                        throw new WcsException("VERSION parameter is wrong.");
097:                    }
098:                } else {
099:                    throw new WcsException("VERSION parameter is mandatory.");
100:                }
101:
102:                /*if (r.getRequest() != null) {
103:                        final String requestType = r.getRequest();
104:                        if (!requestType.equalsIgnoreCase("GetCapabilities") ) {
105:                                throw new WcsException("REQUEST parameter is wrong.");
106:                        }
107:                } else {
108:                        throw new WcsException("REQUEST parameter is mandatory.");
109:                }*/
110:                return r;
111:            }
112:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.