Used to encode the request content using the Jackson JSON encoder.

@param config the configuration
@param ts the server request content accessor
435985
@SuppressWarnings("WeakerAccess")
    public static void encode(final ChainedHttpConfig config, final ToServer ts) {
        try {
            if (handleRawUpload(config, ts)) {
                return;
            }

            final ChainedHttpConfig.ChainedRequest request = config.getChainedRequest();
            final ObjectMapper mapper = (ObjectMapper) config.actualContext(request.actualContentType(), OBJECT_MAPPER_ID);
            final StringWriter writer = new StringWriter();
            mapper.writeValue(writer, request.actualBody());
            ts.toServer(new CharSequenceInputStream(writer.toString(), request.actualCharset()));
        } catch (IOException e) {
            throw new TransportingException(e);
        }
    }
746512
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (FacesContext.getCurrentInstance().isPostback()) {
			ResponseWriter writer = context.getResponseWriter();
			writer.writeText("\n", null);
			writer.startElement("script", component);
			writer.write("if (window.jsfScope) {\n");
			List<String> beansAsJSon = PuiModelSync.getFacesModel();
			for (String bean : beansAsJSon) {
				writer.write("puiUpdateModel(" + bean + ");");
			}
			writer.writeText("\n}", null);
			writer.endElement("script");
		}
	}
1316262
public static void toStream(final HttpConfig config, final String contentType, final OutputStream ostream) {
        config.context(contentType, ID, ostream);
        config.getResponse().parser(contentType, Download::streamParser);
    }
1323174
public void setConfig(Config config) {
        if (mapperHelper == null) {
            mapperHelper = new MapperHelper();
        }
        mapperHelper.setConfig(config);
    }
890669
protected void updateHttpConfig(Builder httpClientConfig, Map<String, String> config) {
        String username = config.get("client.username"); //$NON-NLS-1$
        String password = config.get("client.password"); //$NON-NLS-1$
        String timeout = config.get("client.timeout"); //$NON-NLS-1$
        if (StringUtils.isBlank(timeout)) {
            timeout = "10000"; //$NON-NLS-1$
        }

        httpClientConfig
            .connTimeout(new Integer(timeout))
            .readTimeout(new Integer(timeout))
            .maxTotalConnection(75)
            .defaultMaxTotalConnectionPerRoute(75)
            .multiThreaded(true);
        if (!StringUtils.isBlank(username)) {
            httpClientConfig.defaultCredentials(username, password);
        }

        if ("https".equals(config.get("protocol"))) { //$NON-NLS-1$ //$NON-NLS-2$
            updateSslConfig(httpClientConfig, config);
        }
    }
1302687
function convertConfig(jsonConfig) {
  var bunyanConfig = extend({}, jsonConfig);

  if (Array.isArray(bunyanConfig.streams)) {
    bunyanConfig.streams = bunyanConfig.streams.map(convertStream);
  }

  if (bunyanConfig.serializers) {
    bunyanConfig.serializers = convertSerializers(bunyanConfig.serializers);
  }

  return bunyanConfig;
}
10952
function(config) {
  config = config || {};

  config.headers = config.headers || {};
  if (!config.headers.Accept) {
    config.headers.Accept = 'application/hal+json, application/json; q=0.5';
  }

  if (!config.baseUrl) {
    throw new Error('HttpClient needs a `baseUrl` configuration property.');
  }

  Events.attach(this);

  this.config = config;
}
696140
public static synchronized void configure(final ApiConfiguration config) {
		
		ApiConfiguration.Builder builder = ApiConfiguration.newBuilder();
		
		builder.apiUrl(config.getApiUrl());
		builder.apiKey(config.getApiKey());
		builder.application(config.getApplication());
		builder.environment(config.getEnvironment());
		
		if (config.getEnvDetail() == null)
		{
			builder.envDetail(EnvironmentDetails.getEnvironmentDetail(config.getApplication(), config.getEnvironment()));
		}
		else
		{
			builder.envDetail(config.getEnvDetail());
		}
		
		CONFIG = builder.build();
	}
516803
public void encodeData(AsnOutputStream asnOs) throws MAPException {

        if (this.imsi == null && this.msisdn == null)
            throw new MAPException("Error while encoding " + _PrimitiveName + ": all choices must not be null");
        if (this.imsi != null && this.msisdn != null)
            throw new MAPException("Error while encoding " + _PrimitiveName + ": all choices must not be not null");

        if (this.imsi != null) {
            ((IMSIImpl) this.imsi).encodeData(asnOs);
        } else {
            ((ISDNAddressStringImpl) this.msisdn).encodeData(asnOs);
        }
    }
490609
public void encode(AsnOutputStream aos) throws EncodeException {

        if (resultType == null)
            throw new EncodeException("Error encoding Result: ResultType must not be null");

        try {
            aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG);
            int pos = aos.StartContentDefiniteLength();
            aos.writeInteger(this.resultType.getType());
            aos.FinalizeContent(pos);

        } catch (IOException e) {
            throw new EncodeException("IOException while encoding Result: " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new EncodeException("AsnException while encoding Result: " + e.getMessage(), e);
        }
    }
