Source Code Cross Referenced for ToplevelURLHandler.java in  » Web-Mail » jwebmail-0.7 » net » wastl » webmail » server » 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 » Web Mail » jwebmail 0.7 » net.wastl.webmail.server 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* CVS ID: $Id: ToplevelURLHandler.java,v 1.1.1.1 2002/10/02 18:42:51 wastl Exp $ */
002:        package net.wastl.webmail.server;
003:
004:        import java.util.*;
005:        import net.wastl.webmail.xml.*;
006:        import net.wastl.webmail.ui.*;
007:        import net.wastl.webmail.ui.html.*;
008:        import net.wastl.webmail.ui.xml.*;
009:        import net.wastl.webmail.server.http.*;
010:        import net.wastl.webmail.exceptions.*;
011:
012:        import org.webengruven.webmail.auth.AuthDisplayMngr;
013:
014:        import javax.servlet.ServletException;
015:
016:        /*
017:         * ToplevelURLHandler.java
018:         * 
019:         * Created: Tue Aug 31 17:20:29 1999
020:         *
021:         * Copyright (C) 1999-2000 Sebastian Schaffert
022:         * 
023:         * This program is free software; you can redistribute it and/or
024:         * modify it under the terms of the GNU General Public License
025:         * as published by the Free Software Foundation; either version 2
026:         * of the License, or (at your option) any later version.
027:         * 
028:         * This program is distributed in the hope that it will be useful,
029:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
030:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031:         * GNU General Public License for more details.
032:         * 
033:         * You should have received a copy of the GNU General Public License
034:         * along with this program; if not, write to the Free Software
035:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
036:         */
037:        /**
038:         * Handle URLs. Give them to the appropriate Plugins/Program parts
039:         *
040:         * Created: Tue Aug 31 17:20:29 1999
041:         *
042:         * @author Sebastian Schaffert
043:         * @version
044:         */
045:        /* 9/24/2000 devink -- changed for challenge/response authentication */
046:
047:        public class ToplevelURLHandler implements  URLHandler {
048:
049:            WebMailServer parent;
050:            //Hashtable urlhandlers;
051:            URLHandlerTree urlhandlers;
052:
053:            public ToplevelURLHandler(WebMailServer parent) {
054:                System.err
055:                        .println("- Initializing WebMail URL Handler ... done.");
056:                urlhandlers = new URLHandlerTree("/");
057:                urlhandlers.addHandler("/", this );
058:                this .parent = parent;
059:            }
060:
061:            public void registerHandler(String url, URLHandler handler) {
062:                //urlhandlers.put(url,handler);
063:                urlhandlers.addHandler(url, handler);
064:                //System.err.println("Tree changed: "+urlhandlers.toString());
065:            }
066:
067:            public String getURL() {
068:                return "/";
069:            }
070:
071:            public String getName() {
072:                return "TopLevelURLHandler";
073:            }
074:
075:            public String getDescription() {
076:                return "";
077:            }
078:
079:            public HTMLDocument handleException(Exception ex,
080:                    HTTPSession session, HTTPRequestHeader header)
081:                    throws ServletException {
082:                try {
083:                    session.setException(ex);
084:                    String theme = parent.getDefaultTheme();
085:                    Locale locale = Locale.getDefault();
086:                    if (session instanceof  WebMailSession) {
087:                        WebMailSession sess = (WebMailSession) session;
088:                        theme = sess.getUser().getTheme();
089:                        locale = sess.getUser().getPreferredLocale();
090:                    }
091:                    return new XHTMLDocument(session.getModel(), parent
092:                            .getStorage().getStylesheet("error.xsl", locale,
093:                                    theme));
094:                } catch (Exception myex) {
095:                    parent.getStorage().log(Storage.LOG_ERR,
096:                            "Error while handling exception:");
097:                    parent.getStorage().log(Storage.LOG_ERR, myex);
098:                    parent.getStorage().log(Storage.LOG_ERR,
099:                            "The handled exception was:");
100:                    parent.getStorage().log(Storage.LOG_ERR, ex);
101:                    throw new ServletException(myex);
102:                }
103:            }
104:
105:            public HTMLDocument handleURL(String url, HTTPSession session,
106:                    HTTPRequestHeader header) throws WebMailException,
107:                    ServletException {
108:
109:                HTMLDocument content;
110:
111:                if (url.equals("/")) {
112:                    //content=new HTMLLoginScreen(parent,parent.getStorage(),false);
113:                    XMLGenericModel model = parent.getStorage()
114:                            .createXMLGenericModel();
115:
116:                    AuthDisplayMngr adm = parent.getStorage()
117:                            .getAuthenticator().getAuthDisplayMngr();
118:
119:                    if (header.isContentSet("login")) {
120:                        model.setStateVar("invalid password", "yes");
121:                    }
122:
123:                    // Let the authenticator setup the loginscreen
124:                    adm.setLoginScreenVars(model);
125:
126:                    // Modified by exce, start.
127:                    /**
128:                     * Show login screen depending on WebMailServer's default locale.
129:                     */
130:                    /*
131:                    content = new XHTMLDocument(model.getRoot(), 
132:                    			parent.getStorage().getStylesheet(adm.getLoginScreenFile(), 
133:                    							  Locale.getDefault(),"default"));
134:                     */
135:                    content = new XHTMLDocument(
136:                            model.getRoot(),
137:                            parent
138:                                    .getStorage()
139:                                    .getStylesheet(
140:                                            adm.getLoginScreenFile(),
141:                                            parent.getDefaultLocale(),
142:                                            parent
143:                                                    .getProperty("webmail.default.theme")));
144:                    // Modified by exce, end.
145:                } else if (url.equals("/login")) {
146:
147:                    WebMailSession sess = (WebMailSession) session;
148:                    UserData user = sess.getUser();
149:                    content = new XHTMLDocument(session.getModel(), parent
150:                            .getStorage().getStylesheet("login.xsl",
151:                                    user.getPreferredLocale(), user.getTheme()));
152:                } else {
153:                    /* Let the plugins handle it */
154:
155:                    URLHandler uh = urlhandlers.getHandler(url);
156:
157:                    if (uh != null && uh != this ) {
158:                        // System.err.println("Handler: "+uh.getName()+" ("+uh.getURL()+")");
159:                        String suburl = url.substring(uh.getURL().length(), url
160:                                .length());
161:                        content = uh.handleURL(suburl, session, header);
162:                    } else {
163:                        throw new DocumentNotFoundException(url
164:                                + " was not found on this server");
165:                    }
166:                }
167:                return content;
168:            }
169:
170:        } // URLHandler
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.