【发布时间】:2019-04-16 01:39:23
【问题描述】:
在我的 Mojolicious 应用程序中,我嵌入了一个从 gnuplot 生成的 SVG 文件。问题是 gnuplot 忽略了 grid.png 的 jsdir 并将其保留为相对路径。
<image x='10' y='274' width='16' height='16' xlink:href='grid.png'
onclick='gnuplot_svg.toggleGrid();'/>
这会导致 Mojolicious 提供图片的 URL。在我的例子中,我想从 public/ 目录访问这个文件,但是我的控制器想要找到与它的路径相关的它。
[2019-04-08 10:19:21.46569] [28105] [debug] GET "/reports/grid.png" (e9f0c2a8)
[2019-04-08 10:19:21.46596] [28105] [debug] Routing to controller "WebLOC::Controller::Auth" and action "check"
[2019-04-08 10:19:21.46632] [28105] [debug] Routing to controller "WebLOC::Controller::Reports" and action "grid"
[2019-04-08 10:19:21.46637] [28105] [debug] Action not found in controller
[2019-04-08 10:19:21.46658] [28105] [debug] Template "reports/grid.png.ep" not found
[2019-04-08 10:19:21.46679] [28105] [debug] Template "not_found.development.png.ep" not found
[2019-04-08 10:19:21.46696] [28105] [debug] Template "not_found.png.ep" not found
[2019-04-08 10:19:21.46713] [28105] [debug] Template "not_found.development.html.ep" not found
[2019-04-08 10:19:21.46729] [28105] [debug] Template "not_found.html.ep" not found
[2019-04-08 10:19:21.46739] [28105] [debug] Rendering cached template "mojo/debug.html.ep"
[2019-04-08 10:19:21.46851] [28105] [debug] Rendering cached template "mojo/menubar.html.ep"
[2019-04-08 10:19:21.47419] [28105] [debug] 404 Not Found (0.008486s, 117.841/s)
我怎样才能拥有 Mojolicious GET “/grid.png”,而不是“/reports/grid.png”?
【问题讨论】:
-
有趣。我认为这是一个简单的答案,我只是在大量的 Mojolicious 文档中找不到。那好吧。我通过回到 gnuplot 中的画布(HTML5)终端来“解决”这个问题。在这一点上,这对我来说似乎是一个更好的解决方案。
标签: gnuplot mojolicious