Reputation: 641
I am using Californium Library for my CoAP Server.
I have no difficulties using it.
However, I was wondering if there is a way to set my resource as "root resource".
It seems that some sites have no "suburl" on their server URL. (for ex. coap://192.168.0.1:8080/ )
ATM, since I don't know how to set my resource as "root resource", my url seems like this "coap://192.168.0.1:8080/myResource/"
Is there any way to bind my resource to root context?
Thank you
Upvotes: 1
Views: 1480
Reputation: 1300
No, if you use the CoapServer class. this.root is a private final there and there is no option to change it:
org.eclipse.californium.core.CoapServer source at github
Theoretically, you may try to implement the org.eclipse.californium.core.server.ServerInterface using the CoapServer source of appropriate version.
Though, this approach is bad and fragile.
However, exposing your resources as restful resources which have their own names is assumed by the CoAP Specification itself as it relies on REST:
RFC 7252 - The Constrained Application Protocol (CoAP). Section 1
Upvotes: 2