gpt4 book ai didi

grails - 在Grails 3中将静态文件呈现为URI

转载 作者:行者123 更新时间:2023-12-02 14:00:52 24 4
gpt4 key购买 nike

在Grails 2.x中,以下工作:

class UrlMappings {

static mappings = {
/**
* Serving the index.html directly
*/
"/"(uri: "/ng/app/index.html")
}
}

假定 index.html目录中有一个 web-app/ng/app/文件。现在,当我们在Grails 2中浏览URL http://localhost:8080时, index.html将自动呈现。

在Grails 3中,我在 index.html中添加了相同的 src/main/webapp/文件,可以像 http://localhost:8080/static/index.html一样正常浏览。

所以,我试图在 UrlMappings.groovy中做同样的事情:
class UrlMappings {

static mappings = {
/**
* Serving the index.html directly
*/
"/"(uri: "/static/index.html")
}
}

但这给我错误 {"message":"Internal server error","error":500}:
ERROR org.grails.web.errors.GrailsExceptionResolver - UrlMappingException occurred when processing request: [GET] /
Unable to establish controller name to dispatch for [null]. Dynamic closure invocation returned null. Check your mapping file is correct, when assigning the controller name as a request parameter it cannot be an optional token!. Stacktrace follows:
grails.web.mapping.exceptions.UrlMappingException: Unable to establish controller name to dispatch for [null]. Dynamic closure invocation returned null. Check your mapping file is correct, when assigning the controller name as a request parameter it cannot be an optional token!
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

我已经使用Grails 3.1.8 Angular配置文件创建了我的应用,后来删除了与Angular相关的东西,例如Grails GSP插件,Asset Pipeline等。

最佳答案

这似乎是Grails 3的未解决问题,预计将在Grails 3.2.0中解决。

https://github.com/grails/grails-core/issues/9908

关于grails - 在Grails 3中将静态文件呈现为URI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38139553/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com