我在adobe博客中读到,从休息网址mypath.com/rest/somapp/app我可以从server.xml自定义“rest”文本。我从cfusion \ runtime \ conf文件夹中打开了server.xml,但是没有我可以更改它的地方。我可以改变它的方式和地点?
答案 0 :(得分:1)
它不在server.xml
文件中,而是在web.xml
文件中。特别是{cfroot}/cfusion/wwwroot/WEB-INF/web.xml
,您需要在进行更改后重新启动ColdFusion服务。
来自此处的博客文章 - Changing the default URL pattern for REST Services in ColdFusion 10:
ColdFusion处理启用REST的服务的方式是通过web.xml中预定义的Servlet Mapping,如下所示: -
<servlet-mapping id="coldfusion_mapping_15"> <servlet-name>CFRestServlet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping>`
此Servlet Mapping具有一个URL模式,告诉CF任何以“/ rest”开头的URL都将被视为REST服务。但是,如果您觉得需要将其更改为更合适的内容,只需更改{cfroot} /cfusion/wwwroot/WEB-INF/web.xml中的url-pattern并重新启动ColdFusion Server。