@Override
  public void handlePOST(CoapExchange exchange) {

    Response response = new Response(CoAP.ResponseCode.CONTENT);

    int contentType = exchange.getRequestOptions().getContentFormat();
    int acceptTypeVal = exchange.getRequestOptions().getAccept();
    String acceptType = "";
    switch (acceptTypeVal) {
      case MediaTypeRegistry.APPLICATION_EXI:
        break;
      case MediaTypeRegistry.APPLICATION_XML:
        acceptType = MediaType.APPLICATION_XML.getSubType();
        break;
      case MediaTypeRegistry.APPLICATION_JSON:
        acceptType = MediaType.APPLICATION_JSON.getSubType();
        break;
    }

    Resource02_Discovery rd = new Resource02_Discovery();
    byte[] message = exchange.getRequestPayload();
    InputStream isMsg = new ByteArrayInputStream(message);
    StringRepresentation sr = new StringRepresentation("");

    try {
      switch (contentType) {
        case MediaTypeRegistry.APPLICATION_EXI:
          //              decode first! TODO
          //                 sr = rc.registerXmlHandler(isMsg, acceptType);
          //                 byte[] exiMessage = codeSchemaLess(message);
          //                 response.setPayload(exiMessage);
          break;
        case MediaTypeRegistry.APPLICATION_JSON:
          sr = rd.discoveryJsonHandler(isMsg, acceptType);
          response.setPayload(sr.getText());
          break;
        default:
          response.setPayload(
              "accept types supported: application/exi; application/xml; application/json");
      }

    } catch (ResourceException ex) {
      Logger.getLogger(CoapR02_Discovery.class.getName()).log(Level.SEVERE, null, ex);
    }

    exchange.respond(response);
  }