Prepares the request.
@param targetProperties the target properties
@param userData the user data to pass
@return a request
@throws UnsupportedEncodingException
436194
private RunInstancesRequest prepareEC2RequestNode( Map<String,String> targetProperties, String userData )
	throws UnsupportedEncodingException {

		RunInstancesRequest runInstancesRequest = new RunInstancesRequest();
		String flavor = targetProperties.get(Ec2Constants.VM_INSTANCE_TYPE);
		if( Utils.isEmptyOrWhitespaces( flavor ))
			flavor = "t1.micro";

		runInstancesRequest.setInstanceType( flavor );
		runInstancesRequest.setImageId( targetProperties.get( Ec2Constants.AMI_VM_NODE ));

		runInstancesRequest.setMinCount( 1 );
		runInstancesRequest.setMaxCount( 1 );
		runInstancesRequest.setKeyName( targetProperties.get(Ec2Constants.SSH_KEY_NAME));

		String secGroup = targetProperties.get(Ec2Constants.SECURITY_GROUP_NAME);
		if( Utils.isEmptyOrWhitespaces(secGroup))
			secGroup = "default";

		runInstancesRequest.setSecurityGroups(Collections.singletonList(secGroup));

		String availabilityZone = targetProperties.get(Ec2Constants.AVAILABILITY_ZONE);
		if(! Utils.isEmptyOrWhitespaces(availabilityZone))
			runInstancesRequest.setPlacement(new Placement(availabilityZone));

		// The following part enables to transmit data to the VM.
		// When the VM is up, it will be able to read this data.
		String encodedUserData = new String( Base64.encodeBase64( userData.getBytes( StandardCharsets.UTF_8 )), "UTF-8" );
		runInstancesRequest.setUserData( encodedUserData );

		return runInstancesRequest;
	}
1117026
public JSONObject userCopy(String userId, HashMap<String, String> options) {
        AipRequest request = new AipRequest();
        preOperation(request);
        
        request.addBody("user_id", userId);
        if (options != null) {
            request.addBody(options);
        }
        request.setUri(FaceConsts.USER_COPY);
        request.setBodyFormat(EBodyFormat.RAW_JSON);
        postOperation(request);
        return requestServer(request);
    }
499282
public RequestResponse setResponseData(byte[] responseData) {
        this.responseData = responseData;
        try {
            responseJson = responseData != null ? SerializationUtils.readJson(responseData) : null;
        } catch (Exception e) {
            responseJson = null;
            LOGGER.error(e.getMessage(), e);
        }
        return this;
    }
827074
public void afterPropertiesSet() throws Exception {
        if (target == null) {
            throw new IllegalArgumentException(
                    "Property 'target' must be set.'");
        }

        if (defaultUser == null) {
            throw new IllegalArgumentException(
                    "Property 'defaultUser' must be set.'");
        }

        if (defaultPassword == null) {
            throw new IllegalArgumentException(
                    "Property 'defaultPassword' must be set.'");
        }
    }
181077
public void connectUsingTrmWithTargetData(String targetType, String targetSignificance, String target)
                    throws ResourceException
    {
        final String methodName = "connectUsingTrmWithTargetData";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, new Object[] { targetType, targetSignificance, target });
        }

        synchronized (_connections)
        {
            // At this point in the code path we can be sure that:
            // 1. There are no local preferred ME's (this method would not be called if there were)
            // 2. Target data has been set (we are in the else block of the "if (target == null)" block
            // 
            // Since we have been passed target data it means we are attempting to create a connection
            // to a preferred (or required) ME (no target data is ever passed if we are trying to create
            // a connection to a non preferred ME). With this in mind, if we are currently connected to
            // a non preferred ME (_connectToPreferred is false) or we do not currently have a connection
            // then we'll try and create a connection that matches our target data. If a connection
            // is created then we should close any non preferred connections (if they are any).
            if ((!_connectedToPreferred) || (_connections.size() == 0))
            {
                // Set to required (even if user opted for preferred)
                // Pass targetType and target from user data.
                SibRaMessagingEngineConnection newConnection = null;
                try
                {
                    newConnection = new SibRaMessagingEngineConnection(this, _endpointConfiguration.getBusName(),
                                    targetType, SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED, target);

                    dropNonPreferredConnections();

                    if (newConnection.getConnection() != null) {
                        _connections.put(newConnection.getConnection().getMeUuid(), newConnection);
                        createListener(newConnection);

                    }

                    if (_connections.size() > 0)
                    {
                        _connectedRemotely = checkIfRemote(_connections.values()
                                        .iterator().next());
                        _connectedToPreferred = true;

                        if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
                        {
                            SibTr.debug(TRACE, "We have connect <remote=" + _connectedRemotely + " > <preferred="
                                               + _connectedToPreferred + ">");
                        }
                    }
                } catch (final SIResourceException exception)
                {
                    // No FFDC code needed
                    // We are potentially connecting remotely so this error may be transient
                    // Possibly the remote ME is not available
                    SibTr.warning(TRACE, SibTr.Suppressor.ALL_FOR_A_WHILE, "TARGETTED_CONNECTION_FAILED_CWSIV0787",
                                  new Object[] { targetType, targetSignificance, target, _endpointConfiguration.getBusName() });
                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
                    {
                        SibTr.debug(TRACE, "Failed to obtain a connection - retry after a set interval");
                    }
                } catch (final SIException exception)
                {
                    FFDCFilter.processException(exception, CLASS_NAME + "." + methodName, "1:711:1.45", this);

                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled())
                    {
                        SibTr.exception(this, TRACE, exception);
                    }

                    throw new ResourceException(NLS.getFormattedMessage("CONNECT_FAILED_CWSIV0782", new Object[] {
                                                                                                                  _endpointConfiguration.getDestination().getDestinationName(),
                                                                                                                  _endpointConfiguration.getBusName(), this, exception }, null), exception);
                }
            }
        } // Sync block

        // Failed to get a preferred one, try for any ME next.
        // Also if we have connected to a remote non preferred ME we may wish to try again for a local
        // non preferred ME (We know there is not a local preferred ME as we would not be in this
        // method if there were).
        if (((_connections.size() == 0) || (_connectedRemotely && !_connectedToPreferred && _destinationStrategy
                        .isDropRemoteNonPreferredForLocalNonPreferred()))
            && (targetSignificance.equals(SibTrmConstants.TARGET_SIGNIFICANCE_PREFERRED)))
        {
            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
            {
                SibTr.debug(TRACE,
                            "Could not obtain the preferred connection - try again without any target preferences");
            }
            // For durable pub sub there are no local preferred MEs, for point to point and non durable pub
            // sub then they all count as preferred
            connect(_destinationStrategy.isDurablePubsSub() ? null : getMEsToCheck(), null, null, null, false);
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(TRACE, methodName);
        }
    }
