/** * */ private void stopServer() { HttpClient client = new HttpClient(); try { final HttpExchange exchange = new HttpExchange(); exchange.setMethod("POST"); exchange.setURL(String.format("http://127.0.0.1:%s/shutdown?secret=%s", port, secret)); client.send(exchange); log.info("LOG00010: shutdown status {}", exchange.getStatus()); } catch (IOException e) { log.error("LOG00020: Can't stop server gracefully", e); } }
exchange.setURL(url.toString()); exchange.setVersion(request.getProtocol());
exchange.setURL(url.toString()); exchange.setVersion(request.getProtocol());
HttpExchange postExchange = new FritzahaContentExchange(callback); postExchange.setMethod("POST"); postExchange.setURL(getURL(path)); try { postExchange.setRequestContent(new ByteArrayBuffer(addSID(args).getBytes("UTF-8")));
_exchange.setURL(_location);
/** * Sends an HTTP GET request using the asynchronous client * * @param Path * Path of the requested resource * @param Args * Arguments for the request * @param Callback * Callback to handle the response with */ public HttpExchange asyncGet(String path, String args, FritzahaCallback callback) { if (!isAuthenticated()) authenticate(); HttpExchange getExchange = new FritzahaContentExchange(callback); getExchange.setMethod("GET"); getExchange.setURL(getURL(path, addSID(args))); try { asyncclient.send(getExchange); } catch (IOException e) { logger.error("An I/O error occurred while sending the GET request " + getURL(path, addSID(args))); return null; } logger.debug("GETting URL " + getURL(path, addSID(args))); return getExchange; }
exchange.setURL(url.toString()); exchange.setVersion(request.getProtocol());