javacoapcalifornium

How can I set a CoAP post request Body with a requestparameter and a File?


I want to upload a file from a CoAP client by using the californium standard forwarded proxy to a server which supports http-communication.

Is there an alternative with CoAP to build a post Request with a name of the RequestParameter and a payload contents the Value of file?


Solution

  • CoAP (and so Californium) focus on efficiency for small payloads. POST files will not be the domain of CoAP at all. If you really want that, just load the payload from the file and POST that. Ensure, you configured the MAX_RESOURCE_BODY_SIZE in Californium.properties according your requirements. If you use Californium on both sides, both need to be configured. Alternatively, you may disable the "transparent blockwise" using a 0 MAX_RESOURCE_BODY_SIZE. That will then require, that you handle the single blocks and block-option on your own.