@ 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 ) ; } }
Used to encode the request content using the Jackson JSON encoder .