// create headers parameter for JNI call
create headers parameter for JNI call
create headers parameter for JNI call
fn create_headers_param<'a>(
    env: &JNIEnv<'a>,
    headers: &HeaderMap,
) -> JValue<'a> {
    let hdr_obj = env.new_object("java/util/HashMap", "()V", &[]).unwrap();
    for (name, value) in headers.iter() {
        let name_str = env.new_string(name.as_str()).unwrap();
        let value_str = env.new_string(value.to_str().unwrap()).unwrap();
        env.call_method(
            hdr_obj,
            "put",
            "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
            &[JValue::Object(*name_str), JValue::Object(*value_str)],
        )
        .unwrap();
        env.delete_local_ref(*name_str).unwrap();
        env.delete_local_ref(*value_str).unwrap();
    }
    JValue::Object(hdr_obj)
}
fn create_headers_param < ' a > ( env : & JNIEnv < ' a > , headers : & HeaderMap , ) -> JValue < ' a > { let hdr_obj = env . new_object ( " " , " " , & [ ] ) . unwrap ( ) ; for ( name , value ) in headers . iter ( ) { let name_str = env . new_string ( name . as_str ( ) ) . unwrap ( ) ; let value_str = env . new_string ( value . to_str ( ) . unwrap ( ) ) . unwrap ( ) ; env . call_method ( hdr_obj , " " , " " , & [ JValue :: Object ( * name_str ) , JValue :: Object ( * value_str ) ] , ) . unwrap ( ) ; env . delete_local_ref ( * name_str ) . unwrap ( ) ; env . delete_local_ref ( * value_str ) . unwrap ( ) ; } JValue :: Object ( hdr_obj ) }
create headers parameter for JNI call
create headers parameter for JNI call
env
&JNIEnv<'a>
headers
&HeaderMap