本文整理汇总了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));
}
示例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));
}
示例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));
}
示例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));
}
示例5: addInterceptor
import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public void addInterceptor(MessageInterceptor interceptor) {
interceptors.add(interceptor);
}
示例6: removeInterceptor
import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public void removeInterceptor(MessageInterceptor interceptor) {
interceptors.remove(interceptor);
}
示例7: getInterceptors
import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
@Override
public List<MessageInterceptor> getInterceptors() {
return new ArrayList<MessageInterceptor>(interceptors);
}
示例8: addInterceptor
import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
/**
* Adds the interceptor.
*
* @param interceptor the interceptor
*/
public void addInterceptor(MessageInterceptor interceptor);
示例9: removeInterceptor
import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
/**
* Removes the interceptor.
*
* @param interceptor the interceptor
*/
public void removeInterceptor(MessageInterceptor interceptor);
示例10: getInterceptors
import org.eclipse.californium.core.network.interceptors.MessageInterceptor; //导入依赖的package包/类
/**
* Gets the list of interceptors.
*
* @return the interceptors
*/
public List<MessageInterceptor> getInterceptors();