You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Thomas <ma...@apache.org> on 2005/12/01 00:09:01 UTC

Re: File Download not working for anchor tags

I assume you are using a servlet since JSPs always return a 
Content-Type. Try setting Content-Type in your servlet so the headers 
are identical.

Mark

Mike wrote:
> 
>    Hi Mark,
> 
>   I compared them and the Content-Type is not showing in 4.1.31.  In 
> 4.1.18 it shows as "text/plain".
> 
>   Thanks,
> 
>   Mike Gilby
> 
> At 02:47 PM 11/30/2005, you wrote:
> 
>> Assuming the content is the same, this has to be a headers issue. Try 
>> installing ieHTTPHeaders (or the erquivalent for your browser) and 
>> compare the differences between 4.1.18 and 4.1.31.
>>
>> Mark
>>
>> Mike wrote:
>>
>>> Hello,
>>>   I'm reposting this error for hopefully more help.  I wrote before 
>>> that I encountered a bug with the 4.1.31 version of Tomcat. When I 
>>> use an anchor tag for a file, and I click on the link, it does not 
>>> show the
>>> file download message "Do you want to open or save this file?" with 
>>> the open
>>> and save options. Instead, it displays the file in the browser.   It 
>>> use to work in Tomcat 4.1.18.  I've tried setting the "Confirm open 
>>> after download" check box for file types, writing the 
>>> response.contentType and response.header in the downloaded file, and 
>>> I tried valves in the server.xml file for different authenticators to 
>>> no avail.   I even copied the 4.1.18 Tomcat server.xml file I use to 
>>> have into the Tomcat 4.1.31 version, and it still doesn't work.
>>> Any help would be appreciated.
>>> Thanks,
>>>   Mike
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> 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: File Download not working for anchor tags

Posted by Mike <To...@canam.com>.
    The anchor file links to an actual real file on the filesystem, so the 
first case.  I'm using Tomcat stand alone.

   Mike


At 04:56 PM 11/30/2005, you wrote:
>Display and generation are two separate issues and I'm confused about which
>is which for the OP.
>
>does the anchor tag link to an actual real file on the filesystem somewhere,
>like:
><a href="/some/file/somewhere.xls">click to download</a>
>
>or are you linking to a dynamically generated file, as from a servlet:
><a href="/excel_spitting_servlet/?fileID=somewhere.xls">click to
>download</a>
>
>
>in the first case, you're using JSP to display the link and it's more likely
>a web-server MIME type that is missing. Are you using TC stand-alone or
>fronted with Apache?
>
>in the second case, you need to worry about setting headers in your
>servlet/JSP (the generating servlet/jsp, _not_ the display one) both for
>content type and that disposition setting which is the FAQ that Tim linked
>to, because now you're generating the contents of the linked "file" in a JSP
>or servlet (so actually, not a file, but rather a streamed response).
>
>
>
> > -----Original Message-----
> > From: Mike [mailto:Tomcat@canam.com]
> > Sent: Wednesday, November 30, 2005 5:36 PM
> > To: Tomcat Users List
> > Subject: Re: File Download not working for anchor tags
> >
> >
> >
> >     I'm using a JSP page for displaying the anchor actually.
> > The anchor is
> > linked to a file, either a .xls or .csv file.
> >
> >    Mike
> >
> > At 04:09 PM 11/30/2005, you wrote:
> > >I assume you are using a servlet since JSPs always return a
> > >Content-Type.
> > >Try setting Content-Type in your servlet so the headers are
> > identical.
> > >
> > >Mark
> > >
> > >Mike wrote:
> > >>    Hi Mark,
> > >>   I compared them and the Content-Type is not showing in
> > 4.1.31.  In
> > >> 4.1.18 it shows as "text/plain".
> > >>   Thanks,
> > >>   Mike Gilby
> > >>At 02:47 PM 11/30/2005, you wrote:
> > >>
>
>
>---------------------------------------------------------------------
>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: File Download not working for anchor tags

Posted by Mike <To...@canam.com>.
    Hi Mark,

    I found a workaround that's pretty user friendly.  I used a servlet 
instead of an anchor in a .jsp file to send the file.  I set the content 
type to "text/plain" and the data transferred is good.  Thanks for your help.

   Mike


At 04:50 PM 11/30/2005, you wrote:
>Mike wrote:
>>    I'm using a JSP page for displaying the anchor actually.  The anchor 
>> is linked to a file, either a .xls or .csv file.
>>   Mike
>
>In which case, the default servlet will be responsible for serving the 
>content. I'll go and take a look at the changes between 4.1.18 and 4.1.31.
>
>Mark
>
>
>
>---------------------------------------------------------------------
>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: File Download not working for anchor tags

