Example #1
0
 @Test
 public void testURI() throws Exception {
   URI uri = new URI("classpath:com/myapp/config.xml");
   System.out.println((uri));
   System.out.println(ReflectUtil.map(uri));
   URL.setURLStreamHandlerFactory(
       new URLStreamHandlerFactory() {
         public URLStreamHandler createURLStreamHandler(String protocol) {
           if (protocol.equals("classpath")) {
             return new URLStreamHandler() {
               @Override
               protected URLConnection openConnection(URL u) throws IOException {
                 return this.getClass().getResource("/" + u.getPath()).openConnection();
               }
             };
           } else {
             return null;
           }
         }
       });
   URL url1 = uri.toURL();
   URL url2 = new URL("classpath:com/myapp/config.xml");
   System.out.println(ReflectUtil.map(url1));
   System.out.println(ReflectUtil.map(url2));
   System.out.println(url1.equals(url2));
 }
  public static void main(String[] args) throws Exception {
    if (args.length < 1) {
      System.err.println("Usage: MarkReaderAppLauncher <sourceDirectoryRoot>");
      return;
    }
    try {
      URL.setURLStreamHandlerFactory(new ClassURLStreamHandlerFactory());
    } catch (Error ignore) {
    }

    File sourceDirectoryRoot = new File(args[0]);
    final MarkReaderController markReaderController = MarkReaderControllerImpl.getInstance(1099);

    Session session = markReaderController.createOrReuseSession(sourceDirectoryRoot);
    session.addSessionMonitor(
        new MarkReaderSessionMonitorAdapter() {
          @Override
          public void notifySessionFinished(File sourceDirectoryRootFile) {
            markReaderController.userShutdown();
          }
        });
    MarkReaderPanelController markReaderPanelController =
        new MarkReaderPanelController(markReaderController, null);
    markReaderPanelController.userOpen(sourceDirectoryRoot);
  }
Example #3
0
 /**
  * Reset any cached handers just in case a jar protocol has already been used. We reset the
  * handler by trying to set a null {@link URLStreamHandlerFactory} which should have no effect
  * other than clearing the handlers cache.
  */
 private static void resetCachedUrlHandlers() {
   try {
     URL.setURLStreamHandlerFactory(null);
   } catch (Error ex) {
     // Ignore
   }
 }
Example #4
0
 static {
   try {
     URL.setURLStreamHandlerFactory(
         new ConfigurableStreamHandlerFactory("classpath", new ClasspathStreamHandler()));
   } catch (Error e) {
     // if the stream handler was already set ignore the "factory already defined" error
   }
 }
  public static void main(String[] args) {
    System.out.println("override the default WebLogic Server HTTP stream handler");

    try {
      java.net.URL.setURLStreamHandlerFactory(new FwURLStreamHandlerFactory());
    } catch (Exception e) {
      System.err.println("Exception while setting the URLStreamHandlerFactory object" + e);
    }
  }
 static {
   // Register IRODS URL Protocol Handler (see metadata project)
   // https://issues.apache.org/bugzilla/show_bug.cgi?id=26701
   URLStreamHandlerFactory urlHandlerFactory = new IRODSURLStreamHandlerFactory();
   try {
     URL.setURLStreamHandlerFactory(urlHandlerFactory);
   } catch (Error e) {
   }
   DirContextURLStreamHandlerFactory.addUserFactory(new IRODSURLStreamHandlerFactory());
 }
