oojdon的jdonmvc的demo访问根目录报错了,有经验的来解答下什么情况

         
tecentIDE26FC
15-03-04 6 66 1

com.jdon.mvc.rs.InvalidResourceException: can't find resource for:[/] by http verb[get]please check your resource design!

import com.jdon.mvc.annotations.In;
import com.jdon.mvc.annotations.Path;
import com.jdon.mvc.http.FormFile;
import com.jdon.mvc.http.RequestBody;
import com.jdon.mvc.represent.Html;
import com.jdon.mvc.represent.Json;
import com.jdon.mvc.represent.Represent;

public class TestController {

private static DB db = new DB();

@In
private RequestBody body;

@Path("/")
public Represent index() {
return new Html("index");
}

1
oojdon
2015-03-04 16:04

你好,是怎么运行的?tomcat?还是maven插件?

tecentIDE26FC
2015-03-04 16:47

gradle,maven,jetty @oojdon
[该贴被tecentIDE26FC于2015-03-04 16:47修改过]

tecentIDE26FC
2015-03-05 10:23

转成小写,再操作,也没啥问题啊,为什么就是找不到资源呢?
public DefaultResourceMatcher(Handler handler, List<String> keys) {
Method m = handler.getMethod();
Path path = m.getAnnotation(Path.class);
String definePath = path.value();
String url = definePath;
String lowerPath = definePath.toLowerCase();
//闀垮害澶т簬4涔熷氨鏄痝et:鐨勯暱搴︼紝寮�濮嬫彁鍙栧姩璇�
if (lowerPath.length() > 4) {
if (lowerPath.startsWith("get:") || lowerPath.startsWith("post:") || lowerPath.startsWith("put:") || lowerPath.startsWith("delete:")) {
verb = lowerPath.substring(0, lowerPath.indexOf(":"));
url = definePath.substring(lowerPath.indexOf(":") + 1);
}
}

if (!url.startsWith("/")) {
url = "/" + url;
}
ResourcePatternBuilder builder = new ResourcePatternBuilder();
builder.build(url);
pattern = builder.getPattern();
params = builder.getParamList();
if (keys.contains(generateKey()))
throw new ConfigException(
"duplicate resource exception ,pls check the path:["
+ url + "?" + this.verb + "]");
keys.add(generateKey());
this.handler = handler;
}

tecentIDE26FC
2015-03-05 11:02

List<Class<?>> resourceTypes = Scanner.scanRestfulClass(servletContext);

resourceTypes 为空。。。。NND什么情况?

2Go 1 2 下一页