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

📄 connectioninfo.java

📁 轻量级Http代理服务器
💻 JAVA
字号:
/*
 * jRevProxy, an opensource Java reverse proxy server
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 *
 * $Id: ConnectionInfo.java,v 1.6 2003/04/23 20:25:28 fnoe Exp $ 
 */
package cx.noe.jrevproxy;

import cx.noe.jrevproxy.logging.ILog;
import java.net.InetSocketAddress;
import javax.security.cert.X509Certificate;
import javax.security.cert.CertificateExpiredException;
import javax.security.cert.CertificateNotYetValidException;
 
/**
 * Connection
 * @author  <a href="mailto:frederik@noe.cx">Frederik Noe</a>
 * @version <tt>$Revision: 1.6 $</tt>
 */
public class ConnectionInfo implements ILog {
    
    private X509Certificate certificate = null;
    private ILog logger = null;
    private InetSocketAddress socketaddress = null;
    
    /** 
     * Creates a new instance of ConnectionInfo
     */
    public ConnectionInfo(ILog logger, InetSocketAddress sockaddress) {
        this.logger = logger;
        this.socketaddress = socketaddress;
    }
    
    /**
     * Retrieves the socketaddress associated to the connection
     * @return the socketaddress
     */
    public InetSocketAddress getSocketAddress() {
        log(METHOD,"--getSocketAddress--");
        return socketaddress;
    }
    
    /**
     *  Sets the X509 certificate of the user authenticated for this connection
     *  @param certificate the X509 certificate of the user
     */
    public void setCertificate(X509Certificate certificate) {
        log(METHOD,"--setCertificate--");
        log(DEBUG,"Certificate SubjectDN: " + certificate.getSubjectDN().getName());
        this.certificate = certificate;   
    }
    
    /**
     * Retrieves the X509 certificate of the user that authenticated for this connection
     * @return the X509 certificate
     */
    public X509Certificate getCertificate() {
        log(METHOD,"--getCertificate--");
        return certificate;
    }
    
    public void log(int level, String str) {
        if(logger != null)
            logger.log(level,"[ConnectionInfo] " + str);
    }
    
    public void log(Throwable e) {
        if(logger != null)
            logger.log(e);
    }    
}

⌨️ 快捷键说明

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