Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.SocketException: Connection reset by peer: socket write error

khalil ramDec 29 2015 — edited Dec 30 2015

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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 27 2016
Added on Dec 29 2015
18 comments
3,592 views