private String getRequestTrace() { StringBuilder trace = new StringBuilder(); trace.append("\n==== Original request:\n"); trace.append(originalRequest); trace.append("\n===="); int i = 1; for (Pair<HttpRequest, HttpResponse> event : requestTrace) { trace.append("\n==== Sent request ").append(i).append(":\n"); if (event.one != null) { trace.append(filterSecrets(event.one.toString())); } trace.append("\n==== Received response ").append(i).append(":\n"); if (event.two != null) { trace.append(filterSecrets(event.two.toString())); } trace.append("\n===="); ++i; } return trace.toString(); }
private String getRequestTrace() { StringBuilder trace = new StringBuilder(); trace.append("\n==== Original request:\n"); trace.append(originalRequest); trace.append("\n===="); int i = 1; for (Pair<HttpRequest, HttpResponse> event : requestTrace) { trace.append("\n==== Sent request ").append(i).append(":\n"); if (event.one != null) { trace.append(filterSecrets(event.one.toString())); } trace.append("\n==== Received response ").append(i).append(":\n"); if (event.two != null) { trace.append(filterSecrets(event.two.toString())); } trace.append("\n===="); ++i; } return trace.toString(); }
private String getRequestTrace() { StringBuilder trace = new StringBuilder(); trace.append("\n==== Original request:\n"); trace.append(originalRequest); trace.append("\n===="); int i = 1; for (Pair<HttpRequest, HttpResponse> event : requestTrace) { trace.append("\n==== Sent request ").append(i).append(":\n"); if (event.one != null) { trace.append(filterSecrets(event.one.toString())); } trace.append("\n==== Received response ").append(i).append(":\n"); if (event.two != null) { trace.append(filterSecrets(event.two.toString())); } trace.append("\n===="); ++i; } return trace.toString(); }
private static String getRequestTrace(final List<Pair<HttpRequest, HttpResponse>> requestTrace) { final StringBuilder trace = new StringBuilder(); int i = 1; for (final Pair<HttpRequest, HttpResponse> event : requestTrace) { trace.append("\n==== Sent request ").append(i).append(":\n"); if (event.one != null) { trace.append(FilteredLogger.filterSecrets(event.one.toString())); } trace.append("\n==== Received response ").append(i).append(":\n"); if (event.two != null) { trace.append(FilteredLogger.filterSecrets(event.two.toString())); } trace.append("\n===="); ++i; } return trace.toString(); } }
System.out.println(request.toString()); System.out.println("Response -----------------------------"); System.out.println(response.toString());
} catch (IOException ioe) { if (LOG.isLoggable(Level.WARNING)) { LOG.logp(Level.WARNING, classname, "rewrite", MessageKeys.IO_ERROR_REWRITING_IMG, new Object[] {request.toString(),ioe.getMessage()}); LOG.logp(Level.INFO, classname, "rewrite", MessageKeys.UNKNOWN_ERROR_REWRITING_IMG, new Object[] {request.toString(),re.getMessage()}); LOG.logp(Level.INFO, classname, "rewrite", MessageKeys.FAILED_TO_READ_IMG, new Object[] {request.toString(),ire.getMessage()});
System.out.println(request.toString()); System.out.println("Response -----------------------------"); System.out.println(response.toString());
System.out.println(request.toString()); System.out.println("Response -----------------------------"); System.out.println(response.toString());
@Test public void testStripSecretsFromRequestUrl() { HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/access?param=foo&openso" + "cial_owner_id=owner&opensocial_viewer_id=owner&opensocial_app_id=app&" + "oauth_session_handle" + "=http%3A%2F%2Fwww.example.com%2Fgadget.xml&oauth_version=1.0&oauth_timestamp=12" + "31461132&oauth_consumer_key=consumer&oauth_signature_method=HMAC-SHA1&oauth_nonce=1" + "231461160262578000&oauth_signature=HuFQ%2BRYTrRzcgsi3al6ld9Msvoo%3D")); String filtered = OAuthResponseParams.filterSecrets(req.toString()); checkStringContains(filtered, "oauth_session_handle=REMOVED"); }
LOG.log(Level.WARNING, "IO Error rewriting image " + request.toString() + " - " + ioe.getMessage()); } catch (RuntimeException re) { LOG.log(Level.INFO, "Unknown error rewriting image " + request.toString(), re); } catch (ImageReadException ire) { LOG.log(Level.INFO, "Failed to read image. Skipping " + request.toString(), ire.getMessage());
LOG.log(Level.WARNING, "IO Error rewriting image " + request.toString() + " - " + ioe.getMessage()); } catch (RuntimeException re) { LOG.log(Level.INFO, "Unknown error rewriting image " + request.toString(), re); } catch (ImageReadException ire) { LOG.log(Level.INFO, "Failed to read image. Skipping " + request.toString(), ire.getMessage());
@Test public void testStripSecretsFromRequestUrl() { HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/access?param=foo&openso" + "cial_owner_id=owner&opensocial_viewer_id=owner&opensocial_app_id=app&" + "oauth_session_handle" + "=http%3A%2F%2Fwww.example.com%2Fgadget.xml&oauth_version=1.0&oauth_timestamp=12" + "31461132&oauth_consumer_key=consumer&oauth_signature_method=HMAC-SHA1&oauth_nonce=1" + "231461160262578000&oauth_signature=HuFQ%2BRYTrRzcgsi3al6ld9Msvoo%3D")); String filtered = OAuthResponseParams.filterSecrets(req.toString()); checkStringContains(filtered, "oauth_session_handle=REMOVED"); }
@Test public void testStripSecretsFromRequestUrl() { HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/access?param=foo&openso" + "cial_owner_id=owner&opensocial_viewer_id=owner&opensocial_app_id=app&" + "oauth_session_handle" + "=http%3A%2F%2Fwww.example.com%2Fgadget.xml&oauth_version=1.0&oauth_timestamp=12" + "31461132&oauth_consumer_key=consumer&oauth_signature_method=HMAC-SHA1&oauth_nonce=1" + "231461160262578000&oauth_signature=HuFQ%2BRYTrRzcgsi3al6ld9Msvoo%3D")); String filtered = OAuthResponseParams.filterSecrets(req.toString()); checkStringContains(filtered, "oauth_session_handle=REMOVED"); }
@Test public void testStripSecretsFromRequestHeader() { HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/foo")); req.setHeader("Authorization", "OAuth opensocial_owner_id=\"owner\", opensocial_viewer_id=" + "\"owner\", opensocial_app_id=\"app\", opensocial_app_url=\"http%3A%2F%2Fwww.examp" + "le.com%2Fheader.xml\", oauth_version=\"1.0\", oauth_timestamp=\"1231461306\", oau" + "th_consumer_key=\"consumer\", oauth_signature_method=\"HMAC-SHA1\", oauth_nonce" + "=\"1231461308333563000\", oauth_session_handle=\"w0zAI1yN5ZRvmBX5kcVdra5%2BbZE%" + "3D\""); String filtered = OAuthResponseParams.filterSecrets(req.toString()); checkStringContains(filtered, "oauth_session_handle=REMOVED"); }
@Test public void testStripSecretsFromRequestHeader() { HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/foo")); req.setHeader("Authorization", "OAuth opensocial_owner_id=\"owner\", opensocial_viewer_id=" + "\"owner\", opensocial_app_id=\"app\", opensocial_app_url=\"http%3A%2F%2Fwww.examp" + "le.com%2Fheader.xml\", oauth_version=\"1.0\", oauth_timestamp=\"1231461306\", oau" + "th_consumer_key=\"consumer\", oauth_signature_method=\"HMAC-SHA1\", oauth_nonce" + "=\"1231461308333563000\", oauth_session_handle=\"w0zAI1yN5ZRvmBX5kcVdra5%2BbZE%" + "3D\""); String filtered = OAuthResponseParams.filterSecrets(req.toString()); checkStringContains(filtered, "oauth_session_handle=REMOVED"); }
@Test public void testStripSecretsFromRequestHeader() { HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/foo")); req.setHeader("Authorization", "OAuth opensocial_owner_id=\"owner\", opensocial_viewer_id=" + "\"owner\", opensocial_app_id=\"app\", opensocial_app_url=\"http%3A%2F%2Fwww.examp" + "le.com%2Fheader.xml\", oauth_version=\"1.0\", oauth_timestamp=\"1231461306\", oau" + "th_consumer_key=\"consumer\", oauth_signature_method=\"HMAC-SHA1\", oauth_nonce" + "=\"1231461308333563000\", oauth_session_handle=\"w0zAI1yN5ZRvmBX5kcVdra5%2BbZE%" + "3D\""); String filtered = OAuthResponseParams.filterSecrets(req.toString()); checkStringContains(filtered, "oauth_session_handle=REMOVED"); }