Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

Serving binary content along with page refresh

Thread view: 
sasuke - 15 Mar 2008 19:48 GMT
Hello to all Java programmers out there.

I am currently faced with a weird scenario in which I have to serve
binary content to the client (using content disposition header) and at
the same time refresh the page so that it's contents are reloaded. I
am using JSF as a UI framework with JSP being the display technology.

The problem I am facing is that as soon as the content is generated,
any efforts to redirect the client or reload the page results in a
"Response already committed" exception. i.e. as soon as the client is
presented with the Open/Save dialog, no page refresh /redirection
takes place the way it normally happens. Is there any way using which
we can spit out the binary file to the client and at the same time
continue with the normal request - response cycle so that a page
refresh takes place?

Any suggestions / links would be highly appreciated.

Thanks and regards,
sasuke.
Chris - 16 Mar 2008 20:49 GMT
> Hello to all Java programmers out there.
>
[quoted text clipped - 16 lines]
> Thanks and regards,
> sasuke.

This is not the answer you're looking for, but I would put a link to the
binary content on the page itself, and let the user fetch the data on
their own in a separate request.

Another idea, probably won't work: you could increase the size of the
JSP page buffer, so nothing gets sent to client side until the entire
page is created.

Another idea: go to a site that works the way you want (maybe the
sourceforge download page?) and see what they do under the covers.
Examine the headers and the data that come back.
sasuke - 22 Mar 2008 17:43 GMT
> This is not the answer you're looking for, but I would put a link to the
> binary content on the page itself, and let the user fetch the data on
[quoted text clipped - 7 lines]
> sourceforge download page?) and see what they do under the covers.
> Examine the headers and the data that come back.

Thanks a lot for your reply. Yeah you were right, the sourceforge page
does exactly what I need though I am pretty confused of how they do
it. Maybe I am still in haze as to how the HTTP Response works.

Here is what I think of it: The HTTP Request sent by the client can be
treated in two ways: either the client action sends the client to same/
another page in which the HTTP Respose is the page given back to the
user. Or the client is served with some data and the page is never
refreshed. In this case the response is the data served back to the
client.

The confusing part here is that what I need and the way sourceforge
page works goes against my understanding of how HTTP response works.
Can someone please correct my flawed understanding and help me achieve
my purpose? Any links to articles/snippets would be greatly
appreciated.

Thanks and regards,
sasuke.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.