Example #7
0
 @BeforeClass
 public static void mockSetup() {
   handler = CurlTestSuite.getHandler();
   factory = CurlTestSuite.getFactory();
   try {
     URL.setURLStreamHandlerFactory(factory);
   } catch (Error e) {
   }
   handler.getConnection().setUseMapped(true);
 }
 /*
  * Prepare for validation by determing system and Karaf exports
  */
 private void prepare() throws Exception {
   info("== Preparing for validation ==");
   URL.setURLStreamHandlerFactory(new CustomBundleURLStreamHandlerFactory());
   info(" - getting list of system bundle exports");
   readSystemPackages();
   info(" - getting list of provided bundle exports");
   readProvidedBundles();
   info(" - populating repositories with Karaf core features descriptors");
   appendKarafCoreFeaturesDescriptors();
 }
  public static void main(String[] args) {

    try {
      URL.setURLStreamHandlerFactory(new CustomUrlStreamHandlerFactory());

      URL rtmp =
          new URL(
              "rtmpe://fms-fra9.rtl.de/rtlnow/248/V_52072_BBDB_m07007_45471_16x9-lq-512x288-h264-c0_c2e7538eba78393f4baf1635e93140e6.f4v");

      RtmpUrlConnection conn = (RtmpUrlConnection) rtmp.openConnection();

      conn.setApp("rtlnow/_definst_");
      conn.setTcUrl("rtmp://fms-hc1.rtl.de/rtlnow/_definst_");
      conn.setPageUrl("http://rtl-now.rtl.de/");
      conn.setSwfUrl("http://rtl-now.rtl.de/includes/rtlnow_videoplayer09_2.swf?ts=20090922");
      conn.setSwfVfy(true);
      conn.setPlayPath(
          "mp4:/248/V_52072_BBDB_m07007_45471_16x9-lq-512x288-h264-c0_c2e7538eba78393f4baf1635e93140e6.f4v");

      conn.connect();

      InputStream in = conn.getInputStream();

      byte[] puffer = new byte[1024 * 1024];
      FileOutputStream fos = new FileOutputStream(new File(".\\test.flv"));

      // fos.write(LibRtmp.flvHeader);
      int size = 0;
      while ((size = in.read(puffer)) > 0) {
        // System.out.println("reading data " + puffer[0]);
        fos.write(puffer, 0, size);
      }
      fos.close();

    } catch (Exception e) {
      System.out.println("Error: " + e);
    }

    // int res = lib
    // .RTMP_SetupURL(
    // session,
    // "rtmpe://fms-fra9.rtl.de/rtlnow/248/V_52072_BBDB_m07007_45471_16x9-lq-512x288-h264-c0_c2e7538eba78393f4baf1635e93140e6.f4v"
    // + " tcUrl=rtmp://fms-hc1.rtl.de/rtlnow/_definst_"
    // + " pageUrl=http://rtl-now.rtl.de/"
    // +
    // " swfUrl=http://rtl-now.rtl.de/includes/rtlnow_videoplayer09_2.swf?ts=20090922"
    // + " swfVfy=1"
    // + " app=rtlnow/_definst_"
    // +
    // "
    // playpath=mp4:/248/V_52072_BBDB_m07007_45471_16x9-lq-512x288-h264-c0_c2e7538eba78393f4baf1635e93140e6.f4v");

  }
Example #10
0
  public RunAppServer() throws IOException {
    // set up URL handlers for Wonderland types
    URL.setURLStreamHandlerFactory(new WonderlandURLStreamHandlerFactory());

    // now load the properties
    setupProperties();

    // check if we need to make any changes
    if (Boolean.parseBoolean(System.getProperty(Constants.WEBSERVER_NEWVERSION_PROP))) {
      // replace old versions of modules with newer versions
      updateModules();

      // write the web server's document root
      writeDocumentRoot();

      // write DTDs for local deployments
      writeSchemas();

      // write the updated webapps
      writeWebApps();
    }

    // create and start the appserver -- the hostname will be set
    // as a sideeffect of the start call
    try {
      createAppServer();
      getAppServer().start();
    } catch (LifecycleException le) {
      throw new IOException(le);
    }

    // deploy built-in web apps
    deployWebApps();

    // notify the deployer that we are ready to start deploying other apps
    getAppServer().setDeployable(true);

    // redeploy any other modules, including web modules,
    // that haven't yet been deployed.  This will also
    // install all pending modules
    ModuleManager.getModuleManager().redeployAll();

    // start accepting secure connections to the web server (needed
    // by the services that start when we fire the startup complete
    // event below)
    DefaultSAM.setStarted(true);

    // now that all the modules are deployed, notify anyone waiting
    // for startup
    AppServerMonitor.getInstance().fireStartupComplete();
  }
