if (request.getOptions().hasObserve() && resource.isObservable()) {
if (request.getOptions().getObserve()==0) {
// Requests wants to observe and resource allows it :-)
LOGGER.info("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);
remote.addObserveRelation(relation);
exchange.setRelation(relation);
// all that's left is to add the relation to the resource which
// the resource must do itself if the response is successful
} else if (request.getOptions().getObserve()==1) {
ObserveRelation relation = observeManager.getRelation(source, request.getToken());