📄 showkeystoreform.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.keystore.forms;
import java.util.Enumeration;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sslexplorer.boot.KeyStoreManager;
import com.sslexplorer.keystore.CertificateItem;
import com.sslexplorer.setup.CertificatesTableItemModel;
import com.sslexplorer.table.forms.AbstractPagerForm;
public class ShowKeyStoreForm extends AbstractPagerForm {
private static final long serialVersionUID = 2153872643060037840L;
static Log log = LogFactory.getLog(ShowKeyStoreForm.class);
private String selectedKeyStoreName;
public ShowKeyStoreForm() {
super(new CertificatesTableItemModel());
selectedKeyStoreName = KeyStoreManager.DEFAULT_KEY_STORE;
}
public void setSelectedKeyStoreName(String selectedKeyStoreName) {
this.selectedKeyStoreName = selectedKeyStoreName;
}
public String getSelectedKeyStoreName() {
return selectedKeyStoreName;
}
public KeyStoreManager getSelectedKeyStore() {
return KeyStoreManager.getInstance(getSelectedKeyStoreName());
}
public List getKeyStores() {
return KeyStoreManager.getKeyStores();
}
public void initialize(HttpSession session) {
super.initialize(session, "alias");
CertificateItem[] c = getCertificateItems();
if(c != null) {
for(int i = 0 ; i < c.length; i++) {
getModel().addItem(c[i]);
}
}
getPager().rebuild(getFilterText());
}
/**
* Return an array of {@link CertificateItem} objects contained within
* the keystore.
*
* @return array of {@link CertificateItem}s.
*/
public CertificateItem[] getCertificateItems() {
KeyStoreManager sel = getSelectedKeyStore();
Enumeration e = sel.getCertificateAliases();
if(e != null) {
CertificateItem[] cert = new CertificateItem[sel.getSize()];
int i = 0;
while(e.hasMoreElements()) {
String alias = (String) e.nextElement();
cert[i++] = new CertificateItem(alias, sel.getCertificate(alias), sel);
}
return cert;
}
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -