hi all,
i'm using jdevelopper 11.1.2.4, my use case is to display a pdf as byte [] in a dialog popup.
i've followed this sample : https://technology.amis.nl/2011/07/28/adf-11g-show-pdf-in-a-popup/
so i use an inline frame to show the pdf with a servlet here is my doget function :
| public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| |
| BufferedOutputStream output = null; |
| InputStream input = null; |
| BufferedInputStream in = null; |
| ReportResponse resp = BIPublisherBean.callReport(); |
| byte [] report = resp.getReportBytes(); |
| // Open streams. |
| response.reset(); |
| response.setContentType(CONTENT_TYPE); |
| |
| try { |
| input = new ByteArrayInputStream(report); |
| in = new BufferedInputStream(input); |
| output = new BufferedOutputStream(response.getOutputStream(), 10240); |
| |
| // Write file contents to response. |
| byte[] buffer = new byte[10240]; |
| int length; |
| while ((length = in.read(buffer,0,10240)) != -1 ) { |
| output.write(buffer, 0, length); |
| } |
| } catch(Exception ex){ |
| ex.printStackTrace(); |
| } finally { |
| if (output != null) output.close(); |
| if (in != null) in.close(); |
| } |
| } |
my inline frame :
<af:inlineFrame id="if1" shortDesc="This is an inline frame"
source="/showpdfservlet"
styleClass="AFStretchWidth" inlineStyle="height:600px;">
</af:inlineFrame>
but when i run the application i get the error bellow : java.net.SocketException: Connection reset by peer: socket write error ;
Thanks
khalil