File downloaded and injected in a iframe

1,587 views
Skip to first unread message

julio

unread,
Sep 2, 2007, 12:22:02 PM9/2/07
to Google Web Toolkit
Hi,

my gwt application is deployed in tomcat like a war (via maven-gwt-
plugin).

Application downloads a file from a generic url in a temp-dir.

Now I'm interested to display this downloaded file in iframe.

This doesn't work:

<iframe src="file:///temp-dir-path/file.html"...

The only way is put this file in context path like this (done
manually):

<iframe src="http://localhost:8080/myapp/temp-dir-path/file.html"...

and it works.

How can I do this?
Is it the right way? Or are there alternatives?

Thanks,
Julio

julio

unread,
Sep 2, 2007, 4:32:48 PM9/2/07
to Google Web Toolkit
Maybe my question is too confusing

how can via RPC server flush a html file (like a stream of bytes for
example) to client and client put this stream in iframe to display it?

Peter Blazejewicz

unread,
Sep 2, 2007, 5:57:59 PM9/2/07
to Google Web Toolkit
hi julio,

can you simply format correct URL for GET requests (url+params) and
use it as property for your "src" tag in iframe?

regards,
Peter

julio

unread,
Sep 3, 2007, 3:18:05 AM9/3/07
to Google Web Toolkit
Yes,

you mean:

<iframe src="/myapp/load.do?url=\"http://www,google.com\""....

where load.do is a servlet that flushes stream of page-bytes to client
via GET/response

but I would like know if it's (and how) possible via GWT-RPC

Thanks,
Julio

On 2 Set, 23:57, Peter Blazejewicz <peter.blazejew...@gmail.com>
wrote:

Peter Blazejewicz

unread,
Sep 3, 2007, 3:51:25 PM9/3/07
to Google Web Toolkit
hi,
yes, I mean: set "src" or "url" property of iframe to your generated
content url (so no RPC, just simple correctly formatted URL),
I'm not awared of other way of setting iframe content, maybe by some
DOM elements manipulation,

regards,
Peter

Peter Blazejewicz

unread,
Sep 3, 2007, 3:53:01 PM9/3/07
to Google Web Toolkit
hi,
for your interest, someone posted already similiar topic (content of
iframe):
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/76bddb269e3340a5/3810c3cc5312bebd?lnk=gst&q=iframe+content&rnum=1#3810c3cc5312bebd
which seems to be not-portable solution,
regards,
Peter

julio

unread,
Sep 4, 2007, 7:51:26 AM9/4/07
to Google Web Toolkit
I did with GET/response way with this code in controller:

File file = new File ("/path/index.html");

// Prepare streams.
BufferedInputStream input = null;
BufferedOutputStream output = null;

try {
// Open file file.
input = new BufferedInputStream(new
FileInputStream(file));
int contentLength = input.available();

// Init servlet response.
response.reset();
response.setContentLength(contentLength);
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition", "attachment;
filename=\"index.html\"");
output = new
BufferedOutputStream(response.getOutputStream());

// Write file contents to response.
while (contentLength-- > 0) {
output.write(input.read());
}

output.flush();
} catch (IOException e) {
// Something went wrong?
e.printStackTrace();
} finally {
input.close();
output.close();
}
}

but a popup dialog is open that ask if open or save that file!!!!!
how can avoid this popup-dialog?????????

Thanks,
Julio

On 3 Set, 21:53, Peter Blazejewicz <peter.blazejew...@gmail.com>
wrote:


> hi,
> for your interest, someone posted already similiar topic (content of

> iframe):http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...

Reply all
Reply to author
Forward
0 new messages