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

📄 shownetworkplacesform.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
/*
 *  SSL-Explorer
 *
 *  Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
 *
 *  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 (at your option) any later version.
 *  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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
			
package com.sslexplorer.vfs.forms;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sslexplorer.core.CoreServlet;
import com.sslexplorer.policyframework.ResourceUtil;
import com.sslexplorer.policyframework.forms.AbstractResourcesForm;
import com.sslexplorer.security.Constants;
import com.sslexplorer.security.SessionInfo;
import com.sslexplorer.util.TicketGenerator;
import com.sslexplorer.vfs.NetworkPlace;
import com.sslexplorer.vfs.NetworkPlaceItem;
import com.sslexplorer.vfs.webdav.DAVMount;
import com.sslexplorer.vfs.webdav.DAVProcessor;
import com.sslexplorer.vfs.webdav.DAVRepository;
import com.sslexplorer.vfs.webdav.DAVStore;

public class ShowNetworkPlacesForm extends AbstractResourcesForm {

    List networkPlaceItems;

    static Log log = LogFactory.getLog(ShowNetworkPlacesForm.class);

    public ShowNetworkPlacesForm() {
        super("networkPlace");
    }

    /**
     * @param processor
     * @param session
     * @throws Exception
     */
    public void initialize(DAVProcessor processor, SessionInfo session) throws Exception {
        super.initialize(session.getHttpSession(), "name");
        if (session.getNavigationContext() == SessionInfo.USER_CONSOLE_CONTEXT) {
            List networkPlaceItems = processor.getRepository().refreshNetworkMounts(session);
            for (Iterator i = networkPlaceItems.iterator(); i.hasNext();) {
                NetworkPlaceItem npi = (NetworkPlaceItem) i.next();
                npi.setFavoriteType(getFavoriteType(npi.getResource().getResourceId()));
                getModel().addItem(npi);
            }
        } else if (session.getNavigationContext() == SessionInfo.MANAGEMENT_CONSOLE_CONTEXT) {
            networkPlaceItems = new ArrayList();
            // Now create the items
            List resources = ResourceUtil.filterManageableResources(
                CoreServlet.getServlet().getSystemDatabase().getNetworkPlaces(), session.getUser());
            for (Iterator i = resources.iterator(); i.hasNext();) {
                NetworkPlace np = (NetworkPlace) i.next();
                DAVStore store = DAVRepository.getInstance().getStore(np.getScheme());
                if (store == null) {
                    log.warn("Store that handles '" + np.getScheme() + "' cannot be found.");
                } else {
                    DAVMount mount = store.getMountFromString(np.getResourceName(), session);
                    NetworkPlaceItem npi = new NetworkPlaceItem(np, mount == null ? ( store.getName() + "/" ) : mount.getMountString(), CoreServlet.getServlet()
                                    .getPolicyDatabase().getPoliciesAttachedToResource(np), np.sessionPasswordRequired(session));
                    npi.setFavoriteType(getFavoriteType(np.getResourceId()));
                    getModel().addItem(npi);
                }
            }
        }
        checkSort();
        getPager().rebuild(getFilterText());

        /*
         * Store a ticket for use with launching a web folder without
         * authenticating. This ticket will only be available until it is used
         */
        if (session.getHttpSession().getAttribute(Constants.WEB_FOLDER_LAUNCH_TICKET) == null) {
            session.getHttpSession().setAttribute(Constants.WEB_FOLDER_LAUNCH_TICKET,
                TicketGenerator.getInstance().generateUniqueTicket("W", 6));
        }
    }
}

⌨️ 快捷键说明

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