I'm a bit biased because I'm a Java developer, but you ought to consider Groovy. It works seamlessly with the rest of the Java stack, but has dynamic syntax. If you are doing REST you can do something like this (GET example):
That will take a string, convert it to a URL, fetch it and put the response in a string named response in a single line. Groovy has a lot of things like that for handling networking code and its XML and JSON APIs are really slick. For example, this is how you would parse a XML response (using RSS as an example):
发布评论
评论(1)
我有点偏见,因为我是一名 Java 开发人员,但你应该考虑 Groovy。它与 Java 堆栈的其余部分无缝协作,但具有动态语法。如果您正在使用 REST,您可以执行类似以下操作(GET 示例):
这将获取一个字符串,将其转换为 URL,获取它并将响应放入名为 response 的字符串中,并放在一行中。 Groovy 有很多类似处理网络代码的功能,而且它的 XML 和 JSON API 非常灵活。例如,这就是解析 XML 响应的方式(以 RSS 为例):
JsonSlurper
与原始 JSON 输出的工作方式相同。I'm a bit biased because I'm a Java developer, but you ought to consider Groovy. It works seamlessly with the rest of the Java stack, but has dynamic syntax. If you are doing REST you can do something like this (GET example):
That will take a string, convert it to a URL, fetch it and put the response in a string named response in a single line. Groovy has a lot of things like that for handling networking code and its XML and JSON APIs are really slick. For example, this is how you would parse a XML response (using RSS as an example):
The
JsonSlurper
works the same way with raw JSON output.