delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

Note, I am not setting the header as I dont want an save/open dialog box...
Oh yes, one more thing.. sometimes on certain blobs, i get this error "java.lang.IllegalStateException: getOutputStream() has already been called for this response"
Why does this happens??
any suggestions??
thnx,
sgaucho


Hi,
I hv the fwg code that reads a blob from an Oracle db and outputs it.. the prob is that the output is shown in the same browser window or in some cases opens abruptly in another application (in my case it opened in Homesite!!)...
Is there any way I can force the output to appear in a new browser window like a pop up??
PHP Code:
response
.
setContentType
(
contype
);
// response.setHeader("Content-Disposition", "attachment; filename=\"" + doccode + excel +"\"");
long index
=
1
;
      while(
index
<
doc
.
length
()){
response
.
getOutputStream
().
write
(
doc
.
getBytes
(
index
,
100
));
index
+=
100
;
     }
Note, I am not setting the header as I dont want an save/open dialog box...
Oh yes, one more thing.. sometimes on certain blobs, i get this error "java.lang.IllegalStateException: getOutputStream() has already been called for this response"
Why does this happens??
any suggestions??
thnx,
sgaucho

TOP

Well, as for setting the header, if you don't set a content type the browser is going to assume text/html.  You probably don't want that if you're sending back an xls file.
As for a popup window, the best way would be to create the popup window *first*, and point it at your code.
The odd window behavior is probably related to the content type not being text/html.
As for the error, your while loop should look like
Code:
  1. OutputStream out = response.getOutputStream();
  2. while(index < doc.length()) {
  3.   out.write(doc.getBytes(index,100));
  4.   index+=100;
  5. }
Copy Code

TOP

Hi,
I changed my code as per ur suggestion, but continue to get the "java.lang.IllegalStateException: getOutputStream() has already been called for this response" Error...
AGain, this happens only on a few types of blobs.. whats strange is I hv 4 types of blobs.. word, an xls file, 1 text and 2 images... the code runs fine for all except for 1 image where it throws the above exception..
any more suggestions??
thnx again,
sands

TOP

solved it.. closed the outputStream and the problem disappeared...



Note, I am not setting the header as I dont want an save/open dialog box...
Oh yes, one more thing.. sometimes on certain blobs, i get this error "java.lang.IllegalStateException: getOutputStream() has already been called for this response"
Why does this happens??
any suggestions??
thnx,
sgaucho

TOP

Back Forum