Source Code Cross Referenced for WmsDispatcher.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.servlets.Dispatcher;
008:        import org.vfny.geoserver.util.requests.readers.DispatcherKvpReader;
009:        import org.vfny.geoserver.util.requests.readers.KvpRequestReader;
010:        import java.io.IOException;
011:        import java.util.Map;
012:        import java.util.logging.Logger;
013:        import javax.servlet.ServletException;
014:        import javax.servlet.http.HttpServlet;
015:        import javax.servlet.http.HttpServletRequest;
016:        import javax.servlet.http.HttpServletResponse;
017:
018:        /**
019:         * Routes requests made at the top-level URI to appropriate interface servlet.
020:         * Note that the logic of this method could be generously described as
021:         * 'loose.' It is not checking for request validity in any way (this is done
022:         * by the reqeust- specific servlets).  Rather, it is attempting to make a
023:         * reasonable guess as to what servlet to call, given that the client is
024:         * routing to the top level URI as opposed to the request-specific URI, as
025:         * specified in the GetCapabilities response. Thus, this is a convenience
026:         * method, which allows for some slight client laziness and helps explain to
027:         * lost souls/spiders what lives at the URL. Due to the string parsing, it is
028:         * much faster (and recommended) to use the URIs specified in the
029:         * GetCapabablities response.  Currently does not support post requests, but
030:         * most requests for this will likely come with get.
031:         *
032:         * @author Chris Holmes, TOPP
033:         * @version $Id: WmsDispatcher.java 7746 2007-11-13 15:38:35Z aaime $
034:         *
035:         * @task TODO: rework to work too for WMS servlets, and to get the servlets
036:         *       from ServletContext instead of having them hardcoded
037:         */
038:
039:        //JD: kill this class
040:        public class WmsDispatcher extends Dispatcher {
041:            /** Class logger */
042:            private static Logger LOGGER = org.geotools.util.logging.Logging
043:                    .getLogger("org.vfny.geoserver.servlets.wms");
044:
045:            /**
046:             * Passes the Post method to the Get method, with no modifications.
047:             *
048:             * @param request The servlet request object.
049:             * @param response The servlet response object.
050:             *
051:             * @throws ServletException For any servlet problems.
052:             * @throws IOException For any io problems.
053:             *
054:             * @task REVISIT: This is not working yet, as we can't seem to figure out
055:             *       how to read the reader twice.  It must be read once to see what
056:             *       the request type is,  and again to actually analyze it.  But we
057:             *       haven't yet found the way  to read it twice.  There should be
058:             *       some way to do this, but it doesn't seem that important, as users
059:             *       who use post should be able to figure out which servlet to send
060:             *       it to. I'm removing DispatcherReaderXml and DispatcherHandler
061:             *       from cvs, so that they don't get in the 1.0 release.  If anyone
062:             *       attempts to implement this there are deleted versions in cvs.
063:             *       Check the attic on the webcvs, or just do a checkout with the
064:             *       rel_0_98 tag.
065:             */
066:            public void doPost(HttpServletRequest request,
067:                    HttpServletResponse response) throws ServletException,
068:                    IOException {
069:                //BufferedReader tempReader = request.getReader();
070:                //String tempResponse = new String();
071:                //int targetRequest = 0;
072:                LOGGER.finer("got to post request");
073:
074:                //DJB: adding parital POST support for SLD-POST.
075:                //     currently the only type of POST request we support is GetMap
076:                //     So chris' comments above dont apply - we just assume its GetMap and we dont have to read twice.
077:                // 
078:                int targetRequest = Dispatcher.GET_MAP_REQUEST;
079:                doResponse(true, request, response, targetRequest);
080:            }
081:
082:            /**
083:             * Handles all Get requests.  This method implements the main matching
084:             * logic for the class.
085:             *
086:             * @param request The servlet request object.
087:             * @param response The servlet response object.
088:             *
089:             * @throws ServletException For any servlet problems.
090:             * @throws IOException For any io problems.
091:             */
092:            public void doGet(HttpServletRequest request,
093:                    HttpServletResponse response) throws ServletException,
094:                    IOException {
095:                int targetRequest = 0;
096:
097:                // Examine the incoming request and create appropriate server objects
098:                //  to deal with each request
099:                //              try { 
100:                if (request.getQueryString() != null) {
101:                    Map kvPairs = KvpRequestReader.parseKvpSet(request
102:                            .getQueryString());
103:                    targetRequest = DispatcherKvpReader.getRequestType(kvPairs);
104:                } else {
105:                    targetRequest = UNKNOWN;
106:
107:                    //throw exception
108:                }
109:
110:                doResponse(false, request, response, targetRequest);
111:            }
112:
113:            protected void doResponse(boolean isPost,
114:                    HttpServletRequest request, HttpServletResponse response,
115:                    int req_type) throws ServletException, IOException {
116:                HttpServlet dispatched;
117:                LOGGER.finer("req_type is " + req_type);
118:
119:                //JD: kill this
120:                //        switch (req_type) {
121:                //        case GET_CAPABILITIES_REQUEST:
122:                //            dispatched = new Capabilities();
123:                //
124:                //            break;
125:                //
126:                //        case GET_MAP_REQUEST:
127:                //            dispatched = new GetMap();
128:                //
129:                //            break;
130:                //            
131:                //        case GET_FEATURE_INFO_REQUEST:
132:                //            dispatched = new GetFeatureInfo();
133:                //
134:                //            break;   
135:                //
136:                //        case DESCRIBE_LAYER_REQUEST:
137:                //            dispatched = new DescribeLayer();
138:                //
139:                //            break;   
140:                //
141:                //        case GET_LEGEND_GRAPHIC_REQUEST:
142:                //            dispatched = new GetLegendGraphic();
143:                //
144:                //            break;   
145:                //        default:
146:                //            dispatched = null;
147:                //        }
148:                //
149:                //        if ((dispatched != null))  //DJB: removed "&& !isPost" because we are partially supportin POST now
150:                //        {
151:                //            dispatched.init(servletConfig); //only needed for init hack, see
152:                //            dispatched.service(request, response);
153:                //        } else 
154:                //        {
155:                //            String message;
156:                //
157:                //            if (isPost) {
158:                //                message = "Post requests are not supported with the dispatcher "
159:                //                    + "servlet.  Please try the request using the appropriate "
160:                //                    + "request servlet, such as GetCapabilities or GetFeature";
161:                //            } else {
162:                //                message = "No wms kvp request recognized.  The REQUEST parameter"
163:                //                    + " must be one of GetMap or GetCapabilities";
164:                //            }
165:                //            
166:                //            HttpSession session = request.getSession();
167:                //            ServletContext context = session.getServletContext();
168:                //
169:                //            GeoServer geoServer = (GeoServer) context.getAttribute(GeoServer.WEB_CONTAINER_KEY);
170:                //            
171:                //            WmsException wmse = new WmsException(message);
172:                //            String tempResponse = wmse.getXmlResponse(geoServer.isVerboseExceptions(), request);
173:                //
174:                //            response.setContentType(geoServer.getCharSet().toString());
175:                //            response.getWriter().write(tempResponse);
176:                //        }
177:            }
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.