コード例 #1
0
 public void sendResponse(int taskId, ConsoleRequest request) {
   try {
     URL url = new URL(webServerUrl + "putResponse.do");
     HttpURLConnection connection = (HttpURLConnection) url.openConnection();
     connection.setDoOutput(true);
     connection.setRequestMethod("POST");
     connection.setConnectTimeout(2000);
     connection.setReadTimeout(2000);
     OutputStream outputStream = connection.getOutputStream();
     DataOutputStream output = new DataOutputStream(outputStream);
     output.writeInt(taskId);
     output.writeInt(request.getType());
     request.writeResponse(ManagementCenterService.this, output);
     connection.getInputStream();
   } catch (Exception e) {
     logger.log(Level.FINEST, e.getMessage(), e);
   }
 }
コード例 #2
0
 public void register(ConsoleRequest consoleRequest) {
   consoleRequests[consoleRequest.getType()] = consoleRequest;
 }