⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usermoduleprocessor.java

📁 java servlet著名论坛源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/user/UserModuleProcessor.java,v 1.24 2004/06/29 02:17:35 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.24 $
 * $Date: 2004/06/29 02:17:35 $
 *
 * ====================================================================
 *
 * Copyright (C) 2002-2004 by MyVietnam.net
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * All copyright notices regarding mvnForum MUST remain intact
 * in the scripts and in the outputted HTML.
 * The "powered by" text/logo with a link back to
 * http://www.mvnForum.com and http://www.MyVietnam.net in the
 * footer of the pages MUST remain visible when the pages
 * are viewed on the internet or intranet.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Support can be obtained from support forums at:
 * http://www.mvnForum.com/mvnforum/index
 *
 * Correspondence and Marketing Questions can be sent to:
 * info@MyVietnam.net
 *
 * @author: Minh Nguyen  minhnn@MyVietnam.net
 * @author: Mai  Nguyen  mai.nh@MyVietnam.net
 */
package com.mvnforum.user;

import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.mvnforum.*;
import com.mvnforum.auth.*;
import com.mvnforum.common.MVNCaptchaService;
import net.myvietnam.mvncore.exception.*;
import net.myvietnam.mvncore.util.ParamUtil;
import net.myvietnam.mvncore.util.StringUtil;

public class UserModuleProcessor {

    private static Log log = LogFactory.getLog(UserModuleProcessor.class);

    private final String ORIGINAL_REQUEST = "mvnforum.user.OriginalRequest";

    private HttpServlet     mainServlet     = null;
    private ServletContext  servletContext  = null;

    private UserModuleURLMapHandler  urlMapHandler            = new UserModuleURLMapHandler();
    private ForumWebHandler          forumWebHandler          = new ForumWebHandler();
    private ThreadWebHandler         threadWebHandler         = new ThreadWebHandler();
    private PostWebHandler           postWebHandler           = new PostWebHandler();
    private AttachmentWebHandler     attachmentWebHandler     = new AttachmentWebHandler();
    private MemberWebHandler         memberWebHandler         = new MemberWebHandler();
    private WatchWebHandler          watchWebHandler          = new WatchWebHandler();
    private FavoriteThreadWebHandler favoriteThreadWebHandler = new FavoriteThreadWebHandler();
    private OnlineUserManager        onlineUserManager        = OnlineUserManager.getInstance();

    public UserModuleProcessor(HttpServlet servlet) {
        mainServlet     = servlet;
        servletContext  = servlet.getServletContext();
    }

    public String process(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {

        long start = 0;
        String requestURI = StringUtil.getEmptyStringIfNull(request.getPathInfo());
        String responseURI = null;
        OnlineUser onlineUser = null;
        if (log.isDebugEnabled()) {
            start = System.currentTimeMillis();
            log.debug("UserModuleProcessor : requestURI  = " + requestURI);
        }

        // step 1: some command need to be processed before we do the URI mapping (of the MODAL)
        // MODAL processing
        try {
            onlineUser = onlineUserManager.getOnlineUser(request);
            if (requestURI.equals("/index")) {
                if (MVNForumConfig.getEnableNewIndexPage()) {
                    forumWebHandler.prepareListIndex(request, requestURI);//no permission
                } else {
                    forumWebHandler.prepareList(request, requestURI);//no permission
                }
            } else if (requestURI.equals("/listforums")) {
                forumWebHandler.prepareList(request, requestURI);//no permission
            } else if (requestURI.equals("/listthreads")) {
                threadWebHandler.prepareList_limit(request);
            } else if (requestURI.equals("/listrecentthreads")) {
                threadWebHandler.prepareListRecentThreads_limit(request);//no permission
            } else if (requestURI.equals("/viewthread")) {
                postWebHandler.prepareViewThread(request);
            } else if (requestURI.equals("/printthread")) {
                postWebHandler.prepareViewThread(request);

            } else if (requestURI.equals("/deletethread")) {
                threadWebHandler.prepareDelete(request);
            } else if (requestURI.equals("/deletethreadprocess")) {
                threadWebHandler.processDelete(request);
            } else if (requestURI.equals("/movethread")) {
                threadWebHandler.prepareMoveThread(request);
            } else if (requestURI.equals("/movethreadprocess")) {
                threadWebHandler.processMoveThread(request);
            } else if (requestURI.equals("/editthreadstatus")) {
                threadWebHandler.prepareEditThreadStatus(request);
            } else if (requestURI.equals("/editthreadstatusprocess")) {
                threadWebHandler.processEditThreadStatus(request);

            } else if (requestURI.equals("/modcp")) {
                threadWebHandler.prepareModerationControlPanel(request);
            } else if (requestURI.equals("/listpendingthreads")) {
                threadWebHandler.prepareListDisabledThreads_inForum_limit(request);
            } else if (requestURI.equals("/listrecentpendingthreads")) {
                threadWebHandler.prepareListRecentDisabledThreads_limit(request);
            } else if (requestURI.equals("/listthreadswithpendingposts")) {
                threadWebHandler.prepareListEnableThreadsWithPendingPosts_inForum_limit(request);
            } else if (requestURI.equals("/listrecentthreadswithpendingposts")) {
                threadWebHandler.prepareListRecentEnableThreadsWithPendingPosts_limit(request);
            } else if (requestURI.equals("/moderatependingthreads")) {
                threadWebHandler.prepareModeratePendingThreads_inForum_limit(request);
            } else if (requestURI.equals("/moderatependingthreadsprocess")) {
                threadWebHandler.processModeratePendingThreads(request);
            } else if (requestURI.equals("/moderatependingposts")) {
                postWebHandler.prepareModeratePendingPosts_limit(request);
            } else if (requestURI.equals("/moderatependingpostsprocess")) {
                postWebHandler.processModeratePendingPosts(request);

            } else if (requestURI.equals("/listpendingthreadsxml")) {
                threadWebHandler.prepareListDisabledThreads_limit_xml(request);

            } else if (requestURI.equals("/addpost")) {
                postWebHandler.prepareAdd(request);
            } else if (requestURI.equals("/addpostprocess")) {
                postWebHandler.processAdd(request);
            } else if (requestURI.equals("/editpost")) {
                postWebHandler.prepareEdit(request);
            } else if (requestURI.equals("/updatepost")) {
                postWebHandler.processUpdate(request);
            } else if (requestURI.equals("/printpost")) {
                postWebHandler.preparePrintPost(request);
            } else if (requestURI.equals("/deletepost")) {
                postWebHandler.prepareDelete(request);
            } else if (requestURI.equals("/deletepostprocess")) {
                postWebHandler.processDelete(request);

            } else if (requestURI.equals("/addattachment")) {
                attachmentWebHandler.prepareAdd(request);
            } else if (requestURI.equals("/addattachmentprocess")) {
                attachmentWebHandler.processAdd(request);
            } else if (requestURI.equals("/getattachment")) {
                attachmentWebHandler.downloadAttachment(request, response);//@todo: check permission and return 403 Forbidden
                return null;//download attachment, no further process is needed
            } else if (requestURI.equals("/deleteattachment")) {
                attachmentWebHandler.prepareDelete(request);
            } else if (requestURI.equals("/deleteattachmentprocess")) {
                attachmentWebHandler.processDelete(request);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -