Le 21 mai 04, � 19:10, Sihong Fan a �crit :
I want hide(security reason) a group of static PDF in jetspeed. So I read and write the PDF in jsp. This jsp page can read and write jsp out side jetspeed. But after I put it into jetspeed. It give me 'getWriter() has already been called for this response ' error.
Does any one know how to solve the problem?
Here is my jsp
<%@ page import="java.io.*" %> <%@ page import="java.net.*" %> <% OutputStream o = response.getOutputStream(); response.setContentType("application/pdf"); File f = new File("pdf/test2.pdf"); InputStream is = f.toURL().openStream(); byte[] buf = new byte[32 * 1024]; int nRead = 0; while( (nRead=is.read(buf)) != -1 ) { o.write(buf, 0, nRead); } %>
You can't mix 2 content-types in a single HTTP response. Your portlet needs to output
a valid HTML markup that the browser will then execute to to request the
PDF.
portlet sends:
document.location.href="http://myportal/jetspeed/portal/layout/raw.jsp/ template/sendPDF.jsp"
and put your sendPDF.jsp in webapp/WEB-INF/templates/jsp/screens/
you'll also need a webapp/WEB-INF/templates/jsp/layouts/raw.jsp:
<%
String screenJsp = (String)request.getAttribute("screenJsp");
%><jsp:include page="<%= screenJsp %>" flush="true" />
-- Rapha�l Luta - [EMAIL PROTECTED] Apache Jetspeed - Enterprise Portal in Java http://portals.apache.org/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
