コード例 #1
0
 public static void initialize(final EventBus eventBus) {
   ShortcutHandlers.eventBus = eventBus;
   assert initialized == false : "Shortcuts already has been set.";
   initialized = true;
   if (RestClient.isDebug()) {
     Log.debug("Initialize shortcuts handlers.");
   }
   ShortcutHandlers.shortcuts = getDefaultShortcuts();
   setListenersVariables();
   setupKeyboardShortcuts();
 }
コード例 #2
0
 /**
  * A function to be called when any header change. This function should look for "Content-Type"
  * header and fire content type change event when changed.
  *
  * @param key Header name
  * @param value Header value
  */
 void onHeaderChange(String key, String value) {
   if (key == null || key.isEmpty()) {
     return;
   }
   if (key.trim().toLowerCase().equals("content-type")) {
     if (value == null) {
       value = "";
     }
     String ct = value;
     if (ct.indexOf(";") != -1) {
       ct = ct.substring(0, ct.indexOf(";"));
     }
     if ((lastSendContentTypeChangeValue == null || lastSendContentTypeChangeValue.equals("null"))
         || (lastSendContentTypeChangeValue != null
             && !lastSendContentTypeChangeValue.equals(ct))) {
       lastSendContentTypeChangeValue = ct;
       if (RestClient.isDebug()) {
         Log.info("Content-type changed to: ", ct);
       }
       RestClient.getClientFactory().getEventBus().fireEvent(new HttpEncodingChangeEvent(ct));
     }
   }
 }