Retrieve and return R script STDOUT response using OpenCPU

@param openCpuSessionKey OpenCPU session key
@return R script STDOUT
@throws IOException if error occured during script response retrieval
421054
private String executeScriptGetValueRequest(String openCpuSessionKey) throws IOException {
    URI scriptGetValueResponseUri = getScriptGetValueResponseUri(openCpuSessionKey);
    HttpGet httpGet = new HttpGet(scriptGetValueResponseUri);
    String responseValue;
    try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
      int statusCode = response.getStatusLine().getStatusCode();
      if (statusCode >= 200 && statusCode < 300) {
        HttpEntity entity = response.getEntity();
        responseValue = EntityUtils.toString(entity);
        EntityUtils.consume(entity);
      } else {
        throw new ClientProtocolException(format(FORMAT_UNEXPECTED_RESPONSE_STATUS, statusCode));
      }
    }
    return responseValue;
  }
851159
public static sslcertkey_service_binding[] get(nitro_service service, String certkey) throws Exception{
		sslcertkey_service_binding obj = new sslcertkey_service_binding();
		obj.set_certkey(certkey);
		sslcertkey_service_binding response[] = (sslcertkey_service_binding[]) obj.get_resources(service);
		return response;
	}
975389
private CDCResponse getCDCQueryResponse(JsonNode jsonNode) throws IOException {
		ObjectMapper mapper = new ObjectMapper();

		SimpleModule simpleModule = new SimpleModule("CDCQueryResponseDeserializer", new Version(1, 0, 0, null));
		simpleModule.addDeserializer(CDCResponse.class, new CDCQueryResponseDeserializer());

		mapper.registerModule(simpleModule);

		return mapper.treeToValue(jsonNode, CDCResponse.class);
	}
897589
private CDCResponse getCDCQueryResponse(JsonNode jsonNode) throws IOException {
		ObjectMapper mapper = new ObjectMapper();

		SimpleModule simpleModule = new SimpleModule("CDCQueryResponseDeserializer", new Version(1, 0, 0, null));
		simpleModule.addDeserializer(CDCResponse.class, new CDCQueryResponseDeserializer());

		mapper.registerModule(simpleModule);
		mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

		return mapper.treeToValue(jsonNode, CDCResponse.class);
	}
997524
public Long incr(Object key) {
		Jedis jedis = getJedis();
		try {
			return jedis.incr(keyToBytes(key));
		}
		finally {close(jedis);}
	}
185042
private static void copyToRemote(Path src, URI dst) throws IOException {
    ResourceId dstId = FileSystems.matchNewResource(dst.toString(), false);
    WritableByteChannel dstCh = FileSystems.create(dstId, MimeTypes.BINARY);
    FileChannel srcCh = FileChannel.open(src, StandardOpenOption.READ);
    long srcSize = srcCh.size();
    long copied = 0;
    do {
      copied += srcCh.transferTo(copied, srcSize - copied, dstCh);
    } while (copied < srcSize);
    dstCh.close();
    srcCh.close();
    Preconditions.checkState(copied == srcSize);
  }
453309
@Override
    public String getOutputFileExtension(Source src) {
        String name = src.getOrigin().getName();
        return "." + FilenameUtils.getExtension(name);
    }