Posted by Mark Thomas <ma...@apache.org>.
Mike wrote:
> 
>    I'm using a JSP page for displaying the anchor actually.  The anchor 
> is linked to a file, either a .xls or .csv file.
> 
>   Mike

In which case, the default servlet will be responsible for serving the 
content. I'll go and take a look at the changes between 4.1.18 and 4.1.31.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: File Download not working for anchor tags

Posted by GB Developer <gb...@globallyboundless.com>.
Display and generation are two separate issues and I'm confused about which
is which for the OP.

does the anchor tag link to an actual real file on the filesystem somewhere,
like: 
<a href="/some/file/somewhere.xls">click to download</a>

or are you linking to a dynamically generated file, as from a servlet:
<a href="/excel_spitting_servlet/?fileID=somewhere.xls">click to
download</a>


in the first case, you're using JSP to display the link and it's more likely
a web-server MIME type that is missing. Are you using TC stand-alone or
fronted with Apache? 

in the second case, you need to worry about setting headers in your
servlet/JSP (the generating servlet/jsp, _not_ the display one) both for
content type and that disposition setting which is the FAQ that Tim linked
to, because now you're generating the contents of the linked "file" in a JSP
or servlet (so actually, not a file, but rather a streamed response).



> -----Original Message-----
> From: Mike [mailto:Tomcat@canam.com] 
> Sent: Wednesday, November 30, 2005 5:36 PM
> To: Tomcat Users List
> Subject: Re: File Download not working for anchor tags
> 
> 
> 
>     I'm using a JSP page for displaying the anchor actually.  
> The anchor is 
> linked to a file, either a .xls or .csv file.
> 
>    Mike
> 
> At 04:09 PM 11/30/2005, you wrote:
> >I assume you are using a servlet since JSPs always return a 
> >Content-Type.
> >Try setting Content-Type in your servlet so the headers are 
> identical.
> >
> >Mark
> >
> >Mike wrote:
> >>    Hi Mark,
> >>   I compared them and the Content-Type is not showing in 
> 4.1.31.  In
> >> 4.1.18 it shows as "text/plain".
> >>   Thanks,
> >>   Mike Gilby
> >>At 02:47 PM 11/30/2005, you wrote:
> >>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: File Download not working for anchor tags

Posted by Mike <To...@canam.com>.
    I'm using a JSP page for displaying the anchor actually.  The anchor is 
linked to a file, either a .xls or .csv file.

   Mike

At 04:09 PM 11/30/2005, you wrote:
>I assume you are using a servlet since JSPs always return a Content-Type. 
>Try setting Content-Type in your servlet so the headers are identical.
>
>Mark
>
>Mike wrote:
>>    Hi Mark,
>>   I compared them and the Content-Type is not showing in 4.1.31.  In 
>> 4.1.18 it shows as "text/plain".
>>   Thanks,
>>   Mike Gilby
>>At 02:47 PM 11/30/2005, you wrote:
>>
>>>Assuming the content is the same, this has to be a headers issue. Try 
>>>installing ieHTTPHeaders (or the erquivalent for your browser) and 
>>>compare the differences between 4.1.18 and 4.1.31.
>>>
>>>Mark
>>>
>>>Mike wrote:
>>>
>>>>Hello,
>>>>   I'm reposting this error for hopefully more help.  I wrote before 
>>>> that I encountered a bug with the 4.1.31 version of Tomcat. When I use 
>>>> an anchor tag for a file, and I click on the link, it does not show the
>>>>file download message "Do you want to open or save this file?" with the 
>>>>open
>>>>and save options. Instead, it displays the file in the browser.   It 
>>>>use to work in Tomcat 4.1.18.  I've tried setting the "Confirm open 
>>>>after download" check box for file types, writing the 
>>>>response.contentType and response.header in the downloaded file, and I 
>>>>tried valves in the server.xml file for different authenticators to no 
>>>>avail.   I even copied the 4.1.18 Tomcat server.xml file I use to have 
>>>>into the Tomcat 4.1.31 version, and it still doesn't work.
>>>>Any help would be appreciated.
>>>>Thanks,
>>>>   Mike
>>>>
>>>>---------------------------------------------------------------------
>>>>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
>>>
>>
>>---------------------------------------------------------------------
>>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
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org