當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。