1226535
public static AsyncWork<Properties, Exception> loadPropertiesFile(
		IO.Readable input, Charset charset, byte priority, IO.OperationType closeInputAtEnd, Listener<Properties> onDone
	) {
		if (!(input instanceof IO.Readable.Buffered))
			input = new PreBufferedReadable(input, 512, priority, 1024, priority, 16);
		return loadPropertiesFile((IO.Readable.Buffered)input, charset, priority, closeInputAtEnd, onDone);
	}
1172863
public void appendUserAgent(String userAgent) {
        String marker = markers.get(Marker.USER_AGENT);
        if (marker == null)
            marker = "";
        marker = createUserAgentMarkerString(marker, userAgent);
        putClientMarker(Marker.USER_AGENT, marker);
    }
523216
static NovaApi novaApi( Map<String,String> targetProperties ) throws TargetException {

		validate( targetProperties );
		return ContextBuilder
				.newBuilder( PROVIDER_NOVA )
				.endpoint( targetProperties.get( API_URL ))
				.credentials( identity( targetProperties ), targetProperties.get( PASSWORD ))
				.buildApi( NovaApi.class );
	}
306047
@Nonnull
  @OverrideOnDemand
  protected UserDataObject getUserDataObject (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
                                              @Nonnull final String sFilename)
  {
    // URL decode is required because requests contain e.g. "%20"
    final String sFilename1 = URLHelper.urlDecode (sFilename);

    return new UserDataObject (sFilename1);
  }
810192
private static byte[] getRequestBody(String appId, String cpId, String privateKey, GameUserData userData) {
        Map<String,String> params = getParamMap(appId, cpId, userData);
        params.put("cpSign", RSAUtil.sign(getSignData(params), privateKey));

        StringBuilder strBody = new StringBuilder();
        Set<Map.Entry<String, String>> paramSet = params.entrySet();
        boolean isFirstParm = true;
        for (Map.Entry<String, String> param : paramSet) {
            if (param != null) {
                if (!TextUtils.isEmpty(param.getValue()))
                {
                    strBody.append(isFirstParm?"":"&").append(param.getKey()).append('=').append(RSAUtil.urlEncode(param.getValue()));
                    isFirstParm = false;
                }
            }
        }

        try
        {
            return strBody.toString().getBytes("UTF-8");
        }
        catch (UnsupportedEncodingException e)
        {
            return new byte[0];
        }
    }
1042011
private void setRequestLanguages(WbGetEntitiesActionData properties) {
		if (this.filter.excludeAllLanguages()
				|| this.filter.getLanguageFilter() == null) {
			return;
		}
		properties.languages = ApiConnection.implodeObjects(this.filter
				.getLanguageFilter());
	}
248879
@SuppressWarnings("resource")
	public static AsyncWork<Properties, Exception> loadPropertiesFile(
		IO.Readable.Buffered input, Charset charset, byte priority, IO.OperationType closeInputAtEnd, Listener<Properties> onDone
	) {
		BufferedReadableCharacterStream cs = new BufferedReadableCharacterStream(input, charset, 512, 32);
		return loadPropertiesFile(cs, priority, closeInputAtEnd, onDone);
	}
308150
@Override
    public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
        if (isConversionSupported(targetEncoding, sourceFormat)) {
            return m_targetFormats.toArray(EMPTY_FORMAT_ARRAY);
        } else {
            return EMPTY_FORMAT_ARRAY;
        }
    }
