@Override public void handlePOST(CoapExchange exchange) { String payload = exchange.getRequestText(); String[] parts = payload.split("\\?"); String[] path = parts[0].split("/"); Resource resource = create(new LinkedList<String>(Arrays.asList(path))); Response response = new Response(ResponseCode.CREATED); response.getOptions().setLocationPath(resource.getURI()); exchange.respond(response); }
@Override public void handlePUT(CoapExchange exchange) { content = exchange.getRequestText(); exchange.respond(ResponseCode.CHANGED); }