當前位置: 首頁>>代碼示例>>Java>>正文


Java CoapMediaType類代碼示例

本文整理匯總了Java中org.ws4d.coap.messages.CoapMediaType的典型用法代碼示例。如果您正苦於以下問題:Java CoapMediaType類的具體用法?Java CoapMediaType怎麽用?Java CoapMediaType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CoapMediaType類屬於org.ws4d.coap.messages包,在下文中一共展示了CoapMediaType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BasicCoapResource

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public BasicCoapResource(String path, byte[] value, CoapMediaType mediaType) {
this.path = path;
this.value = value;
this.mediaType = mediaType;
   }
 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:6,代碼來源:BasicCoapResource.java

示例2: setCoapMediaType

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public void setCoapMediaType(CoapMediaType mediaType) {
this.mediaType = mediaType;
   }
 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:4,代碼來源:BasicCoapResource.java

示例3: getCoapMediaType

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
@Override
   public CoapMediaType getCoapMediaType() {
return mediaType;
   }
 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:5,代碼來源:BasicCoapResource.java

示例4: getCoapMediaType

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
@Override
public CoapMediaType getCoapMediaType() {
	return CoapMediaType.link_format;
}
 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:5,代碼來源:CoreResource.java

示例5: createResponse

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public CoapResponse createResponse(CoapMessage request,
CoapResponseCode responseCode, CoapMediaType contentType);
 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:3,代碼來源:ServerChannel.java

示例6: doGet

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
@Override
public void doGet(ServerChannel channel, CoapRequest request) {
	String responseValue = null;

	EnOceanRequest enoceanRequest = new EnOceanRequest(request);

	CoapMessage response = channel.createResponse(request,
			CoapResponseCode.Content_205);
	switch (enoceanRequest.getRequest()) {
	case Location:
		responseValue = Utils.displayListOfChildren(enoceanStorage,
				enoceanRequest.getLocation()).toString();
		response.setContentFormat(CoapMediaType.json);
		break;
	case EEP:
		responseValue = Utils.displayListOfMeasures(enoceanStorage,
				enoceanRequest.getFunctionality(),
				enoceanRequest.getLocation()).toString();
		response.setContentFormat(CoapMediaType.json);
		break;
	case Value:
		responseValue = Utils.displayActionValue(enoceanStorage,
				enoceanRequest.getFunctionality(),
				enoceanRequest.getLocation(), enoceanRequest.getAction());
		response.setContentFormat(CoapMediaType.text_plain);
		break;
	case Storage:
		logger.debug("DoGet() Storage ");
		Vector<String> uriQuery = request.getUriQuery();
		Hashtable<String, String> options = new Hashtable<String, String>();
		for (int i = 0; i < uriQuery.size(); i++) {
			if (uriQuery.get(i).contains("=")) {
				String[] opts = uriQuery.get(i).split("=");
				options.put(opts[0], opts[1]);
			} else {
				options.put(uriQuery.get(i), null);
			}

		}

		if (options.containsKey("from") && options.containsKey("to")) {
			responseValue = Utils.getStorageByDates(enoceanStorage,
					enoceanRequest.getFunctionality(),
					enoceanRequest.getLocation(),
					enoceanRequest.getAction(), options.get("from"),
					options.get("to")).toString();
		} else if (options.containsKey("days")) {
			responseValue = Utils.getStorageByDays(enoceanStorage,
					enoceanRequest.getFunctionality(),
					enoceanRequest.getLocation(),
					enoceanRequest.getAction(), options.get("days"))
					.toString();
		} else {
			response = channel.createResponse(request,
					CoapResponseCode.Bad_Request_400);
		}
		response.setContentFormat(CoapMediaType.json);
		break;
	default:
		logger.error("Error with type of request");
		break;
	}

	// Have a better display for the urls
	if (responseValue == null) {
		response = channel.createResponse(request,
				CoapResponseCode.Not_Found_404);
	} else {
		responseValue = responseValue.replace("\\/", "/");
		logger.debug(responseValue);
		response.setPayload(responseValue);
	}
	channel.sendMessage(response);

}
 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:76,代碼來源:EnOceanCoapServer.java

示例7: getCoapMediaType

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public CoapMediaType getCoapMediaType() {
return mediaType;
   }
 
開發者ID:vitrofp7,項目名稱:vitro,代碼行數:4,代碼來源:BasicCoapResource.java

示例8: getCoapMediaType

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public CoapMediaType getCoapMediaType() {
	return CoapMediaType.link_format;
}
 
開發者ID:vitrofp7,項目名稱:vitro,代碼行數:4,代碼來源:CoreResource.java

示例9: getCoapMediaType

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public CoapMediaType getCoapMediaType(); 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:2,代碼來源:CoapResource.java

示例10: addAccept

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public void addAccept(CoapMediaType mediaType); 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:2,代碼來源:CoapRequest.java

示例11: getAccept

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public Vector<CoapMediaType> getAccept(CoapMediaType mediaType); 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:2,代碼來源:CoapRequest.java

示例12: setContentFormat

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public void setContentFormat(CoapMediaType mediaType); 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:2,代碼來源:CoapMessage.java

示例13: getContentFormat

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public CoapMediaType getContentFormat(); 
開發者ID:heia-fr,項目名稱:wot_gateways,代碼行數:2,代碼來源:CoapMessage.java

示例14: setContentType

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public void setContentType(CoapMediaType mediaType); 
開發者ID:adityayadav76,項目名稱:internet_of_things_simulator,代碼行數:2,代碼來源:CoapMessage.java

示例15: getContentType

import org.ws4d.coap.messages.CoapMediaType; //導入依賴的package包/類
public CoapMediaType getContentType(); 
開發者ID:adityayadav76,項目名稱:internet_of_things_simulator,代碼行數:2,代碼來源:CoapMessage.java


注:本文中的org.ws4d.coap.messages.CoapMediaType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。