Re: Favicon for resources when using multiple webapps

2016-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Rebecca,

On 11/3/16 4:16 PM, Maxfield, Rebecca A wrote:
> Hi there,
> 
> I have a Tomcat installation running a few different web apps 
> (different instances of XTF, if it matters), and each of these has 
> some resources (PDFs, raw XML, etc.) that can be viewed by the
> user in the browser. How can I make sure that the user sees the
> resource with the favicon of the correct site, since there’s
> nowhere for me to put a  tag like there is on the actual
> pages of the site?

You can't. Not really. But you might be able to fake it.

> Looking into support forums beforehand, I found solutions for
> giving a resource a favicon by putting the icon in the web apps
> root folder so that it’s over the whole site (not good with more
> than one webapp/site), and for making sites have different icons by
> using the  tags, but nothing that solves both of these
> problems.

This is why you can't do what you are asking to be able to do: the
favicon "spec" is the the icon is in the root of the domain, unless
overridden by a  element in the HTML document.

> I also tried a solution with htaccess but it didn’t work – not
> sure if I wrote it badly or if that’s not the right way to go.

I have no idea how you might do this with .htaccess.

> This is on Linux; I think the version of Tomcat I’m sandboxing
> this in is version 8, though the production server version is 7.

Have a look at this SO answer:
http://stackoverflow.com/questions/11227661/adding-favicon-through-a-htt
p-header

Here's a way you might be able to fake it:

1. Write a Filter (or you could do this with mod_rewrite I suppose)
2. Hook on the request for /favicon.ico
3. Examine the request headers for the REFERER (yes, it's misspelled)
4. Return the bits you want depending upon the value of that header

This might not work for e.g. PDF files, but it would work for HTML
files that don't specify their own  elements. YMMV.

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYHQxbAAoJEBzwKT+lPKRYUD0P/0Pz1xmhSVV/nNUPGBF3qxmj
wWQPsbI+sK5I8X6+Yg19Cr/hjLmflsiENRq7PN7lPZ6S8lxbuCxRWwSlokWDRV8s
7dCaqbs9iPcEhd9Ey0rUwDAhR27H4x75MIA7e4dU0sVIGCsSiMYhw5OD6Td55IcZ
PDfjL5drCI0193wkC+ac5sH56y1iU9KOfaxrzh5woXsQd25rZbPBA8nP5uWmS+Cy
L0dEJ9UnLS3uBd4P4naKIy8Mrxd4OyWr67m03po5AaQwI3NkVLqkdG5fSfg6UN+w
b58aN97cNPsToidIA8sYDOPUKFW1eRroBGLzaBL1JfKAIq/J61WRQ/NpuhugT0IM
eqQ4KAEC1h4zzeAdF+Ak4G9N+AxOg95j7wvLN+c0klnYM5Uzw6ilW07E5tqLqWjM
eOaP8AL2IMfeqg+ANlTIdzFsx3hKXtZchDQ2QGp0epqvW31XefHoLuaK8RH7JtQo
2DekKfJp8ssLun1IshkKYu+SsHH/QTTzhO16ygQc2/vtqJpe4WZ2iuDsfQwbpPEr
NmVmF5WVJIG0ewcTSTz+8sl1NtpcqyMtRYMbikRXGZPXppahYtKyqVViM/SMDqMJ
RB8meG+sFNb3M8NrLiwtbtCFax7rgjM2zbPneCNr8xEPBCF0Rx8XwhuSSiHOEcHY
HfEiCDCsGD+fSvYZrHA7
=rRty
-END PGP SIGNATURE-

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



Favicon for resources when using multiple webapps

2016-11-03 Thread Maxfield, Rebecca A
Hi there,

I have a Tomcat installation running a few different web apps (different 
instances of XTF, if it matters), and each of these has some resources (PDFs, 
raw XML, etc.) that can be viewed by the user in the browser. How can I make 
sure that the user sees the resource with the favicon of the correct site, 
since there’s nowhere for me to put a  tag like there is on the actual 
pages of the site? Looking into support forums beforehand, I found solutions 
for giving a resource a favicon by putting the icon in the web apps root folder 
so that it’s over the whole site (not good with more than one webapp/site), and 
for making sites have different icons by using the  tags, but nothing 
that solves both of these problems. I also tried a solution with htaccess but 
it didn’t work – not sure if I wrote it badly or if that’s not the right way to 
go.

This is on Linux; I think the version of Tomcat I’m sandboxing this in is 
version 8, though the production server version is 7.

Thanks!