return sb.toString();
}
@Get("method")
public Object method(Invocation pinv) {
InvocationBean inv = (InvocationBean) pinv;
RequestPath curpath = inv.getRequestPath();
String testUri = inv.getRequest().getQueryString(); // queryString as uri
if (testUri == null || testUri.length() == 0) {
return "@e.g. <a href='/rose-info/method?get=/rose-info/tree'>/rose-info/method?get=/rose-info/tree</a>";
}
ReqMethod testMethod = curpath.getMethod();
if (testUri.indexOf('=') > 0) {
int index = testUri.indexOf('=');
testMethod = ReqMethod.parse(testUri.substring(0, index));
testUri = testUri.substring(index + 1);
}
if (!testUri.startsWith(curpath.getCtxpath())) {
return "@wrong uri:" + testUri;
}
MappingNode tree = inv.getRose().getMappingTree();
RequestPath testPath = new RequestPath(//
testMethod, testUri, curpath.getCtxpath(), curpath.getDispatcher());
//
ArrayList<MatchResult> matchResults = tree.match(testPath);
if (matchResults == null) {
// not rose uri
return ("@404: <br>not rose uri: '" + testUri + "'");
}
final MatchResult lastMatched = matchResults.get(matchResults.size() - 1);
final EngineGroup leafEngineGroup = lastMatched.getMappingNode().getLeafEngines();
final LinkedEngine leafEngine = select(leafEngineGroup.getEngines(testMethod), inv
.getRequest());
if (leafEngine == null) {
if (leafEngineGroup.size() == 0) {
// not rose uri
return ("@404: <br>not rose uri, not exits leaf engines for it: '" + testUri + "'");