/** * Handles any request in the given exchange. By default it responds * with a 4.05 (Method Not Allowed). Override this method if your * resource handler requires advanced access to the internal Exchange class. * Most developer should be better off with overriding the called methods * {@link #handleGET(CoapExchange)}, {@link #handlePOST(CoapExchange)}, * {@link #handlePUT(CoapExchange)}, and {@link #handleDELETE(CoapExchange)}, * which provide a better API through the {@link CoapExchange} class. * * @param exchange the exchange with the request */ @Override public void handleRequest(final Exchange exchange) { Code code = exchange.getRequest().getCode(); switch (code) { case GET: handleGET(new CoapExchange(exchange, this)); break; case POST: handlePOST(new CoapExchange(exchange, this)); break; case PUT: handlePUT(new CoapExchange(exchange, this)); break; case DELETE: handleDELETE(new CoapExchange(exchange, this)); break; } }
/** * Handles any request in the given exchange. By default it responds * with a 4.05 (Method Not Allowed). Override this method if your * resource handler requires advanced access to the internal Exchange class. * Most developer should be better off with overriding the called methods * {@link #handleGET(CoapExchange)}, {@link #handlePOST(CoapExchange)}, * {@link #handlePUT(CoapExchange)}, and {@link #handleDELETE(CoapExchange)}, * which provide a better API through the {@link CoapExchange} class. * * @param exchange the exchange with the request */ @Override public void handleRequest(final Exchange exchange) { Code code = exchange.getRequest().getCode(); switch (code) { case GET: handleGET(new CoapExchange(exchange, this)); break; case POST: handlePOST(new CoapExchange(exchange, this)); break; case PUT: handlePUT(new CoapExchange(exchange, this)); break; case DELETE: handleDELETE(new CoapExchange(exchange, this)); break; } }