This commit is contained in:
Redkale
2017-03-17 15:57:49 +08:00
parent b3cbd9be71
commit 14274c8d04
3 changed files with 32 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ import org.redkale.net.http.*;
import org.redkale.service.*;
import org.redkale.source.DataSource;
import org.redkale.source.Flipper;
import org.redkale.util.Sheet;
import org.redkale.util.*;
/**
* 类说明:
@@ -76,4 +76,13 @@ public class HelloService implements Service {
return source.find(HelloEntity.class, id);
}
//查询单个
@RestMapping(name = "findone")
public HelloEntity findOneHello(AsyncHandler handler, @RestParam(name = "#") int id) { //通过 /pipes/hello/find/1234、/pipes/hello/jsfind/1234 查询对象
if (source != null) source.find(handler, HelloEntity.class, id);
HelloEntity rs = new HelloEntity();
rs.setHelloname("Hello名称");
if (handler != null) handler.completed(rs, null);
return null;
}
}

View File

@@ -38,6 +38,9 @@ public class _DynHelloRestServlet1 extends SimpleRestServlet {
//headers.put(Rest.REST_HEADER_RESOURCE_NAME, "my-res");
String url = "http://127.0.0.1:" + port + "/pipes/hello/update?entity={}&bean2={}";
System.out.println(Utility.postHttpContent(url, headers, null));
url = "http://127.0.0.1:" + port + "/pipes/hello/findone/1234";
System.out.println(Utility.postHttpContent(url, headers, null));
}