You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dola Woolfe <do...@yahoo.com> on 2010/07/06 16:10:43 UTC

favicon when serving non-html

Hi,

When I serve up, say, a PDF file, how do I control the favicon?

Here's my code:


   response.reset();
    response.setContentType(IOUtilities.gMIMEType(fn));
    response.setHeader("Content-disposition", "inline; filename=" + file.getName());
    OutputStream outStream = response.getOutputStream();
    synchronized(response.getOutputStream()){
      outStream.write(IOUtilities.gFile2Bytes(file.getAbsolutePath()));
    }
    response.flushBuffer();

Thanks in advance



      

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


Re: favicon when serving non-html

Posted by Nikola Milutinovic <al...@yahoo.com>.
Why would you?

FavIcon is meant as attributes of pages, more specifically pages of whole sites. 
You can potentially have different FavIcons for different parts of your web 
site, but that is not common. Resources, which PDF is, have no reason for 
"having a favourite icon". It would be the same as asking "can my GIFs have 
favicon". No, they cannot. Nor should they.

Nix.




________________________________
From: Dola Woolfe <do...@yahoo.com>
To: Tom Cat <to...@jakarta.apache.org>
Sent: Tue, July 6, 2010 4:10:43 PM
Subject: favicon when serving non-html

Hi,

When I serve up, say, a PDF file, how do I control the favicon?

Here's my code:


   response.reset();
    response.setContentType(IOUtilities.gMIMEType(fn));
    response.setHeader("Content-disposition", "inline; filename=" + 
file.getName());
    OutputStream outStream = response.getOutputStream();
    synchronized(response.getOutputStream()){
      outStream.write(IOUtilities.gFile2Bytes(file.getAbsolutePath()));
    }
    response.flushBuffer();

Thanks in advance



      

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


      

RE: favicon when serving non-html

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dola Woolfe [mailto:dolachin@yahoo.com]
> Subject: Re: favicon when serving non-html
> 
> When I serve up a pdf file with the code below, it shows it in an
> embedded acrobat, as desired. However, the icon in the browser (in the
> tab) is the Tomcat logo.

Again, take a look at the HTTP requests you're getting.  There will be a separate GET favicon.ico request which is normally handled by Tomcat's DefaultServlet, delivering the webapps/ROOT/favicon.ico file.  You can either intercept that request with your own servlet or filter, or just change the favicon.ico file in the above location to be whatever you want.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: favicon when serving non-html

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dola,

On 7/6/2010 2:34 PM, Dola Woolfe wrote:
> Thanks for the responses.
> 
> When I serve up a pdf file with the code below, it shows it in an embedded acrobat, as desired. However, the icon in the browser (in the tab) is the Tomcat logo.
> 
> I'd like to change it to something else.

You will only be able to change the favicon for the entire site. You can
specify a favicon on a page-by-page basis, but only if it is an HTML or
XHTML file.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkw01+MACgkQ9CaO5/Lv0PAqRQCfY1u9t6WdBOQDCPfPwaItqq4v
9KUAoLo7tKvToFSyy5UsxJMyPHLLM4/i
=oysl
-----END PGP SIGNATURE-----

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


Re: favicon when serving non-html

Posted by Len Popp <le...@gmail.com>.
The usual way to specify the favicon is by putting it at the root of
the web site, e.g. http://www.example.com/favicon.ico. On the server,
this file is usually found in [Tomcat dir]/webapps/ROOT/favicon.ico -
change that file to whatever icon you want.

There are some other ways to specify the favicon, but I don't know if
they're supported by all browsers.

References:
http://www.w3.org/2005/10/howto-favicon
http://en.wikipedia.org/wiki/Favicon
-- 
Len

