当前位置: 首页>>代码示例>>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;未经允许,请勿转载。