Java Code Examples for org.eclipse.californium.core.CoapResource#add()

The following examples show how to use org.eclipse.californium.core.CoapResource#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelloWorld2.java    From hands-on-coap with Eclipse Public License 1.0 6 votes vote down vote up
public static void main(String[] args) {

        // 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);

        // "removeme!, "time", "writeme!"
        server.add(new RemovableResource(), new TimeResource(), new WritableResource());

        server.start();
    }
 
Example 2
Source File: IOTCoapServer.java    From IOT-Technical-Guide with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws UnknownHostException {

        CoapServer server = new CoapServer();


        server.add(new HelloResource());

        CoapResource path = new CoapResource("subpath");
        path.add(new AnotherResource());
        server.add(path);

        server.add(new RemovableResource(), new TimeResource(), new WritableResource());


        server.start();
    }
 
Example 3
Source File: CoapTransportService.java    From Groza with Apache License 2.0 4 votes vote down vote up
private void createResources() {
    CoapResource api = new CoapResource(API);
    api.add(new CoapTransportResource(processor,authService,adaptor,V1,timeout, quotaService));
    server.add(api);
}
 
Example 4
Source File: CoapTransportService.java    From iotplatform with Apache License 2.0 4 votes vote down vote up
private void createResources() {
  CoapResource api = new CoapResource(API);
  api.add(new CoapTransportResource(msgProducer, attributesService, authService, V1, timeout));
  server.add(api);
}