/** * @param _content * @param _isFile */ public void handlePOSTMethod(String _content, boolean _isFile) { String[] queries = _content.split("&"); String[] targetUUIDs = null; if (_isFile) { } else { for (int i = 0; i < queries.length; i++) { if (queries[i].contains("action")) { String[] action = queries[i].split("="); if (action[1].contentEquals("update")) { for (int j = 0; j < queries.length; j++) { if (queries[j].contains("device_id")) { String[] s = queries.clone()[j].trim().split("="); targetUUIDs = s[1].split(","); // check correct regex } } } } } } if (targetUUIDs == null) { sendResponse(StaticResources.ERROR_CODE_BAD_REQUEST); } else { MessageService.getInstance() .addToMessageBuffer( new MessageObject( this.uuid, StaticResources.HTTP_CLIENT, DataStorageService.getInstance().resolveBaseStationAddresses(targetUUIDs), _content)); MessageService.getInstance().wakeThread(); } }
private void close() { this.destroy(); MessageService.getInstance().unregisterReceiver(this.uuid); try { this.output.close(); this.input.close(); this.clientSocket.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** @param _socket */ public HttpSocketWorker(Socket _socket) { this.clientSocket = _socket; MessageService.getInstance().registerReceiver(this, this.uuid); }