Пример #1
0
 public String getUrl(int connectionCount) {
   String url = client.getUrl();
   if (client.getSerializer() != null && client.getSerializer().getMode() == SerialMode.DE_RPC) {
     url +=
         (url.contains("?") ? "&" : "?")
             + Constants.MODULE_BASE_PARAMETER
             + '='
             + GWT.getModuleBaseURL()
             + '&'
             + Constants.STRONG_NAME_PARAMETER
             + '='
             + GWT.getPermutationStrongName();
   }
   String className = getClass().getName();
   className = className.substring(className.lastIndexOf('.') + 1);
   String transport = className.substring(0, className.indexOf("CometTransport"));
   return url
       + (url.contains("?") ? "&" : "?")
       + "t="
       + Integer.toString(
               (int) (Duration.currentTimeMillis() % Integer.MAX_VALUE), Character.MAX_RADIX)
           .toUpperCase()
       + "&c="
       + connectionCount
       + "&tr="
       + transport;
 }
Пример #2
0
 protected Serializable parse(String message) throws SerializationException {
   if (message == null || message.isEmpty()) {
     return null;
   }
   AtmosphereGWTSerializer serializer = client.getSerializer();
   if (serializer == null) {
     throw new SerializationException(
         "Can not deserialize message with no serializer: " + message);
   } else {
     return serializer.parse(message);
   }
 }