可从Deployed应用程序访问Grails WEB

编程入门 行业动态 更新时间:2024-10-21 06:30:33
可从Deployed应用程序访问Grails WEB-INF(Grails WEB-INF accessible from Deployed app)

在grails应用程序中,可以访问WEB-INF内容,包括所有.gsp内容以及部署时的.class文件。

我正在使用grails 2.3.5并在tomcat 7中部署战争。

您可以使用访问文件

http://mydomain.com/static/WEB-INF/web.xml http://mydomain.com/static/WEB-INF/grails-app/views/anyview.gsp http://mydomain.com/static/WEB-INF/grails-app/i18n/messages.properties http://mydomain.com/static/WEB-INF/classes/anyclass.class

我可以禁止访问grails中的这些URL吗?

In grails application, one can access the WEB-INF contents including all the .gsp content as well as .class file when deployed.

I am using grails 2.3.5 and deploying the war in the tomcat 7.

You can access the files using

http://mydomain.com/static/WEB-INF/web.xml http://mydomain.com/static/WEB-INF/grails-app/views/anyview.gsp http://mydomain.com/static/WEB-INF/grails-app/i18n/messages.properties http://mydomain.com/static/WEB-INF/classes/anyclass.class

Can I disable access to these url in grails?

最满意答案

默认情况下,在grails中有资源插件。 它会映射所有资源,如css,js,图像,WEB-INF,插件和META-INF,您将在提取war文件时找到它们。

您需要在config.groovy中包含以下行,以便在静态资源中包含css,js和images。

grails.resources.adhoc.includes = ['/images/**','/js/**','/css/**']

您还可以使用:

grails.resources.adhoc.excludes = ['/WEB-INF/**']

仅排除WEB-INF。

我不知道是否应该说更多信息或仅仅是为了获取信息。 无论如何,你也可以在配置部分的资源插件文档中找到一些有关标题的信息

控制adhoc过滤器的包含和排除:grails.resources.adhoc.includes / exclude

In grails by default, there is resources plugin. And it maps all the resources such as css, js, images, WEB-INF, plugins and META-INF which you will find when you extract war file.

You need to include following line in your config.groovy to include just css, js and images in static resources.

grails.resources.adhoc.includes = ['/images/**','/js/**','/css/**']

You can also use :

grails.resources.adhoc.excludes = ['/WEB-INF/**']

to exclude only WEB-INF.

I don't know whether I should say for more information or just for information. Anyway you can also find some information of this in documentation of resources plugin in configuration part which has title

Controlling the includes and excludes of the adhoc filter: grails.resources.adhoc.includes/excludes

更多推荐

本文发布于:2023-08-06 23:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1456751.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   Deployed   WEB   Grails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!