Java Code Examples for org.eclipse.californium.core.network.Exchange#getRequest()
The following examples show how to use
org.eclipse.californium.core.network.Exchange#getRequest() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServerMessageDeliverer.java From SI with BSD 2-Clause "Simplified" License | 6 votes |
@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)); } }
Example 2
Source File: ServerMessageDeliverer.java From SI with BSD 2-Clause "Simplified" License | 6 votes |
@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)); } }
Example 3
Source File: CoapStack.java From SI with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void receiveRequest(Exchange exchange, Request request) { // if there is no BlockwiseLayer we still have to set it if (exchange.getRequest() == null) exchange.setRequest(request); if (deliverer != null) { deliverer.deliverRequest(exchange); } else { LOGGER.severe("Top of CoAP stack has no deliverer to deliver request"); } }
Example 4
Source File: ServerMessageDeliverer.java From SI with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void deliverResponse(Exchange exchange, Response response) { if (response == null) throw new NullPointerException(); if (exchange == null) throw new NullPointerException(); if (exchange.getRequest() == null) throw new NullPointerException(); exchange.getRequest().setResponse(response); }
Example 5
Source File: CoapStack.java From SI with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void receiveRequest(Exchange exchange, Request request) { // if there is no BlockwiseLayer we still have to set it if (exchange.getRequest() == null) exchange.setRequest(request); if (deliverer != null) { deliverer.deliverRequest(exchange); } else { LOGGER.severe("Top of CoAP stack has no deliverer to deliver request"); } }
Example 6
Source File: ServerMessageDeliverer.java From SI with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void deliverResponse(Exchange exchange, Response response) { if (response == null) throw new NullPointerException(); if (exchange == null) throw new NullPointerException(); if (exchange.getRequest() == null) throw new NullPointerException(); exchange.getRequest().setResponse(response); }