Example #11
0
  /**
   * Registers a factory that is used by the URL class to create the {@link java.net.URLConnection}
   * instances when the {@link java.net.URL#openConnection()} or {@link java.net.URL#openStream()}
   * methods are invoked.
   *
   * <p>The implementation is based on the client dispatcher of the current context, as provided by
   * {@link Context#getCurrent()} method.
   */
  public void registerUrlFactory() {
    // Set up an java.net.URLStreamHandlerFactory for
    // proper creation of java.net.URL instances
    java.net.URL.setURLStreamHandlerFactory(
        new java.net.URLStreamHandlerFactory() {
          public java.net.URLStreamHandler createURLStreamHandler(String protocol) {
            final java.net.URLStreamHandler result =
                new java.net.URLStreamHandler() {

                  @Override
                  protected java.net.URLConnection openConnection(java.net.URL url)
                      throws IOException {
                    return new java.net.URLConnection(url) {

                      @Override
                      public void connect() throws IOException {}

                      @Override
                      public InputStream getInputStream() throws IOException {
                        InputStream result = null;

                        // Retrieve the current context
                        final Context context = Context.getCurrent();

                        if (context != null) {
                          final Response response =
                              context
                                  .getClientDispatcher()
                                  .handle(new Request(Method.GET, this.url.toString()));

                          if (response.getStatus().isSuccess()) {
                            result = response.getEntity().getStream();
                          }
                        }

                        return result;
                      }
                    };
                  }
                };

            return result;
          }
        });
  }
 /**
  * Install an instance of this class as UrlStreamHandlerFactory. This may be done exactly once as
  * {@link URL} will throw an {@link Error} on subsequent invocations.
  *
  * <p>This method takes care that multiple invocations are possible, but the
  * UrlStreamHandlerFactory is installed only once.
  */
 public static synchronized void installUrlStreamHandlerFactory() {
   /*
    * When running under surefire, this class will be loaded by different class loaders and
    * will be running in multiple "main" thread objects. Thus, there is no way for this class
    * to register a globally available variable to store the info whether our custom
    * UrlStreamHandlerFactory was already registered.
    *
    * The only way to accomplish this is to catch the Error that is thrown by URL when
    * trying to re-register the custom UrlStreamHandlerFactory.
    */
   try {
     URL.setURLStreamHandlerFactory(new MuleUrlStreamHandlerFactory());
   } catch (Error err) {
     if (log.isDebugEnabled()) {
       log.debug("Custom MuleUrlStreamHandlerFactory already registered", err);
     }
   }
 }
  public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);

    try {
      java.net.URL.setURLStreamHandlerFactory(
          new java.net.URLStreamHandlerFactory() {
            public java.net.URLStreamHandler createURLStreamHandler(String protocol) {
              Log.d(LOG_TAG, "Asking for stream handler for protocol: '" + protocol + "'");
              if ("icy".equals(protocol)) return new com.spoledge.aacdecoder.IcyURLStreamHandler();
              return null;
            }
          });
    } catch (Throwable t) {
      Log.w(LOG_TAG, "Cannot set the ICY URLStreamHandler - maybe already set ? - " + t);
    }

    if (RadioAAC.multiPlayer == null) RadioAAC.multiPlayer = new MultiPlayer();
  }
  /**
   * Return AAC player. If it is not initialized, creates and returns.
   *
   * @return MultiPlayer
   */
  private MultiPlayer getPlayer() {
    try {

      java.net.URL.setURLStreamHandlerFactory(
          new java.net.URLStreamHandlerFactory() {

            public java.net.URLStreamHandler createURLStreamHandler(String protocol) {
              Log.d("LOG", "Asking for stream handler for protocol: '" + protocol + "'");
              if ("icy".equals(protocol)) return new com.spoledge.aacdecoder.IcyURLStreamHandler();
              return null;
            }
          });
    } catch (Throwable t) {
      Log.w("LOG", "Cannot set the ICY URLStreamHandler - maybe already set ? - " + t);
    }

    if (mRadioPlayer == null) {
      mRadioPlayer = new MultiPlayer(this, AUDIO_BUFFER_CAPACITY_MS, AUDIO_DECODE_CAPACITY_MS);
      mRadioPlayer.setResponseCodeCheckEnabled(false);
    }
    return mRadioPlayer;
  }
