Source Code Cross Referenced for GetLegendGraphicResponseValidator.java in  » GIS » deegree » org » deegree » security » owsrequestvalidator » 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 » deegree » org.deegree.security.owsrequestvalidator.wms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/security/owsrequestvalidator/wms/GetLegendGraphicResponseValidator.java $
002:        /*----------------    FILE HEADER  ------------------------------------------
003:
004:         This file is part of deegree.
005:         Copyright (C) 2001-2008 by:
006:         EXSE, Department of Geography, University of Bonn
007:         http://www.giub.uni-bonn.de/deegree/
008:         lat/lon GmbH
009:         http://www.lat-lon.de
010:
011:         This library is free software; you can redistribute it and/or
012:         modify it under the terms of the GNU Lesser General Public
013:         License as published by the Free Software Foundation; either
014:         version 2.1 of the License, or (at your option) any later version.
015:
016:         This library is distributed in the hope that it will be useful,
017:         but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019:         Lesser General Public License for more details.
020:
021:         You should have received a copy of the GNU Lesser General Public
022:         License along with this library; if not, write to the Free Software
023:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:
025:         Contact:
026:
027:         Andreas Poth
028:         lat/lon GmbH
029:         Aennchenstr. 19
030:         53177 Bonn
031:         Germany
032:         E-Mail: poth@lat-lon.de
033:
034:         Prof. Dr. Klaus Greve
035:         Department of Geography
036:         University of Bonn
037:         Meckenheimer Allee 166
038:         53115 Bonn
039:         Germany
040:         E-Mail: greve@giub.uni-bonn.de
041:
042:         ---------------------------------------------------------------------------*/
043:        package org.deegree.security.owsrequestvalidator.wms;
044:
045:        import org.deegree.framework.util.MimeTypeMapper;
046:        import org.deegree.ogcwebservices.InvalidParameterValueException;
047:        import org.deegree.security.drm.model.User;
048:        import org.deegree.security.owsproxy.Request;
049:        import org.deegree.security.owsrequestvalidator.Policy;
050:        import org.deegree.security.owsrequestvalidator.ResponseValidator;
051:
052:        /**
053:         * 
054:         * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
055:         * @author last edited by: $Author: rbezema $
056:         * 
057:         * @version $Revision: 10559 $, $Date: 2008-03-12 01:35:07 -0700 (Wed, 12 Mar 2008) $
058:         */
059:        class GetLegendGraphicResponseValidator extends ResponseValidator {
060:
061:            /**
062:             * @param policy
063:             */
064:            public GetLegendGraphicResponseValidator(Policy policy) {
065:                super (policy);
066:            }
067:
068:            /**
069:             * validates the passed object as a response to a OWS request. The validity of the response may
070:             * is assigned to specific user rights. If the passed user is <>null this will be evaluated.
071:             * <br>
072:             * the reponse may contain three valid kinds of objects:
073:             * <ul>
074:             * <li>a serialized image
075:             * <li>a xml encoded exception
076:             * <li>a svg-encoded vector image
077:             * </ul>
078:             * Each of these types can be identified by the mime-type of the response that is also passed to
079:             * the method. <br>
080:             * If something basic went wrong it is possible that not further specified kind of object is
081:             * passed as response. In this case the method will throw an
082:             * <tt>InvalidParameterValueException</tt> to avoid sending bad responses to the client.
083:             * 
084:             * @param service
085:             *            service which produced the response (WMS, WFS ...)
086:             * @param response
087:             * @param mime
088:             *            mime-type of the response
089:             * @param user
090:             * @return the validated response or the response as given.
091:             * @throws InvalidParameterValueException
092:             */
093:            @Override
094:            public byte[] validateResponse(String service, byte[] response,
095:                    String mime, User user)
096:                    throws InvalidParameterValueException {
097:
098:                Request req = policy.getRequest(service, "GetLegendGraphic");
099:                // request is valid because no restrictions are made
100:                if (req.isAny()) {
101:                    return response;
102:                }
103:
104:                //Condition condition = req.getPostConditions();
105:
106:                if (MimeTypeMapper.isKnownImageType(mime)) {
107:                    response = validateImage(response, mime, user);
108:                } else if (MimeTypeMapper.isKnownOGCType(mime)) {
109:                    // if the mime-type isn't an image type but a known
110:                    // OGC mime-type it must be an XML document.
111:                    // probably it is an exception but it also could be
112:                    // a GML document
113:                    response = validateXML(response, mime, user);
114:                } else if (mime.equals("text/xml")) {
115:                    // if the mime-type isn't an image type but 'text/xml'
116:                    // it could be an exception
117:                    response = validateXML(response, mime, user);
118:                } else {
119:                    throw new InvalidParameterValueException(UNKNOWNMIMETYPE
120:                            + mime);
121:                }
122:
123:                return response;
124:            }
125:
126:            /**
127:             * validates the passed object/image to be valid against the policy
128:             * 
129:             * @param image
130:             * @param mime
131:             * @param user
132:             * @return the image parameter.
133:             */
134:            private byte[] validateImage(byte[] image, String mime, User user) {
135:                // TODO
136:                // define useful post-validation for images
137:                // at the moment everything is valid
138:                return image;
139:            }
140:
141:            /**
142:             * validates the passed object/xml to be valid against the policy
143:             * 
144:             * @param xml
145:             * @param mime
146:             * @param user
147:             * @return the xml parameter
148:             */
149:            private byte[] validateXML(byte[] xml, String mime, User user) {
150:                // TODO
151:                // define useful post-validation for xml-documents
152:                // at the moment everything is valid
153:                return xml;
154:            }
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.