Source Code Cross Referenced for GetMap.java in  » GIS » GeoServer » org » vfny » geoserver » wms » servlets » 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.servlets 
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.servlets;
006:
007:        import org.vfny.geoserver.Request;
008:        import org.vfny.geoserver.Response;
009:        import org.vfny.geoserver.ServiceException;
010:        import org.vfny.geoserver.global.WMS;
011:        import org.vfny.geoserver.util.requests.readers.KvpRequestReader;
012:        import org.vfny.geoserver.util.requests.readers.XmlRequestReader;
013:        import org.vfny.geoserver.wms.requests.GetMapKvpReader;
014:        import org.vfny.geoserver.wms.requests.GetMapXmlReader;
015:        import org.vfny.geoserver.wms.responses.GetMapResponse;
016:        import java.io.IOException;
017:        import java.io.Reader;
018:        import java.util.Map;
019:        import javax.servlet.ServletException;
020:        import javax.servlet.http.HttpServletRequest;
021:        import javax.servlet.http.HttpServletResponse;
022:
023:        /**
024:         * WMS service wich returns request and response handlers to manage a GetMap
025:         * request
026:         *
027:         * @author Gabriel Rold?n
028:         * @version $Id: GetMap.java 6326 2007-03-15 18:36:40Z jdeolive $
029:         */
030:        public class GetMap extends WMService {
031:            /**
032:             * Part of HTTP content type header.
033:             */
034:            public static final String URLENCODED = "application/x-www-form-urlencoded";
035:
036:            /**
037:             * Creates a new GetMap object.
038:             *
039:             */
040:            public GetMap(WMS wms) {
041:                super ("GetMap", wms);
042:            }
043:
044:            protected GetMap(String id, WMS wms) {
045:                super (id, wms);
046:            }
047:
048:            // TODO: check is this override adds any value compared to the superclass one,
049:            // remove otherwise
050:            public void doPost(HttpServletRequest request,
051:                    HttpServletResponse response) throws ServletException,
052:                    IOException {
053:                //If the post is of mime-type application/x-www-form-urlencoded
054:                //Then the get system can handle it. For all other requests the
055:                //post code must handle it.
056:                if (isURLEncoded(request)) {
057:                    doGet(request, response);
058:
059:                    return;
060:                }
061:
062:                //DJB: added post support
063:                Request serviceRequest = null;
064:
065:                //        this.curRequest = request;
066:                if (!isServiceEnabled(request)) {
067:                    sendDisabledServiceError(response);
068:
069:                    return;
070:                }
071:
072:                //we need to construct an approriate serviceRequest from the GetMap XML POST.
073:                try {
074:                    GetMapXmlReader xmlPostReader = new GetMapXmlReader(this );
075:
076:                    Reader xml = request.getReader();
077:                    serviceRequest = xmlPostReader.read(xml, request);
078:                } catch (ServiceException se) {
079:                    sendError(request, response, se);
080:
081:                    return;
082:                } catch (Throwable e) {
083:                    sendError(request, response, e);
084:
085:                    return;
086:                }
087:
088:                doService(request, response, serviceRequest);
089:            }
090:
091:            /**
092:             * DOCUMENT ME!
093:             *
094:             * @return DOCUMENT ME!
095:             */
096:            protected Response getResponseHandler() {
097:                return new GetMapResponse(getWMS(), getApplicationContext());
098:            }
099:
100:            /**
101:             * DOCUMENT ME!
102:             *
103:             * @return DOCUMENT ME!
104:             *
105:             * @throws java.lang.UnsupportedOperationException DOCUMENT ME!
106:             */
107:            protected XmlRequestReader getXmlRequestReader() {
108:                return new GetMapXmlReader(this );
109:            }
110:
111:            /**
112:             * DOCUMENT ME!
113:             *
114:             * @param params DOCUMENT ME!
115:             *
116:             * @return DOCUMENT ME!
117:             */
118:            protected KvpRequestReader getKvpReader(Map params) {
119:                Map layers = this .getWMS().getBaseMapLayers();
120:                Map styles = this .getWMS().getBaseMapStyles();
121:
122:                GetMapKvpReader kvp = new GetMapKvpReader(params, this );
123:
124:                // filter layers and styles if the user specified "layers=basemap"
125:                // This must happen after the kvp reader has been initially called
126:                if ((layers != null) && !layers.equals("")) {
127:                    kvp.filterBaseMap(layers, styles);
128:                }
129:
130:                return kvp;
131:            }
132:
133:            /**
134:             * A method that decides if a request is a multipart request.
135:             * <p>
136:             * <a href="http://www.w3.org/TR/REC-html40/interact/forms.html#form-content-type">w3.org content type</a>
137:             * </p>
138:             *
139:             * @param req the servlet request
140:             * @return if this is multipart or not
141:             */
142:            public boolean isURLEncoded(HttpServletRequest req) {
143:                //Get the content type from the request
144:                String contentType = req.getContentType();
145:
146:                //If there is no content type, then it is not multipart
147:                if (contentType == null) {
148:                    return false;
149:                }
150:
151:                //If it starts with multipart/ then it is multipart
152:                return contentType.toLowerCase().startsWith(URLENCODED);
153:            }
154:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.