Add dynamic resource with PUT on non-existent path with Californium

133 Views Asked by At

I want the Californium CoAP server to handle a PUT request with a yet non-existent Resource path. Instead of providing an Error return message, the server should dynamically add a resource with the path the PUT method is targeting.

I am using the cf-plugtest-server coming with the Californium Core library in Java to try to implement this function. Unfortunately i am completely new to Californium and couldn't find a solution approach.

So far i found out the "resource not found" output is taking place at the ServerMessageDeliverer in californium.core.server with deliverRequest. However i don't know how to proceed from here.

Any help is very much appreciated. I am sorry if a solution to this is more obvious, i am fairly new to such a kind of programming. Thank you in advance!

1

There are 1 best solutions below

0
Achim Kraus On

Manipulations/changes on the resource tree are currently not supported out of the box.

The currently intended way is to provide a specific implementation of ServerMessageDeliverer which overrides the preDeliverRequest. there you may create the resource you want and add it to the resources tree.