The {@link WebserviceManager} is the topmost {@link ChannelHandler} of the {@link ChannelPipeline} returnedby {@link de.uniluebeck.itm.ncoap.application.server.ServerChannelPipelineFactory}. It is responsible to dispatch inbound {@link CoapRequest}s, i.e.
- invoke the method {@link Webservice#processCoapRequest(SettableFuture,CoapRequest,InetSocketAddress)} ofthe addressed {@link Webservice} instance (if it exists) or
- invoke the method {@link NotFoundHandler#processCoapRequest(SettableFuture,CoapRequest,InetSocketAddress)} if theinbound {@link CoapRequest} addresses a service that does not (yet) exist.
Upon invocation of the method it awaits a proper {@link CoapResponse} and sends that response downstream, i.e.in the direction of the local socket, i.e. to the client that sent the {@link CoapRequest}. However, the {@link WebserviceManager} is aware of all registered {@link Webservice} instances and is thus to beused to register new {@link Webservice} instances, e.g. while processing an inbound {@link CoapRequest} with{@link MessageCode.Name#POST}. That is why all {@link Webservice} instances can reference their{@link WebserviceManager} via {@link Webservice#getWebserviceManager()}. Last but not least it checks whether the {@link de.uniluebeck.itm.ncoap.message.options.OptionValue.Name#IF_NONE_MATCH} is set on inbound {@link CoapRequest}s and sends a {@link CoapResponse} with {@link MessageCode.Name#PRECONDITION_FAILED_412} if the option was set but theaddressed {@link Webservice} already exists.
@author Oliver Kleine