我正在尝试使用maven插件生成WADL.项目构建和服务工作.以下是POM插件的一部分:
com.sun.jersey.contribs
maven-wadl-plugin
1.19.2
generate
generate
package
${basedir}/src/main/docs/ThingREST.wadl
true
http://localhost:8080/ThingREST
samp.rest.ws.controller
com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc
applicationDocsFile
${basedir}/src/main/docs/xml/app-wadl-doc.xml
com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport
grammarsFile
${basedir}/src/main/docs/xml/app-wadl-grammar.xml
applicationDocFile和grammarFile存在,但它们不包含任何重要信息.我不知道该包括什么.
这是控制器:
package samp.rest.ws.controller;
import java.util.List;
import samp.rest.ws.ThingDB;
import samp.rest.ws.vo.Thing;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author Grayson
*/
@RestController
public class ThingController {
@RequestMapping(value = "/things", method = RequestMethod.GET, headers = "Accept=application/json") //produces = "application/json")
public List getThings() {
return ThingDB.getThings();
}
@RequestMapping(value = "/thing/{id}", method = RequestMethod.GET, headers = "Accept=application/json")
public Thing getThingById(@PathVariable int id) {
return ThingDB.getThing(id);
}
@RequestMapping(value = "/thingy/{id}", method = RequestMethod.GET)
public String getThingy(@PathVariable int id) {
return ThingDB.getThing(id).toString();
}
@RequestMapping(value = "/addthing", method = RequestMethod.PUT) //, headers = "Accept=application/json")
public void addThing(@RequestBody Thing thing) {
ThingDB.addThing(thing);
List lt = ThingDB.getThings();
for (Thing t : lt) {
System.out.println(" Post add: " + t.toString());
}
}
}
最后,这是WADL产生的:
jersey:generatedBy="Jersey: 1.19.2 08/25/2016 12:00 AM"
xmlns:jersey="http://jersey.java.net/"/>
title="Maven Spring REST Sample WADL"
xml:lang="en">
This is the Web Application Description Language (WADL) for
a Maven Spring REST Service. This service is intended to serve as
a workign model/sample.
]]>
我期望WADL包含可用的服务调用并识别输入类型.显然,我没有得到这个.
我已经搜索了高低版本的示例和文档来使用这个插件.任何和所有的帮助将不胜感激.遗憾的是,存在哪些文档/示例似乎已经过时了.
提前致谢.