当前位置: 首页>>代码示例>>Java>>正文


Java NetworkEndpointId类代码示例

本文整理汇总了Java中com.google.protos.ipc.invalidation.Channel.NetworkEndpointId的典型用法代码示例。如果您正苦于以下问题:Java NetworkEndpointId类的具体用法?Java NetworkEndpointId怎么用?Java NetworkEndpointId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NetworkEndpointId类属于com.google.protos.ipc.invalidation.Channel包,在下文中一共展示了NetworkEndpointId类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildUrl

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
/**
 * Returns a URL to use to send a message to the data center.
 *
 * @param gaiaServiceId Gaia service for which the request will be authenticated (when using a
 *      GoogleLogin token), or {@code null} when using an OAuth2 token.
 * @param networkEndpointId network id of the client
 */
private static URL buildUrl(String gaiaServiceId, NetworkEndpointId networkEndpointId)
    throws MalformedURLException {
  StringBuilder urlBuilder = new StringBuilder();

  // Build base URL that targets the inbound request service with the encoded network endpoint
  // id.
  urlBuilder.append((channelUrlForTest != null) ? channelUrlForTest : HttpConstants.CHANNEL_URL);
  urlBuilder.append(HttpConstants.REQUEST_URL);

  // TODO: We should be sending a ClientGatewayMessage in the request body
  // instead of appending the client's network endpoint id to the request URL. Once we do that, we
  // should use a UriBuilder to build up a structured Uri object instead of the brittle string
  // concatenation we're doing below.
  urlBuilder.append(base64Encode(networkEndpointId.toByteArray()));

  // Add query parameter indicating the service to authenticate against
  if (gaiaServiceId != null) {
    urlBuilder.append('?');
    urlBuilder.append(HttpConstants.SERVICE_PARAMETER);
    urlBuilder.append('=');
    urlBuilder.append(gaiaServiceId);
  }
  return new URL(urlBuilder.toString());
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:32,代码来源:AndroidMessageSenderService.java

示例2: getNetworkEndpointId

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
/** Returns the network id for this channel, or {@code null} if one cannot be determined. */


public static NetworkEndpointId getNetworkEndpointId(Context context, Logger logger) {
  String registrationId = GCMRegistrar.getRegistrationId(context);
  if (Strings.isNullOrEmpty(registrationId)) {
    // No registration with GCM; we cannot compute a network id. The GCM documentation says the
    // string is never null, but we'll be paranoid.
    logger.warning("No GCM registration id; cannot determine our network endpoint id: %s",
        registrationId);
    return null;
  }
  return CommonProtos2.newAndroidEndpointId(registrationId,
      NO_CLIENT_KEY, context.getPackageName(), AndroidChannelConstants.CHANNEL_VERSION);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:16,代码来源:AndroidMessageSenderService.java

示例3: getNetworkIdForTest

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
@Override
public NetworkEndpointId getNetworkIdForTest() {
  NetworkChannel network = resources.getNetwork();
  if (!(network instanceof TestableNetworkChannel)) {
    throw new UnsupportedOperationException(
        "getNetworkIdForTest requires a TestableNetworkChannel, not: " + network.getClass());
  }
  return ((TestableNetworkChannel) network).getNetworkIdForTest();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:InvalidationClientCore.java

示例4: getWebEncodedEndpointId

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
/** Returns the web encoded version of the channel network endpoint ID for HTTP requests. */
@Override
protected String getWebEncodedEndpointId() {
  NetworkEndpointId networkEndpointId = getNetworkId();
  return Base64.encodeToString(networkEndpointId.toByteArray(),
      Base64.URL_SAFE | Base64.NO_WRAP  | Base64.NO_PADDING);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:AndroidChannel.java

示例5: newAndroidEndpointId

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
/**
 * Constructs a network endpoint id for an Android client with the given {@code registrationId},
 * {@code clientKey}, and {@code packageName}.
 */
public static NetworkEndpointId newAndroidEndpointId(String registrationId, String clientKey,
    String packageName, Version channelVersion) {
  Preconditions.checkNotNull(registrationId, "Null registration id");
  Preconditions.checkNotNull(clientKey, "Null client key");
  Preconditions.checkNotNull(packageName, "Null package name");
  Preconditions.checkNotNull(channelVersion, "Null channel version");

  AndroidChannel.EndpointId.Builder endpointBuilder = AndroidChannel.EndpointId.newBuilder()
      .setC2DmRegistrationId(registrationId)
      .setClientKey(clientKey)
      .setPackageName(packageName)
      .setChannelVersion(channelVersion);
  return newNetworkEndpointId(NetworkAddress.ANDROID, endpointBuilder.build().toByteString());
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:CommonProtos2.java

示例6: newNetworkEndpointId

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
public static NetworkEndpointId newNetworkEndpointId(NetworkAddress networkAddr,
    ByteString clientAddr) {
  return NetworkEndpointId.newBuilder()
      .setNetworkAddress(networkAddr)
      .setClientAddress(clientAddr)
      .build();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:CommonProtos2.java

示例7: getNetworkIdForTest

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
@Override
public NetworkEndpointId getNetworkIdForTest() {
  return AndroidMessageSenderService.getNetworkEndpointId(context, resources.getLogger());
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:5,代码来源:AndroidNetworkChannel.java

示例8: getNetworkIdForTest

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
@Override
public NetworkEndpointId getNetworkIdForTest() {
  return getNetworkId();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:5,代码来源:AndroidChannel.java

示例9: getNetworkId

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
private NetworkEndpointId getNetworkId() {
  String registrationId = getRegistrationId();
  return CommonProtos2.newAndroidEndpointId(registrationId, proxy.getClientKey(),
      proxy.getService().getPackageName(), CHANNEL_VERSION);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:6,代码来源:AndroidChannel.java

示例10: getNetworkIdForTest

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
/**
 * Returns the network id for testing. May throw {@link UnsupportedOperationException}.
 */
NetworkEndpointId getNetworkIdForTest();
 
开发者ID:morristech,项目名称:android-chromium,代码行数:5,代码来源:TestableNetworkChannel.java

示例11: getNetworkIdForTest

import com.google.protos.ipc.invalidation.Channel.NetworkEndpointId; //导入依赖的package包/类
/**
 * Returns the network endpoint id of the client. May throw {@code UnsupportedOperationException}.
 */
NetworkEndpointId getNetworkIdForTest();
 
开发者ID:morristech,项目名称:android-chromium,代码行数:5,代码来源:TestableInvalidationClient.java


注:本文中的com.google.protos.ipc.invalidation.Channel.NetworkEndpointId类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。