Example #15
0
  /**
   * Initialize the URLStreamHandlerFactory of class java.net.URL.
   *
   * <p>This method call influences the complete Java JVM.
   *
   * <p>This method can be called multiple times without any problems, but
   * URL.setURLStreamHandlerFactory() may not be called before the first call of this method to
   * avoid problems.
   *
   * @param factory use this factory if possible
   */
  public static synchronized void initURLStreamHandlerFactory(
      NetlibURLStreamHandlerFactory factory) {
    //
    // preparation of the work
    //

    // Avoid java.lang.ClassCircularityError:
    // org/silvertunnel/netlib/adapter/url/impl/net/http/HttpURLConnection$StreamingOutputStream
    //       (details on https://sourceforge.net/apps/trac/silvertunnel/ticket/114)
    //
    // This is really a hack
    // because it only avoids a specific the Java Web Start problem of the silvertunnel.org Browser
    try {
      // load the class HttpURLConnection.StreamingOutputStream early(=here)
      new HttpHandler(null).openConnection(null, null);
    } catch (Exception e) {
      log.log(Level.FINE, "Can be ignored be ignored", e);
    }

    //
    // do the work
    //
    if (netlibURLStreamHandlerFactory == null) {
      try {
        netlibURLStreamHandlerFactory = factory;
        URL.setURLStreamHandlerFactory(factory);

      } catch (Throwable e) {
        String msg =
            "URL.setURLStreamHandlerFactory() was already called before,"
                + " but not from UrlUtil, i.e. maybe the wrong factory is set";
        if (log.isLoggable(Level.FINE)) {
          log.log(Level.WARNING, msg + ": " + e, e);
        } else {
          log.log(Level.WARNING, msg + ": " + e);
        }
      }
    }
  }
  public static void init() {
    URL.setURLStreamHandlerFactory(
        new URLStreamHandlerFactory() {

          @Override
          public URLStreamHandler createURLStreamHandler(String protocol) {

            if (!protocol.equals("bytes")) {
              return null;
            }

            return new URLStreamHandler() {

              @Override
              protected URLConnection openConnection(URL url) {
                return new URLConnection(url) {

                  @Override
                  public void connect() {}

                  @Override
                  public InputStream getInputStream() throws IOException {

                    byte[] bytes = _bytesMap.get(url);

                    if (bytes == null) {
                      throw new IOException("Unable to get bytes for " + url);
                    }

                    return new ByteArrayInputStream(bytes);
                  }
                };
              }
            };
          }
        });
  }
  @Override
  public void onCreate() {
    // OkHttp changes the global SSL context, breaks other HTTP clients.  Google Analytics uses a
    // different http
    // client, which OkHttp doesn't handle well.
    // https://github.com/square/okhttp/issues/184
    if (!mUrlStreamFactorySet) {
      URL.setURLStreamHandlerFactory(Utils.createOkHttpClient());
      mUrlStreamFactorySet = true;
    }

    // Use OkHttp instead of HttpUrlConnection to handle HTTP requests, OkHttp supports 2.2 while
    // HttpURLConnection
    // is a bit buggy on froyo.
    if (!mConnectionFactorySet) {
      HttpRequest.setConnectionFactory(new OkConnectionFactory());
      mConnectionFactorySet = true;
    }

    super.onCreate();

    sMainApplication = this;
    setSite(getDefaultSite());
  }
