当前位置: 首页>>代码示例>>Java>>正文


Java MessageInterceptor类代码示例

本文整理汇总了Java中org.eclipse.californium.core.network.interceptors.MessageInterceptor的典型用法代码示例。如果您正苦于以下问题:Java MessageInterceptor类的具体用法?Java MessageInterceptor怎么用?Java MessageInterceptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessageInterceptor类属于org.eclipse.californium.core.network.interceptors包,在下文中一共展示了MessageInterceptor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendRequest

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public void sendRequest(Exchange exchange, Request request) {
	
	if (request.getDestination() == null)
		throw new NullPointerException("Request has no destination address");
	if (request.getDestinationPort() == 0)
		throw new NullPointerException("Request has no destination port");
	
	matcher.sendRequest(exchange, request);
	
	/* 
	 * Logging here causes significant performance loss.
	 * If necessary, add an interceptor that logs the messages,
	 * e.g., the MessageTracer.
	 */
	
	for (MessageInterceptor interceptor:interceptors)
		interceptor.sendRequest(request);

	// MessageInterceptor might have canceled
	if (!request.isCanceled())
		connector.send(serializer.serialize(request));
}
 
开发者ID:iotoasis,项目名称:SI,代码行数:24,代码来源:CoapEndpoint.java

示例2: sendResponse

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public void sendResponse(Exchange exchange, Response response) {
	
	if (response.getDestination() == null)
		throw new NullPointerException("Response has no destination address");
	if (response.getDestinationPort() == 0)
		throw new NullPointerException("Response has no destination port");
	
	matcher.sendResponse(exchange, response);
	
	/* 
	 * Logging here causes significant performance loss.
	 * If necessary, add an interceptor that logs the messages,
	 * e.g., the MessageTracer.
	 */
	
	for (MessageInterceptor interceptor:interceptors)
		interceptor.sendResponse(response);

	// MessageInterceptor might have canceled
	if (!response.isCanceled())
		connector.send(serializer.serialize(response));
}
 
开发者ID:iotoasis,项目名称:SI,代码行数:24,代码来源:CoapEndpoint.java

示例3: sendEmptyMessage

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public void sendEmptyMessage(Exchange exchange, EmptyMessage message) {
	
	if (message.getDestination() == null)
		throw new NullPointerException("Message has no destination address");
	if (message.getDestinationPort() == 0)
		throw new NullPointerException("Message has no destination port");
	
	matcher.sendEmptyMessage(exchange, message);
	
	/* 
	 * Logging here causes significant performance loss.
	 * If necessary, add an interceptor that logs the messages,
	 * e.g., the MessageTracer.
	 */
	
	for (MessageInterceptor interceptor:interceptors)
		interceptor.sendEmptyMessage(message);

	// MessageInterceptor might have canceled
	if (!message.isCanceled())
		connector.send(serializer.serialize(message));
}
 
开发者ID:iotoasis,项目名称:SI,代码行数:24,代码来源:CoapEndpoint.java

示例4: reject

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
private void reject(Message message) {
	EmptyMessage rst = EmptyMessage.newRST(message);
	// sending directly through connector, not stack, thus set token
	rst.setToken(new byte[0]);
	
	for (MessageInterceptor interceptor:interceptors)
		interceptor.sendEmptyMessage(rst);
	
	// MessageInterceptor might have canceled
	if (!rst.isCanceled())
		connector.send(serializer.serialize(rst));
}
 
开发者ID:iotoasis,项目名称:SI,代码行数:13,代码来源:CoapEndpoint.java

示例5: addInterceptor

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public void addInterceptor(MessageInterceptor interceptor) {
	interceptors.add(interceptor);
}
 
开发者ID:iotoasis,项目名称:SI,代码行数:5,代码来源:CoapEndpoint.java

示例6: removeInterceptor

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public void removeInterceptor(MessageInterceptor interceptor) {
	interceptors.remove(interceptor);
}
 
开发者ID:iotoasis,项目名称:SI,代码行数:5,代码来源:CoapEndpoint.java

示例7: getInterceptors

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public List<MessageInterceptor> getInterceptors() {
	return new ArrayList<MessageInterceptor>(interceptors);
}
 
开发者ID:iotoasis,项目名称:SI,代码行数:5,代码来源:CoapEndpoint.java

示例8: addInterceptor

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
/**
 * Adds the interceptor.
 *
 * @param interceptor the interceptor
 */
public void addInterceptor(MessageInterceptor interceptor);
 
开发者ID:iotoasis,项目名称:SI,代码行数:7,代码来源:Endpoint.java

示例9: removeInterceptor

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
/**
 * Removes the interceptor.
 *
 * @param interceptor the interceptor
 */
public void removeInterceptor(MessageInterceptor interceptor);
 
开发者ID:iotoasis,项目名称:SI,代码行数:7,代码来源:Endpoint.java

示例10: getInterceptors

import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
/**
 * Gets the list of interceptors.
 *
 * @return the interceptors
 */
public List<MessageInterceptor> getInterceptors();
 
开发者ID:iotoasis,项目名称:SI,代码行数:7,代码来源:Endpoint.java


注:本文中的org.eclipse.californium.core.network.interceptors.MessageInterceptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。