Californium CoAP path parameters

0 votes

I'm working on a CoAP application using Eclipse Californium and I need to pass parameters using the URL as we do in restful web services. Is it possible to do it in californium coap implementation, and if so please let me know how to do it. ex:

coap://localhost:5683/foo/{fooID}
Oct 10, 2018 in IoT (Internet of Things) by Matt
• 2,270 points
1,283 views

1 answer to this question.

0 votes

The short answer is yes you can do it.

As stated in JavaDocs

  • When a request arrives at the server, the {@link ServerMessageDeliverer} searches in the resource tree for the destination resource. It travels down the resource tree by looking for one element of the destination URI after another and by calling the method {@link #getChild(String)} on each element. It is allowed to override this method and to return an arbitrary resource. This allows for instance to serve URIs with wildcards or delegate requests to any sub-URI to the same resource.

So basically you have to override deliverRequest and maybe findResource methods in org.eclipse.californium.core.server.ServerMessageDeliverer in order to return appropriate resource which will handle the request. Also it will be required to analyse Exchange Request UriPath as a part of resource handleGET/PUT/POST/etc to fetch path variable (this can be done by using CoapExchange.advanced().getRequest().getOptions().getUriPath())

Based on the source code of Californium it should be pretty easy to override the default behaviour of a request deliverer.

Good luck with that!

answered Oct 10, 2018 by anonymous2
• 4,280 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

Differenciation between HTTP and COAP?

The industry plan is to improve HTTP ...READ MORE

answered Sep 6, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
2,229 views
0 votes
1 answer

MQTT and CoAP Sensors and Actuators

For CoAP: Every 6LowPAN sensor mote has ...READ MORE

answered Oct 1, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
916 views
0 votes
1 answer

Why are oBIX and CoAP required together?

In IOT, CoAP is used as a ...READ MORE

answered Oct 9, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
901 views
0 votes
1 answer

Send CoAP requests using Python

You can use a library like CoAPython ...READ MORE

answered Oct 16, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,796 views
0 votes
1 answer

Contiki-OS : CoAP protocol and CoRE link implementation

I don't think there's a standard way to ...READ MORE

answered Jan 21, 2019 in IoT (Internet of Things) by Upasana
• 8,620 points
1,371 views
0 votes
0 answers

Eclipse Californium CoAP wildcard as url path

I'm working on a CoAP app using ...READ MORE

Jul 19, 2018 in IoT (Internet of Things) by Matt
• 2,270 points
652 views
0 votes
1 answer

How to read data from MQTT in Eclipse Paho?

You don't read data from a MQTT ...READ MORE

answered Aug 9, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
908 views
0 votes
1 answer

Sending CoAP requests using Python

It can be done using a library ...READ MORE

answered Aug 24, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
2,565 views
0 votes
1 answer

integrating CoAP and DTLS

Tested with development version 9184a75a21; $ git clone https://github.com/obgm/libcoap ...READ MORE

answered Sep 5, 2018 in IoT (Internet of Things) by lady technopath

edited Sep 5, 2018 by Vardhan 2,125 views
0 votes
1 answer

What is the size of CoAP packet?

It Depends: Core CoAP messages must be small enough ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
2,532 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP