Source Code Cross Referenced for DemoRequestAction.java in  » GIS » GeoServer » org » vfny » geoserver » action » 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.action 
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.action;
006:
007:        import org.apache.struts.action.ActionForm;
008:        import org.apache.struts.action.ActionForward;
009:        import org.apache.struts.action.ActionMapping;
010:        import org.vfny.geoserver.form.DemoRequestForm;
011:        import org.vfny.geoserver.util.Requests;
012:        import java.io.BufferedReader;
013:        import java.io.File;
014:        import java.io.FileReader;
015:        import java.io.IOException;
016:        import javax.servlet.ServletException;
017:        import javax.servlet.http.HttpServletRequest;
018:        import javax.servlet.http.HttpServletResponse;
019:
020:        /**
021:         * <b>DemoRequestAction</b><br>
022:         * Oct 7, 2005<br>
023:         *
024:         * <b>Purpose:</b><br>
025:         * This used to be DemoAction. We changed DemoAction to be a bunch of links, and leave
026:         * it as an action in case we want to do something fancier with it later.
027:         *
028:         * This Action handles all the buttons for the Demo.jsp page.
029:         *
030:         * <p>
031:         * This one is more complicated then usual since not all the actions require
032:         * the form bean to be validated! I am going to have to hack a little bit to
033:         * make that happen, I may end up making the form bean validation differ
034:         * depending on the selected action.
035:         * </p>
036:         *
037:         * <p>
038:         * Buttons that make this action go:
039:         *
040:         * <ul>
041:         * <li>
042:         * Submit: submit the request specified by url and post fields (Should be done
043:         * using Javascript locally)
044:         * </li>
045:         * <li>
046:         * Change: select between the precanned demos
047:         * </li>
048:         * </ul>
049:         *
050:         * As usual we will have to uninternationlize the action name provided to us.
051:         * </p>
052:         *
053:         * @author Richard Gould
054:         * @author Jody Garnett
055:         * @author Brent Owens (The Open Planning Project)
056:         * @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last modification)
057:         * @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last modification)
058:         *
059:         * @version
060:         */
061:        public class DemoRequestAction extends GeoServerAction {
062:            public ActionForward execute(ActionMapping mapping,
063:                    ActionForm form, HttpServletRequest request,
064:                    HttpServletResponse response) throws IOException,
065:                    ServletException {
066:                DemoRequestForm demoForm = (DemoRequestForm) form;
067:
068:                File dir = demoForm.getDir();
069:                String demo = demoForm.getDemo();
070:                String baseUrl = Requests.getBaseUrl(request, getGeoServer());
071:
072:                if (demo == null) {
073:                    demo = "";
074:                }
075:
076:                if (demo.equals("")) {
077:                    demoForm.setUrl(baseUrl);
078:                    demoForm.setBody("");
079:                }
080:
081:                if (demo.indexOf('/') != -1 || demo.indexOf('\\') != -1)
082:                    throw new IllegalArgumentException("Invalid path " + demo);
083:
084:                String service = demo.substring(0, demo.indexOf('_'))
085:                        .toLowerCase();
086:                String url = Requests.getBaseUrl(request, getGeoServer())
087:                        + service;
088:
089:                File file = new File(dir, demo);
090:                BufferedReader reader = new BufferedReader(new FileReader(file));
091:
092:                StringBuffer buf = new StringBuffer();
093:
094:                for (String line = reader.readLine(); line != null; line = reader
095:                        .readLine()) {
096:                    buf.append(line);
097:                    buf.append("\n");
098:                }
099:
100:                if (demo.endsWith(".url")) {
101:                    demoForm.setUrl(baseUrl + buf.toString());
102:                    demoForm.setBody("");
103:                } else { //demo.endsWith(.xml), but not yet for backwards compatibility.
104:                    demoForm.setUrl(url);
105:                    demoForm.setBody(buf.toString());
106:                }
107:
108:                // return back to the admin demo
109:                //
110:                return mapping.findForward("welcome.demoRequest");
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.