157655
@Override
  public final SeServiceSpecifics process(
    final Map<String, Object> pReqVars,
      final SeServiceSpecifics pEntity,
        final IRequestData pRequestData) throws Exception {
    SeSeller ses = this.findSeSeller.find(pReqVars, pRequestData.getUserName());
    pEntity.setSeller(ses);
    SeServiceSpecifics entOld = this.srvOrm.retrieveEntity(pReqVars, pEntity);
    if (!entOld.getSeller().getItsId().getItsId()
      .equals(pEntity.getSeller().getItsId().getItsId())) {
      throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN,
      "Attempt to update smb. else's entity: user/entity/EID/SEOLDID/SEID - "
        + pRequestData.getUserName() + "/" + pEntity.getClass()
         .getSimpleName() + "/" + pEntity.getItsId() + "/" + entOld
          .getSeller().getItsId().getItsId() + "/" + pEntity.getSeller()
            .getItsId().getItsId());
    }
    String fileToUploadName = (String) pRequestData
      .getAttribute("fileToUploadName");
    OutputStream outs = null;
    InputStream ins = null;
    try {
      String filePath;
      if (pEntity.getStringValue1() == null) { //in base language:
        String ft = String.valueOf(new Date().getTime());
        filePath = this.webAppPath + File.separator
          + this.uploadDirectory + File.separator
            + ft + fileToUploadName;
        pEntity.setStringValue2(filePath);
        pEntity.setStringValue1(this.uploadDirectory
              + "/" + ft + fileToUploadName);
      } else { //I18N files:
        String fileLang = pRequestData.getParameter("fileLang");
        if (pEntity.getStringValue3() == null
          || !pEntity.getStringValue3().contains(fileLang)) {
          throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
            "notset_language");
        }
        int idhHtml = pEntity.getStringValue1().indexOf(".html");
        String urlWithoutHtml = pEntity.getStringValue1().substring(0, idhHtml);
        filePath = this.webAppPath + File.separator
          + urlWithoutHtml + "_" + fileLang + ".html";
      }
      ins = (InputStream) pRequestData.getAttribute("fileToUploadInputStream");
      outs = new BufferedOutputStream(new FileOutputStream(filePath));
      byte[] data = new byte[1024];
      int count;
      while ((count = ins.read(data)) != -1) {
        outs.write(data, 0, count);
      }
      outs.flush();
    } finally {
      if (ins != null) {
        ins.close();
      }
      if (outs != null) {
        outs.close();
      }
    }
    getSrvOrm().updateEntity(pReqVars, pEntity);
    return pEntity;
  }
689632
function(items, userData) {

		var selfHostingConfig = this._siteClient.getSelfHostingConfig();

		var self = this;
		var dialog = new ConvertToSelfHostingDialog({
			serviceRegistry: this.serviceRegistry,
			fileClient: this.fileClient,
			siteClient: this._siteClient,
			selfHostingConfig: selfHostingConfig,
			func: function(folderInfos) {
				var folderLocations = folderInfos.map(function(folderInfo) {
					return folderInfo.folder.Location;
				});
				self._siteClient.convertToSelfHosting(self.getSiteConfiguration(), folderLocations).then(
					function(updatedSite) {
						self.mappings.deleteAllMappings();
						self.mappings.addMappings(updatedSite.Mappings);
						self.save();
					});
			}
		});
		dialog.show();
	}
715169
public static String getUrlParamsByMap(Map<String, String> data) throws UnsupportedEncodingException {
        if (data == null || data.isEmpty()) return null;

        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String, String> i : data.entrySet()) {

            sb.append(i.getKey())
                    .append("=")
                    .append(URLEncoder.encode(i.getValue(), Charset.UTF_8))
                    .append("&");

        }
        String str = sb.toString();

        return str.substring(0, str.length() - 1);
    }
1082276
public function prepareRequestBody($requestData)
    {
        $options = [
            CURLOPT_URL            => $requestData['url'],
            CURLOPT_TIMEOUT        => $requestData['timeout'],
            CURLOPT_USERAGENT      => $requestData['user_agent'],
            CURLOPT_USERPWD        => $requestData['user_login'],
            CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,
            CURLOPT_ENCODING       => 'gzip',
            CURLOPT_HTTPHEADER     => [
                'Content-Type: text/xml',
                // Workaround to prevent cURL from parsing HTTP 100 as separate request
                'Expect:'
            ],
            CURLOPT_HEADER         => true,
            CURLOPT_FAILONERROR    => true,
            CURLOPT_FRESH_CONNECT  => true,
            CURLOPT_RETURNTRANSFER => true,
            // SSL/TLS Configuration
            CURLOPT_CAINFO         => $requestData['ca_bundle'],
            CURLOPT_SSL_VERIFYPEER => true,
            CURLOPT_SSL_VERIFYHOST => 2
        ];

        if ('POST' == strtoupper($requestData['type'])) {
            $post = [
                CURLOPT_POST       => true,
                CURLOPT_POSTFIELDS => $requestData['body']
            ];

            $options = $options + $post;
        }

        curl_setopt_array($this->curlHandle, $options);
    }