473,569 Members | 2,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change a response's content type mid-post?

Hi there,

I'm wondering if it's possible to change the content type of a
HttpResponse after the call to getWriter has been made? What I'm
trying to do is upload a file, and then once it has bee uploaded write
some HTML to the screen indicating that the upload is complete. Any
ideas anyone?

e.g.

response.setCon tentType("text/csv");
response.setHea der("Cache-Control", "no-cache");
response.setHea der("Expires", "-1");
response.addHea der("Content-disposition",
"inline;filenam e=report.csv");
out = response.getWri ter();

.... then write out your CSV file
can you then:

response.setCon tentType("text/html");
response.setHea der("Cache-Control", "no-cache");
response.setHea der("Expires", "-1");
out = response.getWri ter();

It doesn't seem to work for me, so I'm wondering is it even possible?

Cheers,
Paul.
Jul 17 '05 #1
2 6233
The writer is a response thing. Uploading is a request thing. From your
code, it looks more like you're trying to download a csv file, not
upload. And no, you can't download a csv file, which will probably
either spawn excel or a download prompt, and then somehow display html
also, but again, everything you said put together doesn't quite add up,
so I think you're using a wrong object somewhere.

Jul 17 '05 #2
Not quite possible with HTTP for atleast now. However you can use a
technique called server push. For more information see Java Servlet
Programming by Jason Hunter or visit www.servlets.com. :-)

Viator

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
2900
by: Tony Carnell | last post by:
Hi all, A couple of days ago I posted a message to this newsgroup relating to the fact that a design I'd worked on for a client wasn't displaying its stylesheet in Mozilla browsers. I was advised by a couple of other newsgroup members far more knowledgeable that I on this subject that I should contact the Web host and ask them to alter the...
1
2068
by: Amir Eshterayeh | last post by:
Dear Friends I need to change the css file of my aspx files dynamically so users can choose their css file names and when page loads, it read css file name from database. I try to use response.write to write this way: Dim i As Integer = 1 If i = 1 Then Response.Write("<LINK href=""Stylesone.css"" type=""text/css"" rel=""stylesheet"">")...
4
8405
by: Max Dupenois | last post by:
I've seen numerous articles with similair (similar sp?) titles to this in my search.. unfortunately none of them seem to contain what i want, (or if they do i need someone to point out my stupidity for me :p ) Anyway I have a file dialog box being opened using Response.AddHeader "Content-Disposition", "attachment;filename=""" &...
4
2904
by: david | last post by:
I has a question: I can use Response.WriteFile to display images such as .jpg. But I can not us it to display words doc file in EI by calling Response.WriteFile("testdoc/DownloadLarge.doc"). It only shows unreadable chars. How to use it to show the doc file on webrowser? Thanks
2
7967
by: Greg Strong | last post by:
Hello All, Is it possible to change table field lookup properties in code? I've been able to change other field properties in code, however so far no luck with field lookup properties. What I've done for test purposes is use a text input file for the table field lookup properties. I thought that I'd start first by just changing the...
11
15069
by: Trapulo | last post by:
I've this statement in my output's creation: Response.Clear() Response.ContentType = "application/vnd.google-earth.kml+xml kml" Response.AddHeader("Content-Disposition", "inline; filename=Log_" & activityLogID & ".kml") The strage is that on my development server all works (IE try to open the
3
2699
by: Jim Rojas | last post by:
I am running IIS v6.1 on a virtual hosting server. Changing the default metabase value is out of the question. Can someone tell me how I can fix this script? Thank you. <% set conn = server.CreateObject("Adodb.connection") conn.open application("connStr") manualID = request.querystring("manualID") if request.Form("manualID") <"" then...
3
3139
by: helraizer1 | last post by:
I have this code in JS function show_player() { document.mediaplayer1.style.visibility = "visible"; } function content(p, clip) { var mus = document.getElementById('music'); mus.style.visibility = "visible";
5
2404
by: dmorand | last post by:
Ok, I'm very new to asp, but this is what I'm trying to accomplish. I want to have a selection drop down list where the user can select a database to load. When they select the database, I want that value to then populate the asp variable named "database". I was hoping I could pass this using javascript, but I don't think I can because asp is...
2
2234
by: malcster2 | last post by:
hello, i am a beginner to ajax. i have created a mysql database, which i would like to access from a web page. i have created 3 files, a html to display the data, a php file to extract the data, and a javascript file to to the clever stuff. when i access the html page, all the data is displayed correcty, but if i add or delete any records,...
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.