📄 log4jinit.java
字号:
package com.haven.sinopec.util;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.servlet.* ;
import javax.servlet.http.* ;
import org.apache.log4j.PropertyConfigurator;
import java.security.cert.CertificateFactory;
import java.security.cert.X509CRL;
import java.util.Calendar;
public class Log4jInit extends HttpServlet {
public void init() throws ServletException {
String prefix = getServletContext().getRealPath("/");
String file = getServletConfig().getInitParameter("log4j");
if (file != null) {
PropertyConfigurator.configure(prefix + file);
}
Calendar cal = Calendar.getInstance();
try {
URL url=new URL("http://203.207.166.118:8080/cgi-bin/CGIProxy.exe?action=getcrlbyvca");
HttpURLConnection httpUrl = (HttpURLConnection) url.openConnection();
httpUrl.connect();
//获取网络输入流
BufferedInputStream bis = new BufferedInputStream(httpUrl.getInputStream());
CertificateFactory cf=CertificateFactory.getInstance("X.509");
X509CRL crl=(X509CRL)cf.generateCRL(bis);
bis.close();
getServletContext().setAttribute("CRL",crl);
getServletContext().setAttribute("GETTIME",cal.getTime());
} catch (Exception e) {
}
//cx.getContext()
}
public void doGet(HttpServletRequest request,HttpServletResponse response)throws
IOException, ServletException {}
public void doPost(HttpServletRequest request,HttpServletResponse response)throws
IOException, ServletException {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -