Source Code Cross Referenced for DescribeLayerResponse.java in  » GIS » GeoServer » org » vfny » geoserver » wms » responses » 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.responses 
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.responses;
006:
007:        import org.springframework.context.ApplicationContext;
008:        import org.vfny.geoserver.Request;
009:        import org.vfny.geoserver.Response;
010:        import org.vfny.geoserver.ServiceException;
011:        import org.vfny.geoserver.global.GeoServer;
012:        import org.vfny.geoserver.global.Service;
013:        import org.vfny.geoserver.wms.WmsException;
014:        import org.vfny.geoserver.wms.requests.DescribeLayerRequest;
015:        import org.vfny.geoserver.wms.responses.helpers.DescribeLayerTransformer;
016:        import java.io.ByteArrayOutputStream;
017:        import java.io.IOException;
018:        import java.io.OutputStream;
019:        import java.util.HashMap;
020:        import java.util.logging.Level;
021:        import java.util.logging.Logger;
022:        import javax.xml.transform.TransformerException;
023:
024:        /**
025:         * Executes a <code>DescribeLayer</code> WMS request.
026:         *
027:         * <p>
028:         * Recieves a <code>DescribeLayerRequest</code> object holding the references to
029:         * the requested layers and utilizes a transformer based on the org.geotools.xml.transform
030:         * framework to encode the response.
031:         * </p>
032:         *
033:         * @author Gabriel Roldan, Axios Engineering
034:         * @version $Id: DescribeLayerResponse.java 7746 2007-11-13 15:38:35Z aaime $
035:         */
036:        public class DescribeLayerResponse implements  Response {
037:            /** DOCUMENT ME! */
038:            private static final Logger LOGGER = org.geotools.util.logging.Logging
039:                    .getLogger(DescribeLayerResponse.class.getPackage()
040:                            .getName());
041:            public static final String DESCLAYER_MIME_TYPE = "application/vnd.ogc.wms_xml";
042:
043:            /** the request holding the required FeatureTypeInfo's */
044:            private DescribeLayerRequest request;
045:
046:            /** the transformer wich takes care of xmlencoding the
047:             * DescribeLayer response
048:             */
049:            private DescribeLayerTransformer transformer;
050:
051:            /** the raw XML content ready to be sent to the client */
052:            private byte[] content;
053:
054:            /**
055:             * Returns any extra headers that this service might want to set in the HTTP response object.
056:             * @see org.vfny.geoserver.Response#getResponseHeaders()
057:             */
058:            public HashMap getResponseHeaders() {
059:                return null;
060:            }
061:
062:            /**
063:             * DOCUMENT ME!
064:             *
065:             * @param request DOCUMENT ME!
066:             *
067:             * @throws ServiceException DOCUMENT ME!
068:             * @throws WmsException DOCUMENT ME!
069:             */
070:            public void execute(Request request) throws ServiceException {
071:                this .request = (DescribeLayerRequest) request;
072:
073:                if (LOGGER.isLoggable(Level.FINE)) {
074:                    LOGGER.fine(new StringBuffer("executing request ").append(
075:                            request).toString());
076:                }
077:
078:                this .transformer = new DescribeLayerTransformer(this .request
079:                        .getBaseUrl(), request.getServiceRef().getGeoServer());
080:                this .transformer.setNamespaceDeclarationEnabled(false);
081:                this .transformer.setEncoding(this .request.getGeoServer()
082:                        .getCharSet());
083:
084:                ByteArrayOutputStream out = new ByteArrayOutputStream();
085:
086:                try {
087:                    transformer.transform(this .request, out);
088:                } catch (TransformerException e) {
089:                    throw new WmsException(e);
090:                }
091:
092:                this .content = out.toByteArray();
093:            }
094:
095:            /**
096:             * Writes this respone to the provided output stream.
097:             *
098:             * @param out DOCUMENT ME!
099:             *
100:             * @throws ServiceException never.
101:             * @throws IOException if it is thrown while writing the response content
102:             *         to <code>out</code>.
103:             * @throws IllegalStateException if <code>execute()</code> has not been
104:             *         called or  does not succeed (i.e.: <code>this.content ==
105:             *         null</code>).
106:             */
107:            public void writeTo(OutputStream out) throws ServiceException,
108:                    IOException {
109:                if (this .content == null) {
110:                    throw new IllegalStateException(
111:                            "execute() has not been called or does not succeed.");
112:                }
113:
114:                out.write(this .content);
115:            }
116:
117:            /**
118:             * Do nothing, since <code>execute()</code> took care of obtaining the
119:             * response, and after that nothing remains to be done but sending the
120:             * response content to the client.
121:             *
122:             * @param gs
123:             */
124:            public void abort(Service gs) {
125:            }
126:
127:            /**
128:             * Returns the fixed <code>"application/vnd.ogc.wms_xml"</code> MIME type
129:             * of this response, as specified in SLD 1.0 spec, section 6.7.
130:             *
131:             * @param gs the geoserver instance config. Not used here.
132:             *
133:             * @return <code>"application/vnd.ogc.wms_xml"</code> as the response MIME
134:             *         type
135:             *
136:             * @throws IllegalStateException DOCUMENT ME!
137:             */
138:            public String getContentType(GeoServer gs)
139:                    throws IllegalStateException {
140:                return DESCLAYER_MIME_TYPE;
141:            }
142:
143:            /**
144:             * Returns <code>null</code> since no special encoding is applyed to the
145:             * response content.
146:             *
147:             * @return <code>null</code>
148:             */
149:            public String getContentEncoding() {
150:                return null;
151:            }
152:
153:            /* (non-Javadoc)
154:             * @see org.vfny.geoserver.Response#getContentDisposition()
155:             */
156:            public String getContentDisposition() {
157:                // TODO Auto-generated method stub
158:                return null;
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.