package ru.semiot.simulator.heatmeter;

import org.eclipse.californium.core.CoapResource;
import org.eclipse.californium.core.server.resources.CoapExchange;
import static org.eclipse.californium.core.coap.CoAP.ResponseCode.*;
import static org.eclipse.californium.core.coap.MediaTypeRegistry.TEXT_HTML;

public class DescriptionResource extends CoapResource {

    private final int id;
    public static final String text = ""
            +"@prefix hmtr: <http://purl.org/NET/ssnext/heatmeters#>\n"
            + "\n"
            + "<#meter-%s> a hmtr:HeatMeter .";

    public DescriptionResource(int id) {
        super("desc");
        this.id = id;
        getAttributes().setTitle(String.format(text, Integer.toString(id)));
    }

    @Override
    public void handleGET(CoapExchange exchange) {
        exchange.setMaxAge(5);
        exchange.respond(CONTENT, String.format(text, Integer.toString(id)), TEXT_HTML);
    }

}

@@ -491,16 +491,17 @@
 ters#%3E%5Cn
+.
 %22%0A      
@@ -556,17 +556,16 @@
 eatMeter
- 
 .%22;%0A%0A   

Update DescriptionResource.java