You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ran Harpaz <ip...@hotmail.com> on 2010/01/25 10:17:37 UTC
CSV File "Save as" dialogue defaults to HTM file
Hello, I'm using Jetspeed 1.6, running on Tomcat.
In a portlet I developed, I create a .csv file and print a link to it. The
user then needs to right-click on the file and select "save file as".
The dialogue that pops up defaults to file type HTML file, and replaces the
.csv extension of the file I link to with .htm.
Is there anyway to resolve this? I really need to give access to the csv
file as-is, and not bother my clients more than neccessary.
--
View this message in context: http://old.nabble.com/CSV-File-%22Save-as%22-dialogue-defaults-to-HTM-file-tp27303866p27303866.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: CSV File "Save as" dialogue defaults to HTM file
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ran,
> Thank you, but this solution doesn't seem to work on Jetspeed, due to the
> fact that I'm running JSR-168 Portlets on it. I don't believe they support
> changing the response's ContentType.
>
> I wanted to know if there was anything about the Tomcat platform that could
> result in a CSV file defaulting to an HTM file, and if there was anything to
> do about it.
Tomcat will not mess around with any file extensions, etc.
If you don't set the Content-Disposition with the "attachment"
attribute, then the filename will default to that used in the URL, which
likely ends in ".htm" in your webapp, apparently.
In this case, you might have to switch to using a plain-old servlet
(which I would highly recommend over the use of a JSP in this case, as
JSPs can add all sorts of unwanted output to your generated files).
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktd7mEACgkQ9CaO5/Lv0PAFNQCgjAPtEMbqkuitt0EG08JKZgPM
76cAn2oxfMPsNbCm2/x/7sAd3lGHbD/a
=7F2H
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: CSV File "Save as" dialogue defaults to HTM file
Posted by Jeffrey Janner <Je...@PolyDyne.com>.
Ran -
I'm unfamiliar with Jetspeed, so take what I say next with a grain of
salt.
When you say "print a link to it", do you mean to say you add an <A> tag
to the resulting page with the appropriate path? So the user is just
clicking on a regular html <A> link?
If so, then I would think adding a <mime-mapping> for the .csv extension
to your web.xml would be sufficient. There is no mime-mapping for .csv
in the standard web.xml file distributed with Tomcat.
If instead your portlet/servlet is streaming the file (or anything more
complicated), then you'll need the advice of someone more technical than
me.
Jeff
-----Original Message-----
From: Ran Harpaz [mailto:ipaqi1@hotmail.com]
Sent: Monday, January 25, 2010 12:04 PM
To: users@tomcat.apache.org
Subject: Re: CSV File "Save as" dialogue defaults to HTM file
Alessandro Bahgat wrote:
>
> On Mon, Jan 25, 2010 at 11:02 AM, Pid <pi...@pidster.com> wrote:
>> On 25/01/2010 09:17, Ran Harpaz wrote:
>>>
>>> Hello, I'm using Jetspeed 1.6, running on Tomcat.
>>>
>>> In a portlet I developed, I create a .csv file and print a link to
it.
>>> The
>>> user then needs to right-click on the file and select "save file
as".
>>>
>>> The dialogue that pops up defaults to file type HTML file, and
replaces
>>> the
>>> .csv extension of the file I link to with .htm.
>>>
>>> Is there anyway to resolve this? I really need to give access to the
csv
>>> file as-is, and not bother my clients more than neccessary.
>>
>> Are you setting the "Content-type" header to "text/csv", or are you
just
>> generating it with a JSP?
>>
>> The latter will automatically set text/html as the content type.
>
> You may also want to change the content-disposition header in order to
> make your server prompt the user with the "save as" dialog:
>
> For example,
>
> response.setHeader("Content-disposition",
> "attachment; filename=" +
> defaultCsvFilename );
>
> Regards,
> Alessandro
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
Thank you, but this solution doesn't seem to work on Jetspeed, due to
the
fact that I'm running JSR-168 Portlets on it. I don't believe they
support
changing the response's ContentType.
I wanted to know if there was anything about the Tomcat platform that
could
result in a CSV file defaulting to an HTM file, and if there was
anything to
do about it.
--
View this message in context:
http://old.nabble.com/CSV-File-%22Save-as%22-dialogue-defaults-to-HTM-fi
le-tp27303866p27308426.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
******************************* NOTICE *********************************
This message is intended for the use of the individual or entity to which
it is addressed and may contain information that is privileged,
confidential, and exempt from disclosure under applicable law. If the
reader of this message is not the intended recipient or the employee or
agent responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or copying
of this communication is strictly prohibited. If you have received this
communication in error, please notify us immediately by reply or by
telephone (call us collect at 512-343-9100) and immediately delete this
message and all its attachments.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: CSV File "Save as" dialogue defaults to HTM file
Posted by Ron McNulty <rm...@xtra.co.nz>.
Hi Ran
JSR168 portlets do not support rendering CSV - just HTML and WML as far as I
am aware.
The usual work-around is to define a servlet inside your portlet application
WAR that serves the other file types. We do this regularly to serve RTF,
PDF, CSV and image formats.
The servlet and the portlet can both access the global session, so you can
pass the data to be rendered without problem. Also, the URL published by the
portlet can point to the servlet (opening in a new window if appropriate),
and you can use URL parameters to pass any info you like. Make sure you use
the response.encodeUrl() method, or a portlet tag to form the URL.
Best solution is to move to a JSR286 compliant portal server - then the
problem goes away.
So this is not a Tomcat issue - more useful help may be found on the
Jetspeed user list.
Regards
Ron
----- Original Message -----
From: "Ran Harpaz" <ip...@hotmail.com>
To: <us...@tomcat.apache.org>
Sent: Tuesday, January 26, 2010 7:04 AM
Subject: Re: CSV File "Save as" dialogue defaults to HTM file
----- Original Message -----
From: "Ran Harpaz" <ip...@hotmail.com>
To: <us...@tomcat.apache.org>
Sent: Tuesday, January 26, 2010 7:04 AM
Subject: Re: CSV File "Save as" dialogue defaults to HTM file
>
>
> Alessandro Bahgat wrote:
>>
>> On Mon, Jan 25, 2010 at 11:02 AM, Pid <pi...@pidster.com> wrote:
>>> On 25/01/2010 09:17, Ran Harpaz wrote:
>>>>
>>>> Hello, I'm using Jetspeed 1.6, running on Tomcat.
>>>>
>>>> In a portlet I developed, I create a .csv file and print a link to it.
>>>> The
>>>> user then needs to right-click on the file and select "save file as".
>>>>
>>>> The dialogue that pops up defaults to file type HTML file, and replaces
>>>> the
>>>> .csv extension of the file I link to with .htm.
>>>>
>>>> Is there anyway to resolve this? I really need to give access to the
>>>> csv
>>>> file as-is, and not bother my clients more than neccessary.
>>>
>>> Are you setting the "Content-type" header to "text/csv", or are you just
>>> generating it with a JSP?
>>>
>>> The latter will automatically set text/html as the content type.
>>
>> You may also want to change the content-disposition header in order to
>> make your server prompt the user with the "save as" dialog:
>>
>> For example,
>>
>> response.setHeader("Content-disposition",
>> "attachment; filename=" +
>> defaultCsvFilename );
>>
>> Regards,
>> Alessandro
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>
> Thank you, but this solution doesn't seem to work on Jetspeed, due to the
> fact that I'm running JSR-168 Portlets on it. I don't believe they support
> changing the response's ContentType.
>
> I wanted to know if there was anything about the Tomcat platform that
> could
> result in a CSV file defaulting to an HTM file, and if there was anything
> to
> do about it.
> --
> View this message in context:
> http://old.nabble.com/CSV-File-%22Save-as%22-dialogue-defaults-to-HTM-file-tp27303866p27308426.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: CSV File "Save as" dialogue defaults to HTM file
Posted by Ran Harpaz <ip...@hotmail.com>.
Alessandro Bahgat wrote:
>
> On Mon, Jan 25, 2010 at 11:02 AM, Pid <pi...@pidster.com> wrote:
>> On 25/01/2010 09:17, Ran Harpaz wrote:
>>>
>>> Hello, I'm using Jetspeed 1.6, running on Tomcat.
>>>
>>> In a portlet I developed, I create a .csv file and print a link to it.
>>> The
>>> user then needs to right-click on the file and select "save file as".
>>>
>>> The dialogue that pops up defaults to file type HTML file, and replaces
>>> the
>>> .csv extension of the file I link to with .htm.
>>>
>>> Is there anyway to resolve this? I really need to give access to the csv
>>> file as-is, and not bother my clients more than neccessary.
>>
>> Are you setting the "Content-type" header to "text/csv", or are you just
>> generating it with a JSP?
>>
>> The latter will automatically set text/html as the content type.
>
> You may also want to change the content-disposition header in order to
> make your server prompt the user with the "save as" dialog:
>
> For example,
>
> response.setHeader("Content-disposition",
> "attachment; filename=" +
> defaultCsvFilename );
>
> Regards,
> Alessandro
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
Thank you, but this solution doesn't seem to work on Jetspeed, due to the
fact that I'm running JSR-168 Portlets on it. I don't believe they support
changing the response's ContentType.
I wanted to know if there was anything about the Tomcat platform that could
result in a CSV file defaulting to an HTM file, and if there was anything to
do about it.
--
View this message in context: http://old.nabble.com/CSV-File-%22Save-as%22-dialogue-defaults-to-HTM-file-tp27303866p27308426.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: CSV File "Save as" dialogue defaults to HTM file
Posted by Alessandro Bahgat <al...@gmail.com>.
On Mon, Jan 25, 2010 at 11:02 AM, Pid <pi...@pidster.com> wrote:
> On 25/01/2010 09:17, Ran Harpaz wrote:
>>
>> Hello, I'm using Jetspeed 1.6, running on Tomcat.
>>
>> In a portlet I developed, I create a .csv file and print a link to it. The
>> user then needs to right-click on the file and select "save file as".
>>
>> The dialogue that pops up defaults to file type HTML file, and replaces
>> the
>> .csv extension of the file I link to with .htm.
>>
>> Is there anyway to resolve this? I really need to give access to the csv
>> file as-is, and not bother my clients more than neccessary.
>
> Are you setting the "Content-type" header to "text/csv", or are you just
> generating it with a JSP?
>
> The latter will automatically set text/html as the content type.
You may also want to change the content-disposition header in order to
make your server prompt the user with the "save as" dialog:
For example,
response.setHeader("Content-disposition",
"attachment; filename=" +
defaultCsvFilename );
Regards,
Alessandro
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: CSV File "Save as" dialogue defaults to HTM file
Posted by Jeffrey Janner <Je...@PolyDyne.com>.
Pid -
Would adding the following mime-mapping to the web.xml file help?
<mime-mapping>
<extension>.csv</extension>
<mime-type>text/csv</mime-type>
</mime-mapping>
There is no mapping for ".csv" in the Tomcat default web.xml file in the
conf directory.
I seem to remember addressing a similar problem many, many moons ago for
our app by adding those lines.
Jeff
-----Original Message-----
From: Pid [mailto:pid@pidster.com]
Sent: Monday, January 25, 2010 4:03 AM
To: users@tomcat.apache.org
Subject: Re: CSV File "Save as" dialogue defaults to HTM file
On 25/01/2010 09:17, Ran Harpaz wrote:
>
> Hello, I'm using Jetspeed 1.6, running on Tomcat.
>
> In a portlet I developed, I create a .csv file and print a link to it.
The
> user then needs to right-click on the file and select "save file as".
>
> The dialogue that pops up defaults to file type HTML file, and
replaces the
> .csv extension of the file I link to with .htm.
>
> Is there anyway to resolve this? I really need to give access to the
csv
> file as-is, and not bother my clients more than neccessary.
Are you setting the "Content-type" header to "text/csv", or are you just
generating it with a JSP?
The latter will automatically set text/html as the content type.
p
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
******************************* NOTICE *********************************
This message is intended for the use of the individual or entity to which
it is addressed and may contain information that is privileged,
confidential, and exempt from disclosure under applicable law. If the
reader of this message is not the intended recipient or the employee or
agent responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or copying
of this communication is strictly prohibited. If you have received this
communication in error, please notify us immediately by reply or by
telephone (call us collect at 512-343-9100) and immediately delete this
message and all its attachments.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: CSV File "Save as" dialogue defaults to HTM file
Posted by Pid <pi...@pidster.com>.
On 25/01/2010 09:17, Ran Harpaz wrote:
>
> Hello, I'm using Jetspeed 1.6, running on Tomcat.
>
> In a portlet I developed, I create a .csv file and print a link to it. The
> user then needs to right-click on the file and select "save file as".
>
> The dialogue that pops up defaults to file type HTML file, and replaces the
> .csv extension of the file I link to with .htm.
>
> Is there anyway to resolve this? I really need to give access to the csv
> file as-is, and not bother my clients more than neccessary.
Are you setting the "Content-type" header to "text/csv", or are you just
generating it with a JSP?
The latter will automatically set text/html as the content type.
p
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org