阻止用户访问资源文件夹中的文件.托管在Apache Tomcat上
Prevent User to access the file in the resource folder .. hosted on Apache Tomcat
你好,我的网站地址是
www.abcdef.com/context/index.html
但是用户也可以访问
www.abcdef/context/resources/somPngFile.png
我不想要
(这里的资源是我保存图像文件的文件夹)
此外,我在index.html中做所有的验证和会话检查。如果用户直接从url访问png文件,他就可以得到它。任何关于如何避免这种情况的建议都将不胜感激。我使用apachetomcat作为服务器,并在jquery中进行编码。
我把下面的代码放在web.xml中解决了这个问题。不过谢谢你的评论。。
<security-constraint>
<web-resource-collection>
<web-resource-name>HTTP-Protected-Resource-1</web-resource-name>
<description>Description here</description>
<url-pattern>/resources/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>NOSOUPFORYOU</role-name>
</auth-constraint>
</security-constraint>
相关文章:
- 在node.js中设置Apache环境变量
- Tomcat websocket is not working
- 一种将Apache Thrift JS绑定与Backbone.JS一起使用的方法
- 警报,提示..在本地服务器(Tomcat)上不工作
- 在Tomcat中运行Javascript代码时出错
- 在此服务器上找不到请求的-表单验证(位于localhost端口80的Apache/2.4.9(Win32)PHP/5.5
- 如何在方向更改时重新调整/排列布局(Apache Cordova)
- 翻译是从哪里来的?Java servlet、tomcat和Ext Js Sencha应用程序
- 如何将 “onchange” SimpleAttributeModifier 添加到 Apache Wicket 中的
- 在引导程序中从 HTML 表单执行 Python (CGI) 文件.带有Apache Server的JS
- apache tomcat没有显示图像和js
- Sublime Text - 在不刷新 Eclipse 项目的情况下在 apache tomcat 上运行项目
- 其他人如何使用Apache Tomcat 7访问我的本地javascript应用程序(通过我的IP地址)
- PHP on apache server http calling javascript api on tomcat s
- 如何在Apache tomcat服务器启动时定期运行javascript函数,而不是使用ScheduledExecuto
- 阻止用户访问资源文件夹中的文件.托管在Apache Tomcat上
- Apache Tomcat和Spring MVC在视图上使用javascript库
- Apache Tomcat -用于部署的语言和工具
- Python抓取网站得到Apache Tomcat/6.0.36 -错误报告
- 无法在 apache tomcat 6 上运行三个.js示例