Tomcat 中的 jdbcrealm 不显示地址栏中的图标
我正在尝试做一个在地址栏中带有图标的网站。它适用于常规网站。但我试图在 tomcat 中使用领域(以保护我的资源),该图标处于公共角色,没有任何限制。 但它不会加载地址栏中的图标(即使在我登录后)。
当我在图标的地址行写下完整路径时,我会在浏览器上看到图像。所以我认为我有权加载它。
图标的路径是正确的,因为我在同一文件夹中有另一个图像并且它可以工作。
那么为什么它不起作用?
现在是我的代码。
定义图标的jsp代码:这个标签写在head标签中
<link rel="shortcut icon" href="img/icon0.png">
,web.xml中的公共权限是:
<security-constraint>
<web-resource-collection>
<web-resource-name>public zone</web-resource-name>
<url-pattern>/img/*</url-pattern>
</web-resource-collection>
并且 admin 角色拥有所有文件的权限:
<security-constraint>
<web-resource-collection>
<web-resource-name>adminzone</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>student</role-name>
</auth-constraint>
谢谢
i am trying to do a website with icon in address bar. it works in regular website. But i'm trying to use realm in tomcat (to protected my resources), the icon is in public role without any limitations.
But it doesn't load the icon in address bar (even after i logged in).
When i write a full path at the address line of my icon, i get the image on the browser. So i think that i have permission to load it.
The path of icon is true, because i have another image in the same folder and it works.
So why it doesn't work?
And now my code.
the jsp code which defines the icon: this tag is written in head tag
<link rel="shortcut icon" href="img/icon0.png">
and the public permissions in web.xml are:
<security-constraint>
<web-resource-collection>
<web-resource-name>public zone</web-resource-name>
<url-pattern>/img/*</url-pattern>
</web-resource-collection>
and the admin role has permision for all files:
<security-constraint>
<web-resource-collection>
<web-resource-name>adminzone</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>student</role-name>
</auth-constraint>
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的配置没问题。
您没有提到您使用的是哪种浏览器,但如果是 Firefox,则可能是缓存问题。有很多关于清除 Firefox 图标缓存的文章。这是一个:从 Firefox 清除 Favicon 缓存。 (我还没有测试过。)也许重新启动浏览器也会有帮助。
Your config is fine.
You haven't mentioned which browser you are using but if it's Firefox it's probably a caching issue. There are a lot of articles about clearing the favicon cache of Firefox. Here is one: Clear Favicon Cache From Firefox. (I haven't tested.) Maybe restarting the browser also could help.