This commit is contained in:
@@ -76,9 +76,9 @@ public class HelloService implements Service {
|
|||||||
return source.find(HelloEntity.class, id);
|
return source.find(HelloEntity.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询单个
|
//异步查询单个
|
||||||
@RestMapping(name = "findone")
|
@RestMapping(name = "asyncfind")
|
||||||
public HelloEntity findOneHello(AsyncHandler handler, @RestParam(name = "#") int id) { //通过 /pipes/hello/find/1234、/pipes/hello/jsfind/1234 查询对象
|
public HelloEntity findHello(AsyncHandler handler, @RestParam(name = "#") int id) { //通过 /pipes/hello/find/1234、/pipes/hello/jsfind/1234 查询对象
|
||||||
if (source != null) source.find(handler, HelloEntity.class, id);
|
if (source != null) source.find(handler, HelloEntity.class, id);
|
||||||
HelloEntity rs = new HelloEntity();
|
HelloEntity rs = new HelloEntity();
|
||||||
rs.setHelloname("Hello名称");
|
rs.setHelloname("Hello名称");
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class _DynHelloRestServlet1 extends SimpleRestServlet {
|
|||||||
String url = "http://127.0.0.1:" + port + "/pipes/hello/update?entity={}&bean2={}";
|
String url = "http://127.0.0.1:" + port + "/pipes/hello/update?entity={}&bean2={}";
|
||||||
System.out.println(Utility.postHttpContent(url, headers, null));
|
System.out.println(Utility.postHttpContent(url, headers, null));
|
||||||
|
|
||||||
url = "http://127.0.0.1:" + port + "/pipes/hello/findone/1234";
|
url = "http://127.0.0.1:" + port + "/pipes/hello/asyncfind/1234";
|
||||||
System.out.println(Utility.postHttpContent(url, headers, null));
|
System.out.println(Utility.postHttpContent(url, headers, null));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -125,4 +125,11 @@ public class _DynHelloRestServlet1 extends SimpleRestServlet {
|
|||||||
resp.finishJson(bean);
|
resp.finishJson(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AuthIgnore
|
||||||
|
@WebMapping(url = "/hello/asyncfind/")
|
||||||
|
public void asyncfind(HttpRequest req, HttpResponse resp) throws IOException {
|
||||||
|
HelloService service = _servicemap == null ? _service : _servicemap.get(req.getHeader(Rest.REST_HEADER_RESOURCE_NAME, ""));
|
||||||
|
int id = Integer.parseInt(req.getRequstURILastPath());
|
||||||
|
service.findHello(resp.createAsyncHandler(), id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user