tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ron McNulty" <rmcnu...@xtra.co.nz>
Subject Re: CSV File "Save as" dialogue defaults to HTM file
Date Mon, 08 Feb 2010 00:25:48 GMT
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" <ipaqi1@hotmail.com>
To: <users@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" <ipaqi1@hotmail.com>
To: <users@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 <pid@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


Mime
View raw message