private void fillPayload ( InternalRequest internalRequest , AbstractBceRequest bceRequest ) { if ( internalRequest . getHttpMethod ( ) == HttpMethodName . POST || internalRequest . getHttpMethod ( ) == HttpMethodName . PUT ) { String strJson = JsonUtils . toJsonString ( bceRequest ) ; byte [ ] requestJson = null ; try { requestJson = strJson . getBytes ( DEFAULT_ENCODING ) ; } catch ( UnsupportedEncodingException e ) { throw new BceClientException ( "Unsupported encode." , e ) ; } internalRequest . addHeader ( Headers . CONTENT_LENGTH , String . valueOf ( requestJson . length ) ) ; internalRequest . addHeader ( Headers . CONTENT_TYPE , DEFAULT_CONTENT_TYPE ) ; internalRequest . setContent ( RestartableInputStream . wrap ( requestJson ) ) ; } }
The method to fill the internalRequest s content field with bceRequest . Only support HttpMethodName . POST or HttpMethodName . PUT