DelegatingHttpsURLConnection(HttpURLConnection delegate) { super(delegate.getURL()); this.delegate = delegate; }
@Override public URL getURL() { return delegate.getURL(); }
DelegatingHttpsURLConnection(HttpURLConnection delegate) { super(delegate.getURL()); this.delegate = delegate; }
@Override public URL getURL() { return delegate.getURL(); }
@Override public URI getURI() { try { return this.connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
@Override public URI getURI() { try { return this.connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
@Override public URI getURI() { try { return this.connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
@Override public URI getURI() { try { return this.connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException( "Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
@Override public @Nullable Uri getUri() { return connection == null ? null : Uri.parse(connection.getURL().toString()); }
private URL tryToResolveRedirects(URL base, String authorization) { try { HttpURLConnection con = (HttpURLConnection) base.openConnection(); if (authorization != null) { con.addRequestProperty("Authorization", authorization); } con.getInputStream().close(); base = con.getURL(); } catch (Exception ex) { // Do not obscure the problem propagating the exception. If the problem is real it will manifest during the // actual exchange so will be reported properly there. If it is not real (no permission in UI but sufficient // for CLI connection using one of its mechanisms), there is no reason to bother user about it. LOGGER.log(Level.FINE, "Failed to resolve potential redirects", ex); } return base; }
@Override public URI getURI() { try { return this.connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException( "Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
@Override public URI getURI() { try { return this.connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
@Override public URI getURI() { try { return this.connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
@Override public URI getURI() { try { return this.connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
@Override public void configureLogoutConnection(HttpURLConnection connection) { if (connection.getURL().getProtocol().equalsIgnoreCase("https")) { HttpsURLConnection secureConnection = (HttpsURLConnection) connection; this.logoutConnectionConfigurator.accept(secureConnection); } } }
public URLConnectionInspectorResponse(String requestId, HttpURLConnection conn) throws IOException { super(Util.convertHeaders(conn.getHeaderFields())); mRequestId = requestId; mUrl = conn.getURL().toString(); mStatusCode = conn.getResponseCode(); mStatusMessage = conn.getResponseMessage(); }
@Override public void run() { try { fileUtils = ProxyFileUtils.getInstance(mContext, request.getURL().toURI(), true); processRequest(request, client); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } }
public URLConnectionInspectorRequest( String requestId, String friendlyName, HttpURLConnection configuredRequest, @Nullable SimpleRequestEntity requestEntity, RequestBodyHelper requestBodyHelper) { super(Util.convertHeaders(configuredRequest.getRequestProperties())); mRequestId = requestId; mFriendlyName = friendlyName; mRequestEntity = requestEntity; mRequestBodyHelper = requestBodyHelper; mUrl = configuredRequest.getURL().toString(); mMethod = configuredRequest.getRequestMethod(); }
@Test public void testBuildsClientTokenIfNeeded() throws Exception { GraphRequest requestMe = new GraphRequest(null, "TourEiffel"); HttpURLConnection connection = GraphRequest.toHttpConnection(requestMe); assertTrue(connection != null); Uri uri = Uri.parse(connection.getURL().toString()); String accessToken = uri.getQueryParameter("access_token"); assertNotNull(accessToken); assertTrue(accessToken.contains(FacebookSdk.getApplicationId())); assertTrue(accessToken.contains(FacebookSdk.getClientToken())); } }
@Test public void testSingleGetToHttpRequest() throws Exception { GraphRequest requestMe = new GraphRequest(null, "TourEiffel"); HttpURLConnection connection = GraphRequest.toHttpConnection(requestMe); assertTrue(connection != null); assertEquals("GET", connection.getRequestMethod()); assertEquals("/" + FacebookSdk.getGraphApiVersion() + "/TourEiffel", connection.getURL().getPath()); assertTrue(connection.getRequestProperty("User-Agent").startsWith("FBAndroidSDK")); Uri uri = Uri.parse(connection.getURL().toString()); assertEquals("android", uri.getQueryParameter("sdk")); assertEquals("json", uri.getQueryParameter("format")); }