Страница 1 из 1

JspCommonExtraWriter

Добавлено: 18 окт 2007, 19:08
michael
У меня есть JSP что пишет ZIP файл output.
<%@ page import="java.io.*,java.util.*,javax.servlet.*" %><%@ include file="env.jsp"%><%
/* $Revision: 4 $ */
File dir = new File(workingDir);
File packagesDir = new File(dir + "/packages");
File packageFile = new File(packagesDir + "/" + request.getParameter("fileName"));
FileInputStream fin = new FileInputStream(packageFile);
response.setHeader("Content-disposition", "attachment; filename=" + request.getParameter("fileName"));
response.setContentType("application/octet-stream");
response.setContentLength((int)packageFile.length());
PrintWriter requestOutput = response.getWriter();
int c;
c = fin.read();
while (c != -1) {
requestOutput.write(c);
c = fin.read();
}
fin.close();
%>


но файл по прибытие не открывается (the file is not a valid archive)
Я открыл файл JAVA что сгенерил Apache и увидел




com.evermind.server.http.JspCommonExtraWriter __ojsp_s_out = (com.evermind.server.http.JspCommonExtraWriter) out;
try {


__ojsp_s_out.write(__oracle_jsp_text[0]);
__ojsp_s_out.write(__oracle_jsp_text[1]);
__ojsp_s_out.write(__oracle_jsp_text[2]);
__ojsp_s_out.write(__oracle_jsp_text[3]);
// $Header: txkincl.jsp 120.2 2006/07/13 19:12:07 lymiller noship $
__ojsp_s_out.write(__oracle_jsp_text[4]);
__ojsp_s_out.write(__oracle_jsp_text[5]);
__ojsp_s_out.write(__oracle_jsp_text[6]);
__ojsp_s_out.write(__oracle_jsp_text[7]);
__ojsp_s_out.write(__oracle_jsp_text[8]);
__ojsp_s_out.write(__oracle_jsp_text[9]);




__oracle_jsp_text[0] =
"\n".getBytes("ISO8859_1");
__oracle_jsp_text[1] =
"\n".getBytes("ISO8859_1");
__oracle_jsp_text[2] =
"\n".getBytes("ISO8859_1");
__oracle_jsp_text[3] =
"\n".getBytes("ISO8859_1");
__oracle_jsp_text[4] =
"\n".getBytes("ISO8859_1");
__oracle_jsp_text[5] =
"\r\n\r\n".getBytes("ISO8859_1");
__oracle_jsp_text[6] =
"\r\n\r\n\r\n".getBytes("ISO8859_1");
__oracle_jsp_text[7] =
"\r\n".getBytes("ISO8859_1");
__oracle_jsp_text[8] =
"\r\n\r\n".getBytes("ISO8859_1");
__oracle_jsp_text[9] =
"\r\n\r\n".getBytes("ISO8859_1");
__oracle_jsp_text[10] =
"\r\n".getBytes("ISO8859_1");


почему мне в stream пишется ето гадость и как от неё избавится?

Спасибо