且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java Spring Boot Restcontroller RequestMapping执行了两次

更新时间:2022-04-25 00:24:54

问题取决于用于测试RestController的浏览器。
我使用的是Firefox ...并且Firefox倾向于在图像周围获得一些html。但该方法不会返回html,因此Firefox正在启动另一个请求...也用于寻找一个图标。

The problem depends on the Browser which is used to test the RestController. I'am using Firefox... and Firefox tend to get some html around an image. But the method doesn't return html and so Firefox is starting another request... also for looking for a favicon.

Internet Explorer例如并不关心它,并且该方法只按预期执行一次!

Internet Explorer e.g. doesn't care about it and the method is only executed once as expected!

所以我的问题不是真正的问题,因为稍后我的RestController提供的图像将被嵌入到一个有html和favicon的网站中。

So my problem is not a real problem because later my image delivered by the RestController will be embedded in a website which has html and a favicon.