906763
public void print(String s) throws IOException
	{
		//PK89810, If WCCustomProperties.FINISH_RESPONSE_ON_CLOSE is set and stream is already obtained and closed. 
		// We will not allow user to print more data if the above case is met, outputstreamClosed will be true and default is false.
		if (!(WCCustomProperties.FINISH_RESPONSE_ON_CLOSE) || !outputstreamClosed ) //PK89810
		{
		if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
			logger.logp(Level.FINE, CLASS_NAME,"print", "print --> "+s);
                }
                if(s != null) {  // PQ88872
                    if (!_hasWritten && obs != null)
                    {
                            _hasWritten = true;
            			if (obsList!=null){
            				for (int i=0;i<obsList.size();i++){
            					obsList.get(i).alertFirstWrite();
            				}
            			}
            			else {
                            obs.alertFirstWrite();
                    }
            		}
			int len = s.length();
			if (limit > -1)
			{
				if (total + len > limit)
				{
					len = limit - total;
					except = new WriteBeyondContentLengthException();
				}
			}
			if(this.getBufferSize() != 0){		 // PM44112 
					int off = 0;
					while (len > 0)
					{
						int n = buf.length - count;
						if (n == 0)
						{
							response.setFlushMode(false);
							flushBytes();
							response.setFlushMode(true);
							n = buf.length - count;
						}
						if (n > len)
						{
							n = len;
						}
						//
						// NOTE:  this getBytes call is deprecated ... it doesn't work
						// correctly for multibyte characters, and doesn't take account
						// of the character encoding that the client expects.
						//
						s.getBytes(off, off + n, buf, count);
						
						count += n;
						total += n;
						off += n;
						len -= n;
					}
				} // PM44112 Start
				else if(getBufferSize() == 0) {	
					
					byte[] origBuf=buf; // store the original buff , which is 0
					buf = s.getBytes();	// update buf with the String to print.
					count = buf.length;
					total+=count; // keep the count and the total written
					
					if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
						logger.logp(Level.FINE, CLASS_NAME,"print",  "response Buffersize is set to zero , to print --> "+ count +" total -->"+  total);
					
					
					response.setFlushMode(true);
					flushBytes();				
					buf=origBuf; // set it back to original buff, i.e. 0 value
					
					if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
						logger.logp(Level.FINE, CLASS_NAME,"print",  "after flushbytes, buf --> "+ buf.length +" count --> "+  count+" total -->"+  total);
					
				}// PM44112 End
			check();
		} // PQ88872
	}
		else{//PK89810 start
			if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
				logger.logp(Level.FINE, CLASS_NAME,"print", "print not allowed, outputstreamClosed value --> " + outputstreamClosed);			
		}//PK89810 End
	}
880249
public String getResponse(String[] argv) throws IOException {
    String result = "";
    if (argv.length < 1) {
      return result;
    }
    if (argv[0].equals("-all")) {
      result += rpcCollector.getClusterUtilization();
      result += JobUtilization.legendString +
              JobUtilization.unitString;
      for (JobUtilization job : rpcCollector.getAllRunningJobUtilization()) {
        result += job;
      }
      result += TaskTrackerUtilization.legendString +
              TaskTrackerUtilization.unitString;
      for (TaskTrackerUtilization tt :
           rpcCollector.getAllTaskTrackerUtilization()) {
        result += tt;
      }
      return result;
    }
    if (argv[0].equals("-cluster")) {
      result += rpcCollector.getClusterUtilization();
      return result;
    }
    if (argv[0].equals("-job")) {
      result += JobUtilization.legendString +
              JobUtilization.unitString;
      if (argv.length == 1) {
        for (JobUtilization job : rpcCollector.getAllRunningJobUtilization()) {
          result += job;
        }
        return result;
      }
      for (int i = 1; i < argv.length; i++) {
        result += rpcCollector.getJobUtilization(argv[i]);
      }
      return result;
    }
    if (argv[0].equals("-tasktracker")) {
      result += TaskTrackerUtilization.legendString +
              TaskTrackerUtilization.unitString;
      if (argv.length == 1) {
        for (TaskTrackerUtilization tt :
             rpcCollector.getAllTaskTrackerUtilization()) {
          result += tt;
        }
        return result;
      }
      for (int i = 1; i < argv.length; i++) {
        result += rpcCollector.getTaskTrackerUtilization(argv[i]);
      }
      return result;
    }
    return result;
  }
1173477
@Override
    public byte[] getSigningKey () throws SmbException {
        /*
         * The kerberos session key is not accessible via the JGSS API. IBM and
         * Oracle both implement a similar API to make an ExtendedGSSContext
         * available. That API is accessed via reflection to make this independent
         * of the runtime JRE
         */
        if ( EXT_GSS_CONTEXT_CLASS == null || INQUIRE_SEC_CONTEXT == null || INQUIRE_TYPE_SESSION_KEY == null ) {
            throw new SmbException("ExtendedGSSContext support not available from JRE");
        }
        else if ( EXT_GSS_CONTEXT_CLASS.isAssignableFrom(this.gssContext.getClass()) ) {
            try {
                Key k = (Key) INQUIRE_SEC_CONTEXT.invoke(this.gssContext, new Object[] {
                    INQUIRE_TYPE_SESSION_KEY
                });
                return k.getEncoded();
            }
            catch (
                IllegalAccessException |
                IllegalArgumentException |
                InvocationTargetException ex ) {
                throw new SmbException("Failed to query Kerberos session key from ExtendedGSSContext", ex);
            }
        }
        throw new SmbException("ExtendedGSSContext is not implemented by GSSContext");
    }
