当前位置: 技术问答>java相关
难者不会,会者不难……
来源: 互联网 发布时间:2015-02-25
本文导语: SSL加密中,可不可以在IE浏览器中嵌入MS-EXCEL报表? 本人使用Servlet开发时,报表打印使用了Formula One for Java 8.0,可以在IE中嵌入EXCEL,正常使用(http://)没有问题,但一旦将Websphere设置成SSL方式,再用https://...
SSL加密中,可不可以在IE浏览器中嵌入MS-EXCEL报表?
本人使用Servlet开发时,报表打印使用了Formula One for Java 8.0,可以在IE中嵌入EXCEL,正常使用(http://)没有问题,但一旦将Websphere设置成SSL方式,再用https://方式调用报表时,系统提示:无法找到文件或文件存在,不明其所然,望赐教!
import com.f1j.swing.*;
import com.f1j.*;
import com.f1j.ss.*;
public void Paint()
{
try
{
setContentType("application/vnd.ms-excel");
ServletOutputStream out = getOutputStream();
com.f1j.ss.BookModelImpl book = new com.f1j.ss.BookModelImpl();
book.getLock();
book.setText(0,0,"TEST");
book.recalc();
book.write(out, book.eFileExcel97);
out.flush();
out.close();
}
catch(Throwable e)
{
System.out.println(e.getMessage());
}
finally
{
book.releaseLock();
}
}
本人使用Servlet开发时,报表打印使用了Formula One for Java 8.0,可以在IE中嵌入EXCEL,正常使用(http://)没有问题,但一旦将Websphere设置成SSL方式,再用https://方式调用报表时,系统提示:无法找到文件或文件存在,不明其所然,望赐教!
import com.f1j.swing.*;
import com.f1j.*;
import com.f1j.ss.*;
public void Paint()
{
try
{
setContentType("application/vnd.ms-excel");
ServletOutputStream out = getOutputStream();
com.f1j.ss.BookModelImpl book = new com.f1j.ss.BookModelImpl();
book.getLock();
book.setText(0,0,"TEST");
book.recalc();
book.write(out, book.eFileExcel97);
out.flush();
out.close();
}
catch(Throwable e)
{
System.out.println(e.getMessage());
}
finally
{
book.releaseLock();
}
}
|
My problem is, I can not download a html page with content type "application/vnd.ms-excel" generated by a serverlet on IBM Websphere with SSL option turned on.
The html page, which generate an excel page on client browser works well when SSL turned off, but failed when on.
I have heard of things like this happend elsewhere and I have no idea why.
I will be very grateful if you may help me or ask me more details about my question, by email or telephone.
ragweed@263.net (010)66069966-8838
The html page, which generate an excel page on client browser works well when SSL turned off, but failed when on.
I have heard of things like this happend elsewhere and I have no idea why.
I will be very grateful if you may help me or ask me more details about my question, by email or telephone.
ragweed@263.net (010)66069966-8838
|
import javax.net.ssl.*;
import java.io.*;
import java.net.*;
import java.security.*;
public class SSLSocketClient {
public static void main(String args[]) throws Exception {
String urlString = (args.length == 1) ?
args[0] : "http://www.verisign.com/index.html";
URL url = new URL(/tech-qa-java/urlString/index.html);
Security.addProvider(
new com.sun.net.ssl.internal.ssl.Provider());
SSLSocketFactory factory =
(SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket =
(SSLSocket)factory.createSocket(url.getHost(), 443);
PrintWriter out = new PrintWriter(
new OutputStreamWriter(
socket.getOutputStream()));
out.println("GET " + urlString + " HTTP/1.1");
out.println();
out.flush();
BufferedReader in = new BufferedReader(
new InputStreamReader(
socket.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
out.close();
in.close();
}
}
import java.io.*;
import java.net.*;
import java.security.*;
public class SSLSocketClient {
public static void main(String args[]) throws Exception {
String urlString = (args.length == 1) ?
args[0] : "http://www.verisign.com/index.html";
URL url = new URL(/tech-qa-java/urlString/index.html);
Security.addProvider(
new com.sun.net.ssl.internal.ssl.Provider());
SSLSocketFactory factory =
(SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket =
(SSLSocket)factory.createSocket(url.getHost(), 443);
PrintWriter out = new PrintWriter(
new OutputStreamWriter(
socket.getOutputStream()));
out.println("GET " + urlString + " HTTP/1.1");
out.println();
out.flush();
BufferedReader in = new BufferedReader(
new InputStreamReader(
socket.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
out.close();
in.close();
}
}