Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java

Issue 2858493003: Properly send URL parameters in all requests (Closed)
Patch Set: Avoid code repetition Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/examples/androidtests/video_quality_loopback_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/examples/androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java
diff --git a/webrtc/examples/androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java b/webrtc/examples/androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java
index 5e8380ae0c14025d4f82cfabb7a2088bece389bc..32150519346c3a9f4111325a41ec3490a9c69293 100644
--- a/webrtc/examples/androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java
+++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/WebSocketRTCClient.java
@@ -131,23 +131,28 @@ public class WebSocketRTCClient implements AppRTCClient, WebSocketChannelEvents
// Helper functions to get connection, post message and leave message URLs
private String getConnectionUrl(RoomConnectionParameters connectionParameters) {
- String url = connectionParameters.roomUrl + "/" + ROOM_JOIN + "/" + connectionParameters.roomId;
- if (connectionParameters.urlParameters != null) {
- url += "?" + connectionParameters.urlParameters;
- }
- return url;
+ return connectionParameters.roomUrl + "/" + ROOM_JOIN + "/" + connectionParameters.roomId
+ + getQueryString(connectionParameters);
magjed_webrtc 2017/05/02 13:14:43 It looks like it would be easier to assign "" to c
oprypin_webrtc 2017/05/02 13:17:37 It's not just a null check - it's also about the "
magjed_webrtc 2017/05/03 07:58:41 Ok, let's do it this way.
}
private String getMessageUrl(
RoomConnectionParameters connectionParameters, SignalingParameters signalingParameters) {
return connectionParameters.roomUrl + "/" + ROOM_MESSAGE + "/" + connectionParameters.roomId
- + "/" + signalingParameters.clientId;
+ + "/" + signalingParameters.clientId + getQueryString(connectionParameters);
}
private String getLeaveUrl(
RoomConnectionParameters connectionParameters, SignalingParameters signalingParameters) {
return connectionParameters.roomUrl + "/" + ROOM_LEAVE + "/" + connectionParameters.roomId + "/"
- + signalingParameters.clientId;
+ + signalingParameters.clientId + getQueryString(connectionParameters);
+ }
+
+ private String getQueryString(RoomConnectionParameters connectionParameters) {
+ if (connectionParameters.urlParameters != null) {
+ return "?" + connectionParameters.urlParameters;
+ } else {
+ return "";
+ }
}
// Callback issued when room parameters are extracted. Runs on local
« no previous file with comments | « no previous file | webrtc/examples/androidtests/video_quality_loopback_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698