713867
public void encode(AsnOutputStream aos) throws EncodeException {

        if (this.originatingTransactionId == null || this.originatingTransactionId.length != 4)
            throw new EncodeException("Error while encoding TCQueryMessage: originatingTransactionId is not defined or has not a length 4");

        if ((this.component == null || this.component.length == 0) && this.dp == null)
            throw new EncodeException("Error while encoding TCQueryMessage: neither dialogPortion nor componentPortion is defined");

        try {
            if (this.dialogTermitationPermission)
                aos.writeTag(Tag.CLASS_PRIVATE, false, TCQueryMessage._TAG_QUERY_WITH_PERM);
            else
                aos.writeTag(Tag.CLASS_PRIVATE, false, TCQueryMessage._TAG_QUERY_WITHOUT_PERM);
            int pos = aos.StartContentDefiniteLength();

            aos.writeOctetString(Tag.CLASS_PRIVATE, TCQueryMessage._TAG_TRANSACTION_ID, this.originatingTransactionId);

            if (this.dp != null)
                this.dp.encode(aos);

            if (component != null && component.length > 0) {
                aos.writeTag(Tag.CLASS_PRIVATE, false, TCQueryMessage._TAG_COMPONENT_SEQUENCE);
                int pos2 = aos.StartContentDefiniteLength();
                for (Component c : this.component) {
                    c.encode(aos);
                }
                aos.FinalizeContent(pos2);
            }

            aos.FinalizeContent(pos);

        } catch (IOException e) {
            throw new EncodeException("IOException while encoding TCQueryMessage: " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new EncodeException("AsnException while encoding TCQueryMessage: " + e.getMessage(), e);
        }

    }
367792
public byte[] convertToXmlByteArray(BucketTaggingConfiguration config) throws SdkClientException {

        XmlWriter xml = new XmlWriter();
        xml.start("Tagging");

        for (TagSet tagset : config.getAllTagSets()) {
            writeRule(xml, tagset);
        }

        xml.end();

        return xml.getBytes();
    }
1050312
public static <T> T withJsonString(String jsonString,
            TypeReference<T> typeReference) {
        return withBytes(jsonString.getBytes(), typeReference);
    }
637641
@SuppressWarnings("unchecked")
    public static <T> T json2GenericObject(String jsonString,
                                           TypeReference<T> tr) {

        if (jsonString == null || "".equals(jsonString)) {
            return null;
        } else {
            try {
                return (T) objectMapper.readValue(jsonString, tr);
            } catch (Exception e) {
                log.warn("json error:" + e.getMessage());
            }
        }
        return null;
    }
1033178
@Override
	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
		if (!component.isRendered()) {
			return;
		}
		RemoteCommand remoteCommand = (RemoteCommand) component;
		ResponseWriter rw = context.getResponseWriter();
		String clientId = remoteCommand.getClientId();

		String parameters=remoteCommand.getParameters();
		String parametersAsJson=null;
		if (null != parameters && parameters.length()>0) {
			parametersAsJson = "";
			String[] params = parameters.split(",");
			for (String p: params) {
				p=p.trim();
				parametersAsJson += "'" + p + "':" + p + ",";
			}
			parametersAsJson=parametersAsJson.substring(0, parametersAsJson.length()-1);
		}
		StringBuilder call = AJAXRenderer.generateAJAXCall(context, remoteCommand, null, parametersAsJson);
		String name = remoteCommand.getName();
		if (null == name) {
			throw new FacesException("b:remoteCommand: Please define the name of the JavaScript function calling the Java backend.");
		}
			
		rw.startElement("script", component);
		rw.writeAttribute("id", clientId, null);
		String c = call.toString().replace("callAjax(this,", "callAjax(document.getElementById('" + clientId + "'),");
		if (parameters!=null) {
			rw.append("function " + name + "(" + parameters + ", event){" + c + "}");
		} else {
			rw.append("function " + name + "(event){" + c + "}");
		}
		rw.endElement("script");

	}
433173
@SuppressWarnings({"unchecked"})
    public <T> T read(String json, Configuration configuration) {
        notEmpty(json, "json can not be null or empty");
        notNull(configuration, "jsonProvider can not be null");

        return read(configuration.jsonProvider().parse(json), configuration);
    }
659612
public void encodeData(AsnOutputStream asnOs) throws MAPException {

        if (this.requestorIDString == null)
            throw new MAPException("nameString must not be null");

        try {
            asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_DATA_CODING_SCHEME,
                    new byte[] { (byte) this.dataCodingScheme.getCode() });

            ((USSDStringImpl) this.requestorIDString).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_NAME_STRING);

            if (this.lcsFormatIndicator != null) {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_FORMAT_INDICATOR,
                        this.lcsFormatIndicator.getIndicator());
            }
        } catch (IOException e) {
            throw new MAPException("IOException when encoding " + _PrimitiveName + "", e);
        } catch (AsnException e) {
            throw new MAPException("AsnException when encoding " + _PrimitiveName + "", e);
        }
    }