import com.twilio.http.HttpMethod;
import com.twilio.http.Request;
import com.twilio.http.Response;
import com.twilio.http.TwilioRestClient;
import com.twilio.rest.Domains;
import com.twilio.Twilio;

import org.json.JSONObject;


public class Example {
    // Find your Account Sid and Token at twilio.com/console
    public static final String API_KEY_SID = "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String API_KEY_SECRET = "your_api_key_secret";

    public static void main(String args[]) {

        // Initialize the client
        Twilio.init(API_KEY_SID, API_KEY_SECRET);

        String recordingSid = "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        TwilioRestClient restClient = Twilio.getRestClient();
        Request request = new Request(
                HttpMethod.GET,
                Domains.VIDEO.toString(),
                "/v1/Recordings/" + recordingSid + "/Media/",
                restClient.getRegion()
        );
        Response response = restClient.request(request);
        JSONObject json = new JSONObject(response.getStream());
        String mediaLocation = json.getString("location");

        System.out.println(mediaLocation);
    }
}

@@ -28,16 +28,58 @@
 Method;%0A
+import com.twilio.http.NetworkHttpClient;%0A
 import c
@@ -219,54 +219,148 @@
 ort 
-com.twilio.Twilio;%0A%0Aimport org.json.JSONObject
+org.apache.commons.io.IOUtils;%0Aimport org.apache.http.impl.client.HttpClientBuilder;%0Aimport org.json.JSONObject;%0A%0Aimport java.io.IOException
 ;%0A%0A%0A
@@ -645,94 +645,479 @@
 %5B%5D) 
-%7B%0A%0A        // Initialize the client%0A        Twilio.init(API_KEY_SID, API_KEY_SECRET);%0A
+throws IOException %7B%0A        // Disable HttpClient follow redirect by default%0A        HttpClientBuilder clientBuilder = HttpClientBuilder.create();%0A        clientBuilder.disableRedirectHandling();%0A%0A        // Initialize the client%0A        TwilioRestClient restClient = new TwilioRestClient%0A                .Builder(API_KEY_SID, API_KEY_SECRET)%0A                .httpClient(new NetworkHttpClient(clientBuilder))%0A                .build();%0A%0A        // Retrieve media location
 %0A   
@@ -1185,70 +1185,8 @@
 X%22;%0A
-        TwilioRestClient restClient = Twilio.getRestClient();%0A
     
@@ -1520,14 +1520,15 @@
 .get
-Stream
+Content
 ());
@@ -1579,17 +1579,296 @@
 ng(%22
-location%22
+redirect_to%22);%0A%0A        // Retrieve media content%0A        String mediaContent = org.apache.http.client.fluent.Request%0A                .Get(mediaLocation)%0A                .execute()%0A                .handleResponse((r) -%3E%0A                        IOUtils.toString(r.getEntity().getContent())
 );%0A%0A
@@ -1899,24 +1899,23 @@
 ln(media
-Location
+Content
 );%0A    %7D

Fix Java room recording media snippet