Example #18
0
 /*
  * 可以使用静态初始化块来让Hadoop识别 hdfs 前缀
  *
  */
 static {
   URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
 }
  public static synchronized void preInitialise() {
    if (!pre_initialised) {

      pre_initialised = true;

      try {
        if (System.getProperty("azureus.portable.enable", "false").equalsIgnoreCase("true")) {

          try {
            if (File.separatorChar != '\\') {

              throw (new Exception("Portable only supported on Windows"));
            }

            File portable_root;

            try {
              portable_root = new File(".").getCanonicalFile();

            } catch (Throwable e) {

              portable_root = new File(".").getAbsoluteFile();
            }

            if (!portable_root.canWrite()) {

              throw (new Exception("can't write to " + portable_root));
            }

            File root_file = new File(portable_root, "portable.dat");

            String str = portable_root.getAbsolutePath();

            if (str.length() < 2 || str.charAt(1) != ':') {

              throw (new Exception("drive letter missing in '" + str + "'"));
            }

            String root_relative = str.substring(2);

            boolean write_file = true;

            if (root_file.exists()) {

              LineNumberReader lnr =
                  new LineNumberReader(
                      new InputStreamReader(new FileInputStream(root_file), "UTF-8"));

              try {
                String line = lnr.readLine();

                if (line != null) {

                  line = line.trim();

                  if (line.equalsIgnoreCase(root_relative)) {

                    write_file = false;

                  } else {

                    throw (new Exception(
                        "root changed - old='" + line + "', new='" + root_relative));
                  }
                }
              } finally {

                lnr.close();
              }
            }

            if (write_file) {

              PrintWriter pw =
                  new PrintWriter(new OutputStreamWriter(new FileOutputStream(root_file), "UTF-8"));

              try {
                pw.println(root_relative);

              } finally {

                pw.close();
              }
            }

            System.setProperty("azureus.install.path", str);
            System.setProperty("azureus.config.path", str);

            System.setProperty("azureus.portable.root", str);

            System.out.println(
                "Portable setup OK - root=" + root_relative + " (current=" + str + ")");

          } catch (Throwable e) {

            System.err.println("Portable setup failed: " + e.getMessage());

            System.setProperty("azureus.portable.enable", "false");

            System.setProperty("azureus.portable.root", "");
          }
        } else {

          System.setProperty("azureus.portable.root", "");
        }

        /*
        String	handlers = System.getProperty( "java.protocol.handler.pkgs" );

        if ( handlers == null ){

        	handlers = "org.gudy.azureus2.core3.util.protocol";

        }else{

        	handlers += "|org.gudy.azureus2.core3.util.protocol";
        }

        System.setProperty( "java.protocol.handler.pkgs", handlers );
        */

        /* for the moment disable this as it is causing some users to get an SSL exception on
         * trackers with Java 7 due to the tracker hostname setup
         * See http://stackoverflow.com/questions/7615645/ssl-handshake-alert-unrecognized-name-error-since-upgrade-to-java-1-7-0
         */

        System.setProperty("jsse.enableSNIExtension", "false");

        System.setProperty("sun.net.maxDatagramSockets", "4096");

        URL.setURLStreamHandlerFactory(new AzURLStreamHandlerFactory());

        // DNS cache timeouts

        System.setProperty("sun.net.inetaddr.ttl", "60");
        System.setProperty("networkaddress.cache.ttl", "60");

        // flick AWT into headless mode, which is supposed to make it more lightweight
        // don't do this as it borks (for example) swing based plugins, java webstart installer,
        // swing webui plugin, ....

        // System.setProperty("java.awt.headless", "true");

        // defaults, overridden later if needed

        System.setProperty("sun.net.client.defaultConnectTimeout", "120000");
        System.setProperty("sun.net.client.defaultReadTimeout", "60000");

        // see
        // http://developer.apple.com/releasenotes/Java/Java142RN/ResolvedIssues/chapter_3_section_7.html
        // fixes the osx kernel panic bug caused by Apple's faulty kqueue implementation (as of
        // 10.3.6)

        if (Constants.isOSX) {

          // things seem good in 10.6

          // if ( !Constants.isOSX_10_6_OrHigher ){

          System.setProperty("java.nio.preferSelect", "true");
          // }
        }

        SystemProperties.determineApplicationName();

      } catch (Throwable e) {

        // can happen in applet

        if (e instanceof AccessControlException) {

        } else {

          e.printStackTrace();
        }
      }
    }
  }
 static {
   // thats the way to register an other HandlerFactory
   URL.setURLStreamHandlerFactory(new Mil2525bHandlerFactory());
 }