693662
def _build_ocsp_response(self, ocsp_request: OCSPRequest) -> OCSPResponse:
        
        # Get the certificate serial
        tbs_request = ocsp_request['tbs_request']
        request_list = tbs_request['request_list']
        if len(request_list) != 1:
            logger.warning('Received OCSP request with multiple sub requests')
            raise NotImplemented('Combined requests not yet supported')
        single_request = request_list[0]  # TODO: Support more than one request
        req_cert = single_request['req_cert']
        serial = req_cert['serial_number'].native

        # Check certificate status
        try:
            certificate_status, revocation_date = self._validate(serial)
        except Exception as e:
            logger.exception('Could not determine certificate status: %s', e)
            return self._fail(ResponseStatus.internal_error)

        # Retrieve certificate
        try:
            subject_cert_contents = self._cert_retrieve(serial)
        except Exception as e:
            logger.exception('Could not retrieve certificate with serial %s: %s', serial, e)
            return self._fail(ResponseStatus.internal_error)

        # Parse certificate
        try:
            subject_cert = asymmetric.load_certificate(subject_cert_contents.encode('utf8'))
        except Exception as e:
            logger.exception('Returned certificate with serial %s is invalid: %s', serial, e)
            return self._fail(ResponseStatus.internal_error)

        # Build the response
        builder = OCSPResponseBuilder(**{
            'response_status': ResponseStatus.successful.value,
            'certificate': subject_cert,
            'certificate_status': certificate_status.value,
            'revocation_date': revocation_date,
        })

        # Parse extensions
        for extension in tbs_request['request_extensions']:
            extn_id = extension['extn_id'].native
            critical = extension['critical'].native
            value = extension['extn_value'].parsed

            # This variable tracks whether any unknown extensions were encountered
            unknown = False

            # Handle nonce extension
            if extn_id == 'nonce':
                builder.nonce = value.native

            # That's all we know
            else:
                unknown = True

            # If an unknown critical extension is encountered (which should not
            # usually happen, according to RFC 6960 4.1.2), we should throw our
            # hands up in despair and run.
            if unknown is True and critical is True:
                logger.warning('Could not parse unknown critical extension: %r',
                        dict(extension.native))
                return self._fail(ResponseStatus.internal_error)

            # If it's an unknown non-critical extension, we can safely ignore it.
            elif unknown is True:
                logger.info('Ignored unknown non-critical extension: %r', dict(extension.native))

        # Set certificate issuer
        builder.certificate_issuer = self._issuer_cert

        # Set next update date
        builder.next_update = datetime.now(timezone.utc) + timedelta(days=self._next_update_days)

        return builder.build(self._responder_key, self._responder_cert)
883502
public GetVpcResponse getVpc(GetVpcRequest getVpcRequest) {
        checkNotNull(getVpcRequest, "request should not be null.");
        checkNotNull(getVpcRequest.getVpcId(), "request vpcId should not be null.");
        InternalRequest internalRequest = this.createRequest(
                getVpcRequest, HttpMethodName.GET, VPC_PREFIX, getVpcRequest.getVpcId());
        return this.invokeHttpClient(internalRequest, GetVpcResponse.class);
    }
279893
@SuppressWarnings("unchecked")
  public ServiceRpc getRpc() {
    if (rpc == null) {
      rpc = serviceRpcFactory.create((OptionsT) this);
    }
    return rpc;
  }
628724
public Nfs3ReadlinkResponse wrapped_getReadlink(NfsReadlinkRequest request) throws IOException {
        NfsResponseHandler<Nfs3ReadlinkResponse> responseHandler = new NfsResponseHandler<Nfs3ReadlinkResponse>() {

            /* (non-Javadoc)
             * @see com.emc.ecs.nfsclient.rpc.RpcResponseHandler#makeNewResponse()
             */
            protected Nfs3ReadlinkResponse makeNewResponse() {
                return new Nfs3ReadlinkResponse();
            }
        };

        _rpcWrapper.callRpcWrapped(request, responseHandler);
        return responseHandler.getResponse();
    }
1160265
public Nfs3AccessResponse getAccess(NfsAccessRequest request) throws IOException {
        Nfs3AccessResponse response = new Nfs3AccessResponse();
        _rpcWrapper.callRpcNaked(request, response);
        return response;
    }
916602
public OvhTOTPSecret accessRestriction_totp_POST() throws IOException {
		String qPath = "/me/accessRestriction/totp";
		StringBuilder sb = path(qPath);
		String resp = exec(qPath, "POST", sb.toString(), null);
		return convertTo(resp, OvhTOTPSecret.class);
	}
50156
public static systemcpu_stats[] get(nitro_service service) throws Exception{
		systemcpu_stats obj = new systemcpu_stats();
		systemcpu_stats[] response = (systemcpu_stats[])obj.stat_resources(service);
		return response;
	}