Source Code Cross Referenced for AdminModuleProcessor.java in  » Forum » mvnforum-1.1 » com » mvnforum » admin » 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 » Forum » mvnforum 1.1 » com.mvnforum.admin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/admin/AdminModuleProcessor.java,v 1.136 2008/01/29 10:19:45 phuongpdd Exp $
003:         * $Author: phuongpdd $
004:         * $Revision: 1.136 $
005:         * $Date: 2008/01/29 10:19:45 $
006:         *
007:         * ====================================================================
008:         *
009:         * Copyright (C) 2002-2007 by MyVietnam.net
010:         *
011:         * All copyright notices regarding mvnForum MUST remain
012:         * intact in the scripts and in the outputted HTML.
013:         * The "powered by" text/logo with a link back to
014:         * http://www.mvnForum.com and http://www.MyVietnam.net in
015:         * the footer of the pages MUST remain visible when the pages
016:         * are viewed on the internet or intranet.
017:         *
018:         * This program is free software; you can redistribute it and/or modify
019:         * it under the terms of the GNU General Public License as published by
020:         * the Free Software Foundation; either version 2 of the License, or
021:         * any later version.
022:         *
023:         * This program is distributed in the hope that it will be useful,
024:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
025:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
026:         * GNU General Public License for more details.
027:         *
028:         * You should have received a copy of the GNU General Public License
029:         * along with this program; if not, write to the Free Software
030:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
031:         *
032:         * Support can be obtained from support forums at:
033:         * http://www.mvnForum.com/mvnforum/index
034:         *
035:         * Correspondence and Marketing Questions can be sent to:
036:         * info at MyVietnam net
037:         *
038:         * @author: Minh Nguyen
039:         * @author: Mai  Nguyen
040:         */
041:        package com.mvnforum.admin;
042:
043:        import java.io.IOException;
044:
045:        import javax.servlet.ServletContext;
046:        import javax.servlet.ServletException;
047:        import javax.servlet.http.*;
048:
049:        import net.myvietnam.mvncore.exception.*;
050:        import net.myvietnam.mvncore.filter.DisableHtmlTagFilter;
051:        import net.myvietnam.mvncore.mvnframework.URLMap;
052:        import net.myvietnam.mvncore.util.*;
053:        import net.myvietnam.mvncore.web.GenericRequest;
054:        import net.myvietnam.mvncore.web.GenericResponse;
055:        import net.myvietnam.mvncore.web.impl.GenericRequestServletImpl;
056:        import net.myvietnam.mvncore.web.impl.GenericResponseServletImpl;
057:
058:        import org.apache.commons.logging.Log;
059:        import org.apache.commons.logging.LogFactory;
060:
061:        import com.mvnforum.MVNForumConfig;
062:        import com.mvnforum.auth.*;
063:        import com.mvnforum.service.ModuleProcessor;
064:        import com.mvnforum.user.UserModuleConfig;
065:
066:        public class AdminModuleProcessor implements  ModuleProcessor {
067:
068:            private static Log log = LogFactory
069:                    .getLog(AdminModuleProcessor.class);
070:
071:            private static int count;
072:
073:            protected final String ORIGINAL_REQUEST = "mvnforum.admin.OriginalRequest";
074:
075:            private HttpServlet adminServlet = null;
076:
077:            protected OnlineUserManager onlineUserManager = OnlineUserManager
078:                    .getInstance();
079:            private AdminModuleURLMapHandler urlMapHandler = new AdminModuleURLMapHandler();
080:
081:            private ForumWebHandler forumWebHandler = new ForumWebHandler();
082:            private CategoryWebHandler categoryWebHandler = new CategoryWebHandler();
083:            private MemberWebHandler memberWebHandler = new MemberWebHandler();
084:            private WatchWebHandler watchWebHandler = new WatchWebHandler();
085:            private GroupsWebHandler groupsWebHandler = new GroupsWebHandler();
086:            private MemberGroupWebHandler memberGroupWebHandler = new MemberGroupWebHandler();
087:            private GroupPermissionWebHandler groupPermissionWebHandler = new GroupPermissionWebHandler();
088:            private GroupForumWebHandler groupForumWebHandler = new GroupForumWebHandler();
089:            private RankWebHandler rankWebHandler = new RankWebHandler();
090:            private MemberPermissionWebHandler memberPermissionWebHandler = new MemberPermissionWebHandler();
091:            private MemberForumWebHandler memberForumWebHandler = new MemberForumWebHandler();
092:            private GeneralAdminTasksWebHandler generalAdminTasksWebHandler = new GeneralAdminTasksWebHandler();
093:            private ConfigurationWebHandler configurationWebHandler = new ConfigurationWebHandler();
094:            private CssTaskWebHandler cssTaskWebHandler = new CssTaskWebHandler();
095:
096:            protected ServletContext servletContext = null;
097:
098:            //    public AdminModuleProcessor(HttpServlet servlet) {
099:            //        adminServlet    = servlet;
100:            //        servletContext  = adminServlet.getServletContext();
101:            //    }
102:
103:            public AdminModuleProcessor() {
104:                count++;
105:                AssertionUtil.doAssert(count == 1,
106:                        "Assertion: Must have only one instance.");
107:            }
108:
109:            public void setServlet(HttpServlet servlet) {
110:                this .adminServlet = servlet;
111:                servletContext = adminServlet.getServletContext();
112:            }
113:
114:            /**
115:             * This method handles the <code>requestURI</code>, and invokes the needed
116:             * procedure (if the current user has the permission to perform that task).
117:             * <br/>
118:             * For example, URI <code>"/addforumprocess"</code> invokes the call to
119:             * <code>forumWebHandler.processAdd(request);</code>.<br/>
120:             * After the task is performed, we use the <code>AdminModuleURLMapHandler</code>
121:             * to get the <code>responseURI</code>. That <code>responseURI</code> is
122:             * returned back to the calling method, so it can decide and act on it
123:             * (to redirect to that URI).<br/>
124:             *
125:             * @param request The <code>HttpServletRequest</code> object of this HTTP request.
126:             * @param response The <code>HttpServletResponse</code> object of this HTTP request.
127:             * @return responseURI to be redirected to. <b>It could be null</b>, which
128:             *         means we are not supposed to do any redirection, since the output was
129:             *         already committed (for example, if we sent (downloaded) a file to the user.
130:             */
131:            public String process(HttpServletRequest request,
132:                    HttpServletResponse response) throws IOException,
133:                    ServletException {
134:
135:                long start = 0;
136:                String requestURI = StringUtil.getEmptyStringIfNull(request
137:                        .getPathInfo());
138:                String responseURI = null;
139:                OnlineUser onlineUser = null;
140:                if (log.isDebugEnabled()) {
141:                    start = System.currentTimeMillis();
142:                    log.debug("AdminModuleProcessor : requestURI  = "
143:                            + requestURI);
144:                }
145:
146:                GenericRequest genericRequest = new GenericRequestServletImpl(
147:                        request, servletContext);
148:                GenericResponse genericResponse = new GenericResponseServletImpl(
149:                        response);
150:
151:                // step 1: some command need to be processed before we do the URI mapping (of the MODAL)
152:                try {
153:                    // always check for Authenticated User
154:                    //          @todo could throw Exception, so onlineUser will be null, caused NPE later
155:                    onlineUser = onlineUserManager.getOnlineUser(request);
156:                    onlineUser.updateNewMessageCount(false);
157:
158:                    MVNForumPermission permission = onlineUser.getPermission();
159:                    if (!requestURI.equals("") && !requestURI.equals("/")
160:                            && !requestURI.equals("/login")
161:                            && !requestURI.equals("/loginprocess")
162:                            && !requestURI.equals("/logout")) {
163:                        permission.ensureIsAuthenticated();
164:                        if (onlineUser.getAuthenticationType() == OnlineUser.AUTHENTICATION_TYPE_COOKIE) {
165:                            throw new AuthenticationException(
166:                                    NotLoginException.COOKIE_NOT_ALLOWED);
167:                        }
168:                    }
169:
170:                    if (requestURI.equals("/forummanagement")) {
171:                        forumWebHandler.prepareForumManagement(genericRequest,
172:                                genericResponse);
173:                    } else if (requestURI.equals("/editgroupforumpermission")) {
174:                        groupForumWebHandler.prepareList(genericRequest);
175:                    } else if (requestURI.equals("/updategroupforumpermission")) {
176:                        groupForumWebHandler.processUpdate(genericRequest);
177:
178:                    } else if (requestURI.equals("/addforum")) {
179:                        forumWebHandler.prepareAdd(genericRequest,
180:                                genericResponse);
181:                    } else if (requestURI.equals("/addforumprocess")) {
182:                        forumWebHandler.processAdd(genericRequest,
183:                                genericResponse);
184:                    } else if (requestURI.equals("/deleteforum")) {
185:                        forumWebHandler.prepareDelete(genericRequest);
186:                    } else if (requestURI.equals("/deleteforumprocess")) {
187:                        forumWebHandler.processDelete(genericRequest);
188:                    } else if (requestURI.equals("/editforum")) {
189:                        forumWebHandler.prepareEdit(genericRequest,
190:                                genericResponse);
191:                    } else if (requestURI.equals("/updateforum")) {
192:                        forumWebHandler.processUpdate(genericRequest,
193:                                genericResponse);
194:                    } else if (requestURI.equals("/updateforumorder")) {
195:                        forumWebHandler.processUpdateForumOrder(genericRequest);
196:
197:                    } else if (requestURI.equals("/addcategory")) {
198:                        categoryWebHandler.prepareAdd(genericRequest,
199:                                genericResponse);
200:                    } else if (requestURI.equals("/addcategoryprocess")) {
201:                        categoryWebHandler.processAdd(genericRequest,
202:                                genericResponse);
203:                    } else if (requestURI.equals("/deletecategory")) {
204:                        categoryWebHandler.prepareDelete(genericRequest);
205:                    } else if (requestURI.equals("/deletecategoryprocess")) {
206:                        categoryWebHandler.processDelete(genericRequest);
207:                    } else if (requestURI.equals("/editcategory")) {
208:                        categoryWebHandler.prepareEdit(genericRequest);
209:                    } else if (requestURI.equals("/updatecategory")) {
210:                        categoryWebHandler.processUpdate(genericRequest,
211:                                genericResponse);
212:                    } else if (requestURI.equals("/updatecategoryorder")) {
213:                        categoryWebHandler
214:                                .processUpdateCategoryOrder(genericRequest);
215:
216:                    } else if (requestURI.equals("/rankmanagement")) {
217:                        rankWebHandler.prepareList(genericRequest);
218:                    } else if (requestURI.equals("/editrank")) {
219:                        rankWebHandler.prepareEdit(genericRequest);
220:                    } else if (requestURI.equals("/editrankprocess")) {
221:                        rankWebHandler.processUpdate(genericRequest,
222:                                genericResponse);
223:                    } else if (requestURI.equals("/addrankprocess")) {
224:                        rankWebHandler.processAdd(genericRequest,
225:                                genericResponse);
226:                    } else if (requestURI.equals("/deleterankprocess")) {
227:                        rankWebHandler.processDelete(genericRequest);
228:
229:                    } else if (requestURI.equals("/usermanagement")) {
230:                        memberWebHandler
231:                                .prepareShowUserManagement(genericRequest);
232:                    } else if (requestURI.equals("/permissionsummary")) {
233:                        memberWebHandler
234:                                .preparePermissionSummary(genericRequest);
235:                    } else if (requestURI.equals("/viewmemberpermissions")) {
236:                        memberWebHandler.prepareViewPermission(genericRequest);
237:                    } else if (requestURI.equals("/deletenonactivatedmembers")) {
238:                        memberWebHandler
239:                                .prepareDeleteNonActivatedNoPostMembers(genericRequest);
240:                    } else if (requestURI
241:                            .equals("/deletenonactivatedmembersprocess")) {
242:                        memberWebHandler
243:                                .processDeleteNonActivatedNoPostMembers(/*servletContext,*/genericRequest);
244:                    } else if (requestURI.equals("/listpendingusers")) {
245:                        memberWebHandler
246:                                .prepareListPendingUsers(genericRequest);
247:                    } else if (requestURI.equals("/listpendingusersprocess")) {
248:                        memberWebHandler
249:                                .processListPendingUsers(genericRequest);
250:                    } else if (requestURI.equals("/addmember")) {
251:                        memberWebHandler.prepareAdd(genericRequest);
252:                    } else if (requestURI.equals("/addmemberprocess")) {
253:                        memberWebHandler.processAdd(genericRequest);
254:                    } else if (requestURI.equals("/changememberstatusprocess")) {
255:                        memberWebHandler
256:                                .processUpdateMemberStatus(genericRequest);
257:                    } else if (requestURI.equals("/viewmember")) {
258:                        memberWebHandler.prepareView(genericRequest);
259:                    } else if (requestURI.equals("/editmember")) {
260:                        memberWebHandler.prepareEdit(genericRequest);
261:                    } else if (requestURI.equals("/updatemember")) {
262:                        memberWebHandler.processEdit(genericRequest,
263:                                genericResponse);
264:                    } else if (requestURI.equals("/changepassword")) {
265:                        memberWebHandler.prepareChangePassword(genericRequest);
266:                    } else if (requestURI.equals("/changepasswordprocess")) {
267:                        memberWebHandler.processChangePassword(genericRequest);
268:                    } else if (requestURI.equals("/editmembertitle")) {
269:                        memberWebHandler.prepareView(genericRequest);
270:                    } else if (requestURI.equals("/editmembertitleprocess")) {
271:                        memberWebHandler.processUpdateMemberTitle(
272:                                genericRequest, genericResponse);
273:                    } else if (requestURI.equals("/resetsignatureprocess")) {
274:                        memberWebHandler
275:                                .processResetMemberSignature(genericRequest);
276:                    } else if (requestURI.equals("/resetavatarprocess")) {
277:                        memberWebHandler
278:                                .processResetMemberAvatar(genericRequest);
279:                    } else if (requestURI.equals("/resetactivationprocess")) {
280:                        memberWebHandler
281:                                .processResetMemberActivation(genericRequest);
282:
283:                    } else if (requestURI.equals("/deletewatch")) {
284:                        watchWebHandler.processDelete_forMember(genericRequest);
285:                    } else if (requestURI.equals("/addgroupprocess")) {
286:                        groupsWebHandler.processAdd(genericRequest,
287:                                genericResponse);
288:                    } else if (requestURI.equals("/deletegroup")) {
289:                        groupsWebHandler.prepareDelete(genericRequest);
290:                    } else if (requestURI.equals("/deletegroupprocess")) {
291:                        groupsWebHandler.processDelete(genericRequest);
292:                    } else if (requestURI.equals("/groupmanagement")) {
293:                        groupsWebHandler.prepareList(genericRequest);
294:                    } else if (requestURI.equals("/viewgroup")) {
295:                        groupsWebHandler.prepareView(genericRequest);
296:                    } else if (requestURI.equals("/editgroupinfo")) {
297:                        groupsWebHandler.prepareView(genericRequest);
298:                    } else if (requestURI.equals("/updategroupinfo")) {
299:                        groupsWebHandler.processUpdate(genericRequest,
300:                                genericResponse);
301:                    } else if (requestURI.equals("/editgroupowner")) {
302:                        groupsWebHandler.prepareView(genericRequest);
303:                    } else if (requestURI.equals("/updategroupowner")) {
304:                        groupsWebHandler
305:                                .processUpdateGroupOwner(genericRequest);
306:                    } else if (requestURI.equals("/listmembergroup")) {
307:                        memberGroupWebHandler
308:                                .prepareList_inGroup_limit(genericRequest);
309:                    } else if (requestURI.equals("/addmembergroup")) {
310:                        groupsWebHandler.prepareView(genericRequest);
311:                    } else if (requestURI.equals("/addmembergroupprocess")) {
312:                        memberGroupWebHandler.processAdd(genericRequest);
313:                    } else if (requestURI.equals("/deletemembergroupprocess")) {
314:                        memberGroupWebHandler.processDelete(genericRequest);
315:                    } else if (requestURI.equals("/editgrouppermission")) {
316:                        groupPermissionWebHandler.prepareList(genericRequest);
317:                    } else if (requestURI.equals("/updategrouppermission")) {
318:                        groupPermissionWebHandler.processUpdate(genericRequest);
319:                    } else if (requestURI.equals("/assignforumtogroup")) {
320:                        groupForumWebHandler.prepareAssignForumToGroup(
321:                                genericRequest, genericResponse);
322:                    } else if (requestURI.equals("/assigngrouptoforum")) {
323:                        groupForumWebHandler
324:                                .prepareAssignGroupToForum(genericRequest);
325:                    } else if (requestURI.equals("/assignforumtomember")) {
326:                        memberForumWebHandler.prepareAssignForumToMember(
327:                                genericRequest, genericResponse);
328:                    } else if (requestURI.equals("/assignmembertoforum")) {
329:                        memberForumWebHandler
330:                                .prepareAssignMemberToForum(genericRequest);
331:                    } else if (requestURI.equals("/editmemberforumpermission")) {
332:                        memberForumWebHandler.prepareList(genericRequest);
333:                    } else if (requestURI
334:                            .equals("/updatememberforumpermission")) {
335:                        memberForumWebHandler.processUpdate(genericRequest);
336:                    } else if (requestURI.equals("/editmemberpermission")) {
337:                        memberPermissionWebHandler
338:                                .prepareListPermission(genericRequest);
339:                    } else if (requestURI.equals("/updatememberpermission")) {
340:                        memberPermissionWebHandler
341:                                .processUpdate(genericRequest);
342:                    } else if (requestURI.equals("/deletemember")) {
343:                        memberWebHandler.prepareDeleteMember(genericRequest);
344:                    } else if (requestURI.equals("/deletememberprocess")) {
345:                        memberWebHandler
346:                                .processDeleteMember(/*servletContext,*/genericRequest);
347:
348:                    } else if (requestURI.equals("/edittemplate")) {
349:                        configurationWebHandler
350:                                .prepareEditTemplate(genericRequest);
351:                    } else if (requestURI.equals("/updatetemplate")) {
352:                        configurationWebHandler
353:                                .processEditTemplate(genericRequest);
354:
355:                    } else if (requestURI.equals("/editcss")) {
356:                        cssTaskWebHandler.prepareEditCSS(genericRequest);
357:                    } else if (requestURI.equals("/updatecss")) {
358:                        cssTaskWebHandler.processEditCSS(genericRequest);
359:                        cssTaskWebHandler
360:                                .processEditCSS_forRender(genericRequest);
361:                    } else if (requestURI.equals("/restorecss")) {
362:                        cssTaskWebHandler.processRestoreCSS(genericRequest);
363:
364:                    } else if (requestURI.equals("/viewlogsystem")) {
365:                        generalAdminTasksWebHandler
366:                                .prepareViewLogSystem(genericRequest);
367:                    } else if (requestURI.equals("/logframe")) {
368:                        generalAdminTasksWebHandler
369:                                .prepareLogFrame(genericRequest);
370:                    } else if (requestURI.equals("/backupsystemlog")) {
371:                        generalAdminTasksWebHandler
372:                                .backupSystemLog(genericRequest);
373:                    } else if (requestURI.equals("/listlogfiles")) {
374:                        generalAdminTasksWebHandler
375:                                .prepareListLogFiles(genericRequest);
376:                    } else if (requestURI.equals("/downloadlogfile")) {
377:                        generalAdminTasksWebHandler.downloadLogFile(request,
378:                                response);
379:                        return null;//already committed some messages, no further process is needed
380:                    } else if (requestURI.equals("/deletelogfile")) {
381:                        generalAdminTasksWebHandler
382:                                .deleteLogFile(genericRequest);
383:
384:                    } else if (requestURI.equals("/configindex")) {
385:                        configurationWebHandler
386:                                .prepareConfigMVNCore(genericRequest);
387:                        configurationWebHandler
388:                                .prepareConfigMVNForum(genericRequest);
389:                    } else if (requestURI.equals("/configstepone")) {
390:                        configurationWebHandler
391:                                .prepareConfigMVNForum(genericRequest);
392:                    } else if (requestURI.equals("/configsteponeprocess")) {
393:                        configurationWebHandler
394:                                .updateConfigStepOne(genericRequest);
395:                    } else if (requestURI.equals("/configsteptwo")) {
396:                        configurationWebHandler
397:                                .prepareConfigMVNForum(genericRequest);
398:                    } else if (requestURI.equals("/configsteptwoprocess")) {
399:                        configurationWebHandler
400:                                .updateConfigStepTwo(genericRequest);
401:                    } else if (requestURI.equals("/configstepthree")) {
402:                        configurationWebHandler
403:                                .prepareConfigMVNForum(genericRequest);
404:                    } else if (requestURI.equals("/configstepthreeprocess")) {
405:                        configurationWebHandler
406:                                .updateConfigStepThree(genericRequest);
407:                    } else if (requestURI.equals("/configmvncore")) {
408:                        configurationWebHandler
409:                                .prepareConfigMVNCore(genericRequest);
410:                    } else if (requestURI.equals("/configmvncoreprocess")) {
411:                        configurationWebHandler
412:                                .updateConfigMVNCore(genericRequest);
413:                    } else if (requestURI.equals("/configurlpattern")) {
414:                        configurationWebHandler
415:                                .prepareConfigMVNForum(genericRequest);
416:                    } else if (requestURI.equals("/configurlpatternprocess")) {
417:                        configurationWebHandler
418:                                .updateUrlPattern(genericRequest);
419:                    } else if (requestURI.equals("/configbackupprocess")) {
420:                        configurationWebHandler
421:                                .configBackupProcess(genericRequest);
422:                    } else if (requestURI.equals("/commitconfigs")) {
423:                        configurationWebHandler.commitConfig(genericRequest);
424:
425:                    } else if (requestURI.equals("/restoreconfigbackupprocess")) {
426:                        //configurationWebHandler.configBackupProcess();
427:
428:                    } else if (requestURI.equals("/index")) {
429:                        generalAdminTasksWebHandler
430:                                .prepareShowIndex(genericRequest);
431:                    } else if (requestURI.equals("/changemode")) {
432:                        generalAdminTasksWebHandler
433:                                .changeShowUserArea(genericRequest);
434:                    } else if (requestURI.equals("/clearcache")) {
435:                        generalAdminTasksWebHandler
436:                                .processClearCache(genericRequest);
437:                    } else if (requestURI.equals("/testsystem")) {
438:                        generalAdminTasksWebHandler
439:                                .prepareTestSystem(genericRequest);
440:                    } else if (requestURI.equals("/importexport")) {
441:                        generalAdminTasksWebHandler
442:                                .prepareImportExport(request);
443:                    } else if (requestURI.equals("/importprocess")) {
444:                        generalAdminTasksWebHandler.importXmlZip(request,
445:                                response);
446:                        return null;//already commited some messages, no further process is needed
447:                    } else if (requestURI.equals("/exportprocess")) {
448:                        generalAdminTasksWebHandler.exportXmlZip(request);
449:                    } else if (requestURI.equals("/getexportprocess")) {
450:                        generalAdminTasksWebHandler.getExportXmlZip(request,
451:                                response);
452:                        return null;//already commited file or raised exception, no further process is needed
453:                    } else if (requestURI.equals("/deleteexportprocess")) {
454:                        generalAdminTasksWebHandler
455:                                .deleteExportXmlZip(genericRequest);
456:                    } else if (requestURI.equals("/misctasks")) {
457:                        generalAdminTasksWebHandler
458:                                .prepareRebuildIndex(genericRequest);
459:                    } else if (requestURI.equals("/rebuildindex")) {
460:                        generalAdminTasksWebHandler
461:                                .rebuildIndex(genericRequest);
462:                    } else if (requestURI.equals("/sendmail")) {
463:                        generalAdminTasksWebHandler
464:                                .prepareSendMail(genericRequest);
465:                    } else if (requestURI.equals("/sendmailprocess")) {
466:                        generalAdminTasksWebHandler.sendMail(genericRequest);
467:                    } else if (requestURI
468:                            .equals("/sendactivatemailtoallprocess")) {
469:                        generalAdminTasksWebHandler
470:                                .sendActivateMailToAll(genericRequest);
471:
472:                    } else if (requestURI.equals("/searchmember")) {
473:                        memberWebHandler.processSearch(genericRequest);
474:
475:                    } else if (requestURI.equals("/updatememberexpireprocess")) {
476:                        memberWebHandler
477:                                .updateMemberExpireProcess(genericRequest);
478:                    } else if (requestURI.equals("/listuserexpire")) {
479:                        memberWebHandler.prepareListUserExpire(genericRequest);
480:
481:                    } else if (requestURI.equals("/login")) {
482:                        if (MVNForumConfig.getRedirectLoginURL().equals(
483:                                "default") == false) {
484:                            // if not checking, we will have recursive bug
485:                            responseURI = MVNForumConfig.getRedirectLoginURL();
486:                        }
487:
488:                    } else if (requestURI.equals("/loginprocess")) {
489:                        //                if (MVNForumConfig.getEnableLogin() == false) {
490:                        //                    throw new AuthenticationException(NotLoginException.LOGIN_DISABLED);
491:                        //                }
492:                        onlineUserManager.processLogin(request, response);
493:
494:                        String url = ParamUtil.getParameter(request, "url");
495:                        if (onlineUserManager.getOnlineUser(request)
496:                                .isPasswordExpired()) {
497:                            responseURI = UserModuleConfig.getUrlPattern()
498:                                    + "/changemypassword";
499:                        } else if (url.length() > 0) {
500:                            responseURI = url;
501:                        } else {
502:                            String originalRequest = ParamUtil.getAttribute(
503:                                    request.getSession(), ORIGINAL_REQUEST);
504:                            if (originalRequest.length() > 0) {
505:                                request.getSession().setAttribute(
506:                                        ORIGINAL_REQUEST, "");
507:                                responseURI = originalRequest;
508:                            }
509:                        }
510:                    } else if (requestURI.equals("/logout")) {
511:                        onlineUserManager.logout(request, response);
512:                        request.setAttribute("Reason", "Logout successfully.");
513:                        if (MVNForumConfig.getRedirectLogoutURL().equals(
514:                                "default") == false) {
515:                            // if not checking, we will have recursive bug
516:                            responseURI = MVNForumConfig.getRedirectLogoutURL();
517:                        }
518:                    }
519:                } catch (AuthenticationException e) {
520:                    // make sure not from login page, we cannot set original request in this situation
521:                    // and also make sure the request's method must be GET to set the OriginalRequest
522:                    boolean shouldSaveOriginalRequest = (e.getReason() == NotLoginException.NOT_LOGIN)
523:                            || (e.getReason() == NotLoginException.NOT_ENOUGH_RIGHTS);
524:                    if (shouldSaveOriginalRequest
525:                            && (request.getMethod().equals("GET"))) {
526:                        String url = AdminModuleConfig.getUrlPattern()
527:                                + requestURI
528:                                + "?"
529:                                + StringUtil.getEmptyStringIfNull(request
530:                                        .getQueryString());
531:                        request.getSession()
532:                                .setAttribute(ORIGINAL_REQUEST, url);
533:                    }
534:
535:                    //requestURI = MVNForumConfig.getRedirectLoginURL();//"/login";
536:                    responseURI = AdminModuleConfig.getUrlPattern() + "/login";
537:                    request.setAttribute("Reason", e
538:                            .getReasonExplanation(onlineUser.getLocale()));
539:                } catch (Throwable e) {
540:                    if (e instanceof  BadInputException) {
541:                        // we log in WARN level if this is the exception from user input
542:                        log.warn("Exception in AdminModuleProcessor e = "
543:                                + e.getMessage(), e);
544:                    } else if (e instanceof  AssertionError) {
545:                        // we log in FATAL level if this is the exception from user input
546:                        log.fatal("Exception in AdminModuleProcessor e = "
547:                                + e.getMessage(), e);
548:                    } else {
549:                        log.error("Exception in AdminModuleProcessor ["
550:                                + e.getClass().getName() + "] : "
551:                                + e.getMessage(), e);
552:                    }
553:                    requestURI = "/error";
554:
555:                    String message = StringUtil.getEmptyStringIfNull(e
556:                            .getMessage());
557:                    if (message.length() == 0) {
558:                        message = e.getClass().getName();
559:                    }
560:                    request.getSession().setAttribute("ErrorMessage",
561:                            DisableHtmlTagFilter.filter(message));
562:                }
563:
564:                // step 2: map the URI (of the CONTROLLER)
565:                try {
566:                    // See note in the ActionInUserModule
567:                    Action action = new ActionInAdminModule(genericRequest,
568:                            requestURI);// may throw MissingURLMapEntryException
569:                    onlineUserManager.updateOnlineUserAction(genericRequest,
570:                            action);
571:                    if (responseURI == null) {
572:                        URLMap map = urlMapHandler.getMap(requestURI,
573:                                genericRequest);
574:                        responseURI = map.getResponse();
575:                    }
576:                } catch (MissingURLMapEntryException e) {
577:                    log
578:                            .error("Exception: missing urlmap entry in admin module: requestURI = "
579:                                    + requestURI);
580:                    responseURI = "/mvnplugin/mvnforum/admin/error.jsp";
581:                    request.getSession().setAttribute("ErrorMessage",
582:                            DisableHtmlTagFilter.filter(e.getMessage()));
583:                } catch (Exception e) {
584:                    // This will catch AuthenticationException, AssertionError, DatabaseException
585:                    // in the method onlineUserManager.updateOnlineUserAction(request, action)
586:                    responseURI = "/mvnplugin/mvnforum/admin/error.jsp";
587:                    request.getSession().setAttribute("ErrorMessage",
588:                            DisableHtmlTagFilter.filter(e.getMessage()));
589:                }
590:
591:                // step 3: return URI to be forwarded to or dispatched to the VIEW
592:                if (log.isDebugEnabled()) {
593:                    long duration = System.currentTimeMillis() - start;
594:                    log.debug("AdminModuleProcessor : responseURI = "
595:                            + responseURI + ". (" + duration + " ms)");
596:                }
597:
598:                return responseURI;
599:            }// process method
600:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.