本文整理了Java中org.eclipse.californium.core.coap.Request.getSource
方法的一些代码示例,展示了Request.getSource
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getSource
方法的具体详情如下:
包路径:org.eclipse.californium.core.coap.Request
类名称:Request
方法名:getSource
暂无
代码示例来源:origin: eclipse/californium
@Override
public void receiveRequest(Request request) {
LOGGER.log(Level.INFO, "{0}:{1} ==> req {2}", new Object[]{request.getSource(), request.getSourcePort(), request});
}
代码示例来源:origin: org.eclipse.californium/californium-core
@Override
public void receiveRequest(Request request) {
LOGGER.log(Level.INFO, "{0}", request.getSource());
}
代码示例来源:origin: org.eclipse.californium/californium-core
@Override
public void receiveRequest(Request request) {
LOGGER.info(String.format("%s:%d ==> req %s", request.getSource(), request.getSourcePort(), request));
}
代码示例来源:origin: eclipse/californium
@Override
public void receiveRequest(Request request) {
LOGGER.log(Level.INFO, "{0}", request.getSource());
}
代码示例来源:origin: org.eclipse.leshan/leshan-server-cf
private DTLSSession getSession(Request request) {
return connector.getSessionByAddress(new InetSocketAddress(request.getSource(), request.getSourcePort()));
}
}
代码示例来源:origin: eclipse/californium
/**
* Gets the source address of the request.
*
* @return the source address
*/
public InetAddress getSourceAddress() {
return exchange.getRequest().getSource();
}
代码示例来源:origin: eclipse/californium
/**
* Sends the specified response over the same endpoint as the request has
* arrived.
*
* @param response the response
*/
public void sendResponse(Response response) {
response.setDestination(request.getSource());
response.setDestinationPort(request.getSourcePort());
setResponse(response);
endpoint.sendResponse(this, response);
}
代码示例来源:origin: org.eclipse.californium/californium-core
/**
* Gets the source address of the request.
*
* @return the source address
*/
public InetAddress getSourceAddress() {
return exchange.getRequest().getSource();
}
代码示例来源:origin: org.eclipse.californium/californium-core
/**
* Creates a response to the specified request with the specified response
* code. The destination address of the response is the source address of
* the request.
* Type and MID are usually set automatically by the {@link ReliabilityLayer}.
* The token is set automatically by the {@link Matcher}.
*
* @param request
* the request
* @param code
* the code
* @return the response
*/
public static Response createResponse(Request request, ResponseCode code) {
Response response = new Response(code);
response.setDestination(request.getSource());
response.setDestinationPort(request.getSourcePort());
return response;
}
代码示例来源:origin: eclipse/californium
/**
* Creates a response to the specified request with the specified response
* code. The destination address of the response is the source address of
* the request.
* Type and MID are usually set automatically by the {@link ReliabilityLayer}.
* The token is set automatically by the {@link Matcher}.
*
* @param request
* the request
* @param code
* the code
* @return the response
*/
public static Response createResponse(Request request, ResponseCode code) {
Response response = new Response(code);
response.setDestination(request.getSource());
response.setDestinationPort(request.getSourcePort());
return response;
}
代码示例来源:origin: org.eclipse.californium/californium-core
/**
* Sends the specified response over the same endpoint as the request has
* arrived.
*
* @param response the response
*/
public void sendResponse(Response response) {
response.setDestination(request.getSource());
response.setDestinationPort(request.getSourcePort());
setResponse(response);
endpoint.sendResponse(this, response);
}
代码示例来源:origin: org.eclipse.californium/californium-core
@Override
public void deliverRequest(final Exchange exchange) {
Request request = exchange.getRequest();
List<String> path = request.getOptions().getUriPath();
final Resource resource = findResource(path);
if (resource != null) {
checkForObserveOption(exchange, resource);
// Get the executor and let it process the request
Executor executor = resource.getExecutor();
if (executor != null) {
exchange.setCustomExecutor();
executor.execute(new Runnable() {
public void run() {
resource.handleRequest(exchange);
} });
} else {
resource.handleRequest(exchange);
}
} else {
LOGGER.info("Did not find resource " + path.toString() + " requested by " + request.getSource()+":"+request.getSourcePort());
exchange.sendResponse(new Response(ResponseCode.NOT_FOUND));
}
}
代码示例来源:origin: org.eclipse.leshan/leshan-server-cf
objectLinks = LinkObject.parse(request.getPayload());
UpdateRequest updateRequest = new UpdateRequest(registrationId, request.getSource(), request.getSourcePort(),
lifetime, smsNumber, binding, objectLinks);
代码示例来源:origin: org.eclipse.leshan/leshan-server-cf
@Override
public void handleDELETE(CoapExchange exchange) {
LOG.debug("DELETE received : {}", exchange.advanced().getRequest());
List<String> uri = exchange.getRequestOptions().getUriPath();
if (uri != null && uri.size() == 2 && RESOURCE_NAME.equals(uri.get(0))) {
DeregisterRequest deregisterRequest = new DeregisterRequest(uri.get(1));
LwM2mResponse deregisterResponse = registrationHandler.deregister(deregisterRequest);
exchange.respond(fromLwM2mCode(deregisterResponse.getCode()));
if (exchange.advanced().getEndpoint() instanceof SecureEndpoint
&& deregisterResponse.getCode().equals(org.eclipse.leshan.ResponseCode.DELETED)) {
// clean the DTLS Session
Request request = exchange.advanced().getRequest();
((SecureEndpoint) exchange.advanced().getEndpoint()).getDTLSConnector().close(
new InetSocketAddress(request.getSource(), request.getSourcePort()));
}
} else {
LOG.debug("Invalid deregistration");
exchange.respond(ResponseCode.NOT_FOUND);
}
}
代码示例来源:origin: org.github.leshan/leshan-client
final InetSocketAddress source = new InetSocketAddress(request.getSource(), request.getSourcePort());
LOGGER.info("Initiate an observe relation between " + request.getSource() + ":"
+ request.getSourcePort() + " and resource " + resource.getURI());
final ObservingEndpoint remote = observeManager.findObservingEndpoint(source);
代码示例来源:origin: org.eclipse.californium/californium-core
if (request.getCode() != Code.GET) return;
InetSocketAddress source = new InetSocketAddress(request.getSource(), request.getSourcePort());
LOGGER.finer("Initiate an observe relation between " + request.getSource() + ":" + request.getSourcePort() + " and resource " + resource.getURI());
ObservingEndpoint remote = observeManager.findObservingEndpoint(source);
ObserveRelation relation = new ObserveRelation(remote, resource, exchange);
代码示例来源:origin: eclipse/californium
InetSocketAddress source = new InetSocketAddress(request.getSource(), request.getSourcePort());
new Object[]{request.getSource(), request.getSourcePort(), resource.getURI()});
ObservingEndpoint remote = observeManager.findObservingEndpoint(source);
ObserveRelation relation = new ObserveRelation(remote, resource, exchange);
代码示例来源:origin: eclipse/californium
return exchange;
} else {
Exchange.KeyUri idByUri = new Exchange.KeyUri(request.getURI(), request.getSource().getAddress(),
request.getSourcePort());
LOGGER.log(Level.FINE, "Looking up ongoing exchange for {0}", idByUri);
代码示例来源:origin: eclipse/californium
private Response responseFor(final Request request) {
Response response = new Response(ResponseCode.CONTENT);
response.setMID(request.getMID());
response.setToken(request.getToken());
response.setBytes(new byte[]{});
response.setSource(request.getDestination());
response.setSourcePort(request.getDestinationPort());
response.setDestination(request.getSource());
response.setDestinationPort(request.getSourcePort());
return response;
}
}
代码示例来源:origin: eclipse/californium
private static Response responseFor(final Request request) {
Response response = new Response(ResponseCode.CONTENT);
response.setMID(request.getMID());
response.setToken(request.getToken());
response.setBytes(new byte[]{});
response.setSource(request.getDestination());
response.setSourcePort(request.getDestinationPort());
response.setDestination(request.getSource());
response.setDestinationPort(request.getSourcePort());
return response;
}
}
内容来源于网络,如有侵权,请联系作者删除!