65
65
public class DevServerHelper {
66
66
public static final String RELOAD_APP_EXTRA_JS_PROXY = "jsproxy" ;
67
67
68
- private static final String BUNDLE_URL_FORMAT =
69
- "http://%s/%s.%s?platform=android&dev=%s&minify=%s" ;
70
- private static final String RESOURCE_URL_FORMAT = "http://%s/%s" ;
71
- private static final String LAUNCH_JS_DEVTOOLS_COMMAND_URL_FORMAT =
72
- "http://%s/launch-js-devtools" ;
73
- private static final String ONCHANGE_ENDPOINT_URL_FORMAT =
74
- "http://%s/onchange" ;
75
- private static final String WEBSOCKET_PROXY_URL_FORMAT = "ws://%s/debugger-proxy?role=client" ;
76
- private static final String PACKAGER_STATUS_URL_FORMAT = "http://%s/status" ;
77
- private static final String INSPECTOR_DEVICE_URL_FORMAT = "http://%s/inspector/device?name=%s&app=%s" ;
78
- private static final String INSPECTOR_ATTACH_URL_FORMAT = "http://%s/nuclide/attach-debugger-nuclide?title=%s&app=%s&device=%s" ;
79
- private static final String SYMBOLICATE_URL_FORMAT = "http://%s/symbolicate" ;
80
- private static final String OPEN_STACK_FRAME_URL_FORMAT = "http://%s/open-stack-frame" ;
81
-
82
68
private static final String PACKAGER_OK_STATUS = "packager-status:running" ;
83
69
84
70
private static final int LONG_POLL_KEEP_ALIVE_DURATION_MS = 2 * 60 * 1000 ; // 2 mins
@@ -365,14 +351,14 @@ public void onResponse(Call call, final Response response) throws IOException {
365
351
public String getWebsocketProxyURL () {
366
352
return String .format (
367
353
Locale .US ,
368
- WEBSOCKET_PROXY_URL_FORMAT ,
354
+ "ws://%s/debugger-proxy?role=client" ,
369
355
mSettings .getPackagerConnectionSettings ().getDebugServerHost ());
370
356
}
371
357
372
358
private String getInspectorDeviceUrl () {
373
359
return String .format (
374
360
Locale .US ,
375
- INSPECTOR_DEVICE_URL_FORMAT ,
361
+ "http://%s/inspector/device?name=%s&app=%s" ,
376
362
mSettings .getPackagerConnectionSettings ().getInspectorServerHost (),
377
363
AndroidInfoHelpers .getFriendlyDeviceName (),
378
364
mPackageName );
@@ -381,7 +367,7 @@ private String getInspectorDeviceUrl() {
381
367
private String getInspectorAttachUrl (String title ) {
382
368
return String .format (
383
369
Locale .US ,
384
- INSPECTOR_ATTACH_URL_FORMAT ,
370
+ "http://%s/nuclide/attach-debugger-nuclide?title=%s&app=%s&device=%s" ,
385
371
AndroidInfoHelpers .getServerHost (),
386
372
title ,
387
373
mPackageName ,
@@ -426,7 +412,7 @@ private boolean getJSMinifyMode() {
426
412
private String createBundleURL (String mainModuleID , BundleType type , String host ) {
427
413
return String .format (
428
414
Locale .US ,
429
- BUNDLE_URL_FORMAT ,
415
+ "http://%s/%s.%s?platform=android&dev=%s&minify=%s" ,
430
416
host ,
431
417
mainModuleID ,
432
418
type .typeID (),
@@ -440,15 +426,15 @@ private String createBundleURL(String mainModuleID, BundleType type) {
440
426
}
441
427
442
428
private static String createResourceURL (String host , String resourcePath ) {
443
- return String .format (Locale .US , RESOURCE_URL_FORMAT , host , resourcePath );
429
+ return String .format (Locale .US , "http://%s/%s" , host , resourcePath );
444
430
}
445
431
446
432
private static String createSymbolicateURL (String host ) {
447
- return String .format (Locale .US , SYMBOLICATE_URL_FORMAT , host );
433
+ return String .format (Locale .US , "http://%s/symbolicate" , host );
448
434
}
449
435
450
436
private static String createOpenStackFrameURL (String host ) {
451
- return String .format (Locale .US , OPEN_STACK_FRAME_URL_FORMAT , host );
437
+ return String .format (Locale .US , "http://%s/open-stack-frame" , host );
452
438
}
453
439
454
440
public String getDevServerBundleURL (final String jsModulePath ) {
@@ -508,7 +494,7 @@ public void onResponse(Call call, Response response) throws IOException {
508
494
}
509
495
510
496
private static String createPackagerStatusURL (String host ) {
511
- return String .format (Locale .US , PACKAGER_STATUS_URL_FORMAT , host );
497
+ return String .format (Locale .US , "http://%s/status" , host );
512
498
}
513
499
514
500
public void stopPollingOnChangeEndpoint () {
@@ -583,14 +569,14 @@ public void onResponse(Call call, Response response) throws IOException {
583
569
private String createOnChangeEndpointUrl () {
584
570
return String .format (
585
571
Locale .US ,
586
- ONCHANGE_ENDPOINT_URL_FORMAT ,
572
+ "http://%s/onchange" ,
587
573
mSettings .getPackagerConnectionSettings ().getDebugServerHost ());
588
574
}
589
575
590
576
private String createLaunchJSDevtoolsCommandUrl () {
591
577
return String .format (
592
578
Locale .US ,
593
- LAUNCH_JS_DEVTOOLS_COMMAND_URL_FORMAT ,
579
+ "http://%s/launch-js-devtools" ,
594
580
mSettings .getPackagerConnectionSettings ().getDebugServerHost ());
595
581
}
596
582
0 commit comments