Example #21
0
  @TargetApi(9)
  @Override
  public void onCreate() {
    if (Build.VERSION.SDK_INT >= 9 && BuildConfig.DEBUG) {
      StrictMode.setThreadPolicy(
          new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
      StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
    }
    updateLanguage();
    super.onCreate();
    ACRA.init(this);

    // Needs to be setup before anything else tries to access it.
    // Perhaps the constructor is a better place, but then again,
    // it is more deterministic as to when this gets called...
    Preferences.setup(this);

    // Apply the Google PRNG fixes to properly seed SecureRandom
    PRNGFixes.apply();

    // Check that the installed app cache hasn't gotten out of sync somehow.
    // e.g. if we crashed/ran out of battery half way through responding
    // to a package installed intent. It doesn't really matter where
    // we put this in the bootstrap process, because it runs on a different
    // thread, which will be delayed by some seconds to avoid an error where
    // the database is locked due to the database updater.
    InstalledAppCacheUpdater.updateInBackground(getApplicationContext());

    // If the user changes the preference to do with filtering rooted apps,
    // it is easier to just notify a change in the app provider,
    // so that the newly updated list will correctly filter relevant apps.
    Preferences.get()
        .registerAppsRequiringRootChangeListener(
            new Preferences.ChangeListener() {
              @Override
              public void onPreferenceChange() {
                getContentResolver().notifyChange(AppProvider.getContentUri(), null);
              }
            });

    // This is added so that the bluetooth:// scheme we use for URLs the BluetoothDownloader
    // understands is not treated as invalid by the java.net.URL class. The actual Handler does
    // nothing, but its presence is enough.
    URL.setURLStreamHandlerFactory(
        new URLStreamHandlerFactory() {
          @Override
          public URLStreamHandler createURLStreamHandler(String protocol) {
            return TextUtils.equals(protocol, "bluetooth") ? new Handler() : null;
          }
        });

    final Context context = this;
    Preferences.get()
        .registerUnstableUpdatesChangeListener(
            new Preferences.ChangeListener() {
              @Override
              public void onPreferenceChange() {
                AppProvider.Helper.calcDetailsFromIndex(context);
              }
            });

    // Clear cached apk files. We used to just remove them after they'd
    // been installed, but this causes problems for proprietary gapps
    // users since the introduction of verification (on pre-4.2 Android),
    // because the install intent says it's finished when it hasn't.
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    curTheme = Theme.valueOf(prefs.getString(Preferences.PREF_THEME, Preferences.DEFAULT_THEME));
    Utils.deleteFiles(Utils.getApkDownloadDir(this), null, ".apk");
    if (!Preferences.get().shouldCacheApks()) {
      Utils.deleteFiles(Utils.getApkCacheDir(this), null, ".apk");
    }

    // Index files which downloaded, but were not removed (e.g. due to F-Droid being force
    // closed during processing of the file, before getting a chance to delete). This may
    // include both "index-*-downloaded" and "index-*-extracted.xml" files. The first is from
    // either signed or unsigned repos, and the later is from signed repos.
    Utils.deleteFiles(getCacheDir(), "index-", null);

    // As above, but for legacy F-Droid clients that downloaded under a different name, and
    // extracted to the files directory rather than the cache directory.
    // TODO: This can be removed in a a few months or a year (e.g. 2016) because people will
    // have upgraded their clients, this code will have executed, and they will not have any
    // left over files any more. Even if they do hold off upgrading until this code is removed,
    // the only side effect is that they will have a few more MiB of storage taken up on their
    // device until they uninstall and re-install F-Droid.
    Utils.deleteFiles(getCacheDir(), "dl-", null);
    Utils.deleteFiles(getFilesDir(), "index-", null);

    UpdateService.schedule(getApplicationContext());
    bluetoothAdapter = getBluetoothAdapter();

    ImageLoaderConfiguration config =
        new ImageLoaderConfiguration.Builder(getApplicationContext())
            .imageDownloader(new IconDownloader(getApplicationContext()))
            .diskCache(
                new LimitedAgeDiskCache(
                    new File(
                        StorageUtils.getCacheDirectory(getApplicationContext(), true), "icons"),
                    null,
                    new FileNameGenerator() {
                      @Override
                      public String generate(String imageUri) {
                        return imageUri.substring(imageUri.lastIndexOf('/') + 1);
                      }
                    },
                    // 30 days in secs: 30*24*60*60 = 2592000
                    2592000))
            .threadPoolSize(4)
            .threadPriority(Thread.NORM_PRIORITY - 2) // Default is NORM_PRIORITY - 1
            .build();
    ImageLoader.getInstance().init(config);

    // TODO reintroduce PinningTrustManager and MemorizingTrustManager

    // initialized the local repo information
    FDroidApp.initWifiSettings();
    startService(new Intent(this, WifiStateChangeService.class));
    // if the HTTPS pref changes, then update all affected things
    Preferences.get()
        .registerLocalRepoHttpsListeners(
            new ChangeListener() {
              @Override
              public void onPreferenceChange() {
                startService(new Intent(FDroidApp.this, WifiStateChangeService.class));
              }
            });
  }