Package de.uniluebeck.itm.ncoap.message

Examples of de.uniluebeck.itm.ncoap.message.CoapResponse


        Long contentFormat = determineResponseContentFormat(coapRequest);

        //create error response if content could not be created
        if(contentFormat == null){
            CoapResponse coapResponse =
                    new CoapResponse(coapRequest.getMessageTypeName(), MessageCode.Name.BAD_REQUEST_400);

            String content = "None of accepted content formats is supported by this Webservice.";
            coapResponse.setContent(content.getBytes(CoapMessage.CHARSET));
            responseFuture.set(coapResponse);
        }

        //create response with content if available
        else{
            byte[] content = getSerializedResourceStatus(contentFormat);
            CoapResponse coapResponse =
                    new CoapResponse(coapRequest.getMessageTypeName(), MessageCode.Name.CONTENT_205);

            coapResponse.setContent(content, contentFormat);
            responseFuture.set(coapResponse);
        }
    }
View Full Code Here

TOP

Related Classes of de.uniluebeck.itm.ncoap.message.CoapResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.