我正在使用 java 使用 CoAP californium 库,我的问题是我想在服务器的主要功能中从客户端获取请求的资源。
public static void main(String[] args) {
// TODO Auto-generated method stub
// binds on UDP port 5683
CoapServer server=new CoapServer();
// "hello"
server.add(new HelloResource());
// "subpath/Another"
CoapResource path=new CoapResource("subpath");
path.add(new AnotherResource());
server.add(path);
server.add(new RemovableResource(),new TimeResource(),new WritableResource());
System.out.println("Resources added");
server.start();
}
之后我应该写什么server.start()
..我知道服务器使用函数deliverRequest(final Exchange exchange)
函数并findResource(final List<String> list)
在资源树中搜索请求的资源..但我想获取这个值并将其存储在服务器的主函数中的变量中