On Tue, Jul 6, 2010 at 14:34, Dola Woolfe <do...@yahoo.com> wrote:
> Thanks for the responses.
>
> When I serve up a pdf file with the code below, it shows it in an embedded acrobat, as desired. However, the icon in the browser (in the tab) is the Tomcat logo.
>
> I'd like to change it to something else.
>
> ----- Original Message ----
> From: Pid <pi...@pidster.com>
> To: Tomcat Users List <us...@tomcat.apache.org>
> Sent: Tue, July 6, 2010 1:10:08 PM
> Subject: Re: favicon when serving non-html
>
> On 06/07/2010 15:10, Dola Woolfe wrote:
>> Hi,
>>
>> When I serve up, say, a PDF file, how do I control the favicon?
>>
>> Here's my code:
>>
>>
>>    response.reset();
>>     response.setContentType(IOUtilities.gMIMEType(fn));
>>     response.setHeader("Content-disposition", "inline; filename=" + file.getName());
>>     OutputStream outStream = response.getOutputStream();
>>     synchronized(response.getOutputStream()){
>>       outStream.write(IOUtilities.gFile2Bytes(file.getAbsolutePath()));
>>     }
>>     response.flushBuffer();
>>
>> Thanks in advance
>
> If you mean "How do I specify which icon will be associated with a file
> that I make available for download?"
>
> You can't - the OS will always be able to override it.
>
> The best you can do is present a recognisable MIME type in the
> "setContentType" method call.  You're using another class there, so I
> can't see what you're actually setting.  Do you know what is sent?
>
>
> p
>
>
> P.S. please note the following:
>
> - It's "Tomcat", not "Tom Cat".
>
> - The mailing list is now "users@tomcat.apache.org" not
> "tomcat-user@jakarta.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: favicon when serving non-html

Posted by Dola Woolfe <do...@yahoo.com>.
Thanks for the responses.

When I serve up a pdf file with the code below, it shows it in an embedded acrobat, as desired. However, the icon in the browser (in the tab) is the Tomcat logo.

I'd like to change it to something else.

----- Original Message ----
From: Pid <pi...@pidster.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Tue, July 6, 2010 1:10:08 PM
Subject: Re: favicon when serving non-html

On 06/07/2010 15:10, Dola Woolfe wrote:
> Hi,
> 
> When I serve up, say, a PDF file, how do I control the favicon?
> 
> Here's my code:
> 
> 
>    response.reset();
>     response.setContentType(IOUtilities.gMIMEType(fn));
>     response.setHeader("Content-disposition", "inline; filename=" + file.getName());
>     OutputStream outStream = response.getOutputStream();
>     synchronized(response.getOutputStream()){
>       outStream.write(IOUtilities.gFile2Bytes(file.getAbsolutePath()));
>     }
>     response.flushBuffer();
> 
> Thanks in advance

If you mean "How do I specify which icon will be associated with a file
that I make available for download?"

You can't - the OS will always be able to override it.

The best you can do is present a recognisable MIME type in the
"setContentType" method call.  You're using another class there, so I
can't see what you're actually setting.  Do you know what is sent?


p


P.S. please note the following:

- It's "Tomcat", not "Tom Cat".

- The mailing list is now "users@tomcat.apache.org" not
"tomcat-user@jakarta.apache.org".


      

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


Re: favicon when serving non-html

Posted by Pid <pi...@pidster.com>.
On 06/07/2010 15:10, Dola Woolfe wrote:
> Hi,
> 
> When I serve up, say, a PDF file, how do I control the favicon?
> 
> Here's my code:
> 
> 
>    response.reset();
>     response.setContentType(IOUtilities.gMIMEType(fn));
>     response.setHeader("Content-disposition", "inline; filename=" + file.getName());
>     OutputStream outStream = response.getOutputStream();
>     synchronized(response.getOutputStream()){
>       outStream.write(IOUtilities.gFile2Bytes(file.getAbsolutePath()));
>     }
>     response.flushBuffer();
> 
> Thanks in advance

If you mean "How do I specify which icon will be associated with a file
that I make available for download?"

You can't - the OS will always be able to override it.

The best you can do is present a recognisable MIME type in the
"setContentType" method call.  You're using another class there, so I
can't see what you're actually setting.  Do you know what is sent?


p


P.S. please note the following:

- It's "Tomcat", not "Tom Cat".

- The mailing list is now "users@tomcat.apache.org" not
"tomcat-user@jakarta.apache.org".





RE: favicon when serving non-html

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dola Woolfe [mailto:dolachin@yahoo.com]
> Subject: favicon when serving non-html
> 
> When I serve up, say, a PDF file, how do I control the favicon?

Any request for a favicon is separate from the main page; you shouldn't have to do anything.  Use an HTTP monitor (eg, Firebug) to see how that works.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: favicon when serving non-html

Posted by Peter Crowther <pe...@melandra.com>.
On 6 July 2010 15:10, Dola Woolfe <do...@yahoo.com> wrote:

> When I serve up, say, a PDF file, how do I control the favicon?
>
> What is the behaviour you would like/expect from the user agent in this
case?

- Peter