📄 webforwardsform.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.webforwards.forms;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sslexplorer.boot.HostService;
import com.sslexplorer.core.CoreServlet;
import com.sslexplorer.core.CoreUtil;
import com.sslexplorer.policyframework.forms.AbstractResourcesForm;
import com.sslexplorer.security.SessionInfo;
import com.sslexplorer.security.VPNSession;
import com.sslexplorer.webforwards.WebForward;
import com.sslexplorer.webforwards.WebForwardItem;
import com.sslexplorer.webforwards.WebForwardItemModel;
/**
* <p>
* Form providing the list of web forwards to the jspf.
*
* @author James D Robinson <a href="mailto:james@3sp.com"><james@3sp.com></a>
*
*/
public class WebForwardsForm extends AbstractResourcesForm {
private static Log log = LogFactory.getLog(WebForwardsForm.class);
static List types = Arrays.asList(new Type[] { new Type(new Integer(WebForward.TYPE_TUNNELED_SITE), "Tunneled Site"),
new Type(new Integer(WebForward.TYPE_REPLACEMENT_PROXY), "Replacement Proxy"),
new Type(new Integer(WebForward.TYPE_REVERSE_PROXY), "Reverse proxy") });
String type;
/**
* Construtor
*/
public WebForwardsForm() {
super(new WebForwardItemModel("webForward"));
}
/**
* <p>
* Initialise the pager and the items and the ability to sort.
*
* @param webForwards List of Web Forwards to be added.
* @param hostService host service
* @param vpnSession vpn session
* @param sessionInfo session
*/
public void initialise(List webForwards, HostService hostService, VPNSession vpnSession, SessionInfo sessionInfo) {
super.initialize(sessionInfo.getHttpSession(), "category");
try {
for (Iterator i = webForwards.iterator(); i.hasNext();) {
WebForward wf = (WebForward) i.next();
List policies = CoreServlet.getServlet().getPolicyDatabase().getPoliciesAttachedToResource(wf);
WebForwardItem wfi = new WebForwardItem(wf, hostService, policies, wf.sessionPasswordRequired(sessionInfo));
wfi.setFavoriteType(getFavoriteType(wf.getResourceId()));
getModel().addItem(wfi);
}
checkSort();
getPager().rebuild(getFilterText());
} catch (Throwable t) {
log.error("Failed to initialise resources form.", t);
}
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List getTypeList() {
return types;
}
public static class Type {
String label;
Object value;
public Type(Object value, String label) {
this.value = value;
this.label = label;
}
public Object getValue() {
return value;
}
public String getLabel() {
return label;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -