小编use*_*663的帖子

有没有办法禁用 Thymeleaf,或仅启用某些 REST 调用?

例如,我有一个基本的 POST,它使用 Thymeleaf 返回一个名为“result”的 html。这很有效而且很酷。

@PostMapping("/greeting")
public String greetingSubmit(@ModelAttribute Greeting greeting) {
    return "result";
}
Run Code Online (Sandbox Code Playgroud)

但我有另一个完全不相关的方法,它执行不同的操作,并且不返回模板。

@PostMapping(value = "/otherstuff", headers = "content-type=multipart/*")
public Object otherStuff(@RequestParam("file") MultipartFile dataFile) {
    // Totally unrelated stuff
    return resultList;
}
Run Code Online (Sandbox Code Playgroud)

当然,我得到一个例外:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/otherstuff", template might not exist or might not be accessible by any of the configured Template Resolvers 
Run Code Online (Sandbox Code Playgroud)

因为我故意不解析模板。我可以关闭此方法的 ThymeLeaf 吗?我的 Rest API 是多用途的,如果 ThymeLeaf 最终破坏了整个项目,那将毫无帮助。

谢谢。

java rest spring spring-mvc thymeleaf

9
推荐指数
1
解决办法
2097
查看次数

d3.js:从文件中绘制地图上两点之间的弧线

我是d3.js的新手,我正在尝试一些简单的事情.我绘制了一个读取file1和file2的世界地图.file2按indexID,lat和lon列出机场.file1按其indexID对机场进行配对.我想绘制一个弧形,直线或任何东西来连接它们.我的想法是生成这样的东西:http://mbostock.github.io/d3/talk/20111116/airports.html,其中包含不同的数据集,但这个例子太难以理解了.

下面的代码正确地绘制了地图并绘制了机场的圆圈,但仍有待观察如何连接它们.

<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script type="text/javascript" src="d3/d3.v3.js"></script>
<script src="js/topojson.v0.min.js"></script>
<script>
    var width = 2000, height = 2000;
    var projection = d3.geo.mercator().center([0, 5]).scale(100).rotate([0, 0]);
    var svg = d3.select("body").append("svg").attr("width", width).attr("height", height);
    var path = d3.geo.path().projection(projection);
    var g = svg.append("g");

    d3.json("json/world-110m2.json", function(error, topology) {// load and display the World
        g.selectAll("path").data(topojson.object(topology, topology.objects.countries).geometries).enter().append("path").attr("d", path)
    });

    d3.csv("file1", function(flights) { //Attempt to draw arcs
        var linksByOrigin = {}, countByAirport = {}, locationByAirport = {}, positions = [];

        var arc = …
Run Code Online (Sandbox Code Playgroud)

d3.js

4
推荐指数
1
解决办法
5843
查看次数

标签 统计

d3.js ×1

java ×1

rest ×1

spring ×1

spring-mvc ×1

thymeleaf ×1