• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SoyMapData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: serve

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
void serve(final Webpath webpath) throws IOException {
  response.setContentType(MediaType.HTML_UTF_8);
  response.setPayload(
      TOFU.newRenderer(ListingSoyInfo.LISTING)
          .setData(
              new SoyMapData(
                  ListingSoyInfo.ListingSoyTemplateInfo.LABEL,
                  config.get().getLabel(),
                  ListingSoyInfo.ListingSoyTemplateInfo.PATHS,
                  new SoyListData(
                      FluentIterable.from(webpaths)
                          .filter(
                              new Predicate<Webpath>() {
                                @Override
                                public boolean apply(Webpath path) {
                                  return path.startsWith(webpath);
                                }
                              })
                          .transform(Functions.toStringFunction()))))
          .render()
          .getBytes(StandardCharsets.UTF_8));
}
 
开发者ID:bazelbuild,项目名称:rules_closure,代码行数:23,代码来源:ListingPage.java


示例2: initMutatingEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
protected void initMutatingEppToolCommand() {
  checkArgumentNotNull(registrant, "Registrant must be specified");
  checkArgument(!admins.isEmpty(), "At least one admin must be specified");
  checkArgument(!techs.isEmpty(), "At least one tech must be specified");
  if (isNullOrEmpty(password)) {
    password = passwordGenerator.createString(PASSWORD_LENGTH);
  }

  for (String domain : domains) {
    setSoyTemplate(DomainCreateSoyInfo.getInstance(), DomainCreateSoyInfo.DOMAINCREATE);
    addSoyRecord(
        clientId,
        new SoyMapData(
            "domain", domain,
            "period", period == null ? null : period.toString(),
            "nameservers", nameservers,
            "registrant", registrant,
            "admins", admins,
            "techs", techs,
            "password", password));
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:24,代码来源:CreateDomainCommand.java


示例3: initMutatingEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
protected void initMutatingEppToolCommand() {
  setSoyTemplate(HostCreateSoyInfo.getInstance(), HostCreateSoyInfo.HOSTCREATE);
  ImmutableList.Builder<String> ipv4Addresses = new ImmutableList.Builder<>();
  ImmutableList.Builder<String> ipv6Addresses = new ImmutableList.Builder<>();
  for (String address : nullToEmpty(addresses)) {
    InetAddress inetAddress = InetAddresses.forString(address);
    if (inetAddress instanceof Inet4Address) {
      ipv4Addresses.add(inetAddress.getHostAddress());
    } else if (inetAddress instanceof Inet6Address) {
      ipv6Addresses.add(inetAddress.getHostAddress());
    } else {
      throw new IllegalArgumentException(
          String.format("IP address in unknown format: %s", address));
    }
  }
  addSoyRecord(
      clientId,
      new SoyMapData(
          "hostname", hostName,
          "ipv4addresses", ipv4Addresses.build(),
          "ipv6addresses", ipv6Addresses.build()));
}
 
开发者ID:google,项目名称:nomulus,代码行数:24,代码来源:CreateHostCommand.java


示例4: initMutatingEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
protected void initMutatingEppToolCommand() {
  checkArgument(superuser, "This command must be run as a superuser.");
  findTldForNameOrThrow(InternetDomainName.from(domainName)); // Check that the tld exists.
  if (isNullOrEmpty(password)) {
    password = createToken(ANCHOR_TENANT, passwordGenerator);
  }

  Money cost = null;
  if (fee) {
    cost = getDomainCreateCost(domainName, DateTime.now(UTC), DEFAULT_ANCHOR_TENANT_PERIOD_YEARS);
  }

  setSoyTemplate(CreateAnchorTenantSoyInfo.getInstance(),
      CreateAnchorTenantSoyInfo.CREATEANCHORTENANT);
  addSoyRecord(clientId, new SoyMapData(
      "domainName", domainName,
      "contactId", contact,
      "reason", reason,
      "password", password,
      "period", DEFAULT_ANCHOR_TENANT_PERIOD_YEARS,
      "feeCurrency", cost != null ? cost.getCurrencyUnit().toString() : null,
      "fee", cost != null ? cost.getAmount().toString() : null));
}
 
开发者ID:google,项目名称:nomulus,代码行数:25,代码来源:CreateAnchorTenantCommand.java


示例5: initMutatingEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
protected void initMutatingEppToolCommand() {
  checkArgument(
      requestedByRegistrar || !isNullOrEmpty(reason),
      "A reason must be provided when a change is not requested by a registrar.");
  Set<String> valuesToApply = getStatusValuesSet(locksToApply);
  Set<String> valuesToRemove = getStatusValuesSet(locksToRemove);
  checkArgument(
      intersection(valuesToApply, valuesToRemove).isEmpty(),
      "Add and remove actions overlap");
  checkArgument(
      !union(valuesToApply, valuesToRemove).isEmpty(),
      "Add and remove actions are both empty");
  setSoyTemplate(
      UpdateServerLocksSoyInfo.getInstance(), UpdateServerLocksSoyInfo.UPDATESERVERLOCKS);
  addSoyRecord(clientId, new SoyMapData(
      "domainName", domainName,
      "locksToApply", valuesToApply,
      "locksToRemove", valuesToRemove,
      "reason", reason,
      "requestedByRegistrar", requestedByRegistrar));
}
 
开发者ID:google,项目名称:nomulus,代码行数:23,代码来源:UpdateServerLocksCommand.java


示例6: initMutatingEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
protected void initMutatingEppToolCommand() {
  if (isNullOrEmpty(password)) {
    password = passwordGenerator.createString(PASSWORD_LENGTH);
  }
  checkArgument(street == null || street.size() <= 3,
      "Addresses must contain at most 3 street lines.");

  setSoyTemplate(ContactCreateSoyInfo.getInstance(), ContactCreateSoyInfo.CONTACTCREATE);
  addSoyRecord(clientId, new SoyMapData(
      "id", id,
      "name", name,
      "org", org,
      "street", street,
      "city", city,
      "state", state,
      "zip", zip,
      "cc", cc,
      "phone", phone,
      "fax", fax,
      "email", email,
      "password", password));
}
 
开发者ID:google,项目名称:nomulus,代码行数:24,代码来源:CreateContactCommand.java


示例7: getTemplateData

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
static SoyMapData getTemplateData(String canonicalURL, String cdnPath, String faviconPath)
    throws URISyntaxException {
  String canonicalPath = computeCanonicalPath(canonicalURL);

  String staticPath = "";
  if (cdnPath != null) {
    staticPath = cdnPath;
  } else if (canonicalPath != null) {
    staticPath = canonicalPath;
  }

  // The resource path must be typed as safe for use in a script src.
  // TODO(wyatta): Upgrade this to use an appropriate safe URL type.
  SanitizedContent sanitizedStaticPath =
      UnsafeSanitizedContentOrdainer.ordainAsSafe(
          staticPath, SanitizedContent.ContentKind.TRUSTED_RESOURCE_URI);

  return new SoyMapData(
      "canonicalPath", canonicalPath,
      "staticResourcePath", sanitizedStaticPath,
      "faviconPath", faviconPath);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:IndexServlet.java


示例8: setupRenderer

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
protected void setupRenderer(final SoyTofu.Renderer renderer, final RenderRequest renderRequest, final Optional<SoyMapData> model) {
    if (model.isPresent()) {
        logger.debug("renderer - model is available.");
        renderer.setData(model.get());
    }
    final Optional<SoyMapData> globalModel = renderRequest.getGlobalRuntimeModel();
    if (globalModel.isPresent()) {
        logger.debug("renderer - global runtime model is available.");
        renderer.setIjData(globalModel.get());
    }
    final Optional<SoyMsgBundle> soyMsgBundleOpt = renderRequest.getSoyMsgBundle();
    if (soyMsgBundleOpt.isPresent()) {
        logger.debug("renderer - soyMsgBundle is available.");
        renderer.setMsgBundle(soyMsgBundleOpt.get());
        if (!soyViewConf.globalHotReloadMode()) {
            if (renderRequest.getCompiledTemplates().isPresent()) {
                renderRequest.getCompiledTemplates().get().addToCache(soyMsgBundleOpt.get(), null);
            }
        }
    }
    if (soyViewConf.globalHotReloadMode()) {
        renderer.setDontAddToCache(true);
    }
}
 
开发者ID:matiwinnetou,项目名称:play-soy-view,代码行数:25,代码来源:DefaultTemplateRenderer.java


示例9: getDataForRequest

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
@Nullable
public SoyMapData getDataForRequest(Request baseRequest) throws IOException {
  String path = baseRequest.getPathInfo();
  Matcher matcher = TraceDataHandler.ID_PATTERN.matcher(path);
  if (!matcher.matches()) {
    return null;
  }

  SoyMapData templateData = new SoyMapData();

  String id = matcher.group(1);
  templateData.put("traceId", id);

  // Read the args to `buck` out of the Chrome Trace.
  TraceAttributes traceAttributes = tracesHelper.getTraceAttributesFor(id);
  templateData.put("dateTime", traceAttributes.getFormattedDateTime());
  if (traceAttributes.getCommand().isPresent()) {
    templateData.put("command", traceAttributes.getCommand().get());
  }

  return templateData;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:24,代码来源:TraceHandlerDelegate.java


示例10: resolveData

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) {
    final RequestContext requestContext = new RequestContext(request, response, servletContext, (Map<String, Object>) model);

    if (requestContext.getContextPath() != null) {
        root.put(prefix + "contextPath", requestContext.getContextPath());
    }
    if (requestContext.getPathToServlet() != null) {
        root.put(prefix + "pathToServlet", requestContext.getPathToServlet());
    }
    if (requestContext.getQueryString() != null) {
        root.put(prefix + "queryString", requestContext.getQueryString());
    }
    if (requestContext.getRequestUri() != null) {
        root.put(prefix + "requestUri", requestContext.getRequestUri());
    }
    if (requestContext.getLocale() != null) {
        root.put(prefix + "locale", requestContext.getLocale().toString());
    }
}
 
开发者ID:matiwinnetou,项目名称:spring-soy-view,代码行数:21,代码来源:RequestContextDataResolver.java


示例11: resolveData

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, SoyMapData root) {
    if (servletContext.getContextPath() != null) {
        root.put(prefix + "contextPath", servletContext.getContextPath());
    }

    root.put(prefix + "minorVersion", servletContext.getMinorVersion());
    root.put(prefix + "majorVersion", servletContext.getMajorVersion());
    if (servletContext.getServletContextName() != null) {
        root.put(prefix + "servletContextName", servletContext.getServletContextName());
    }
    if (servletContext.getServerInfo() != null) {
        root.put(prefix + "serverInfo", servletContext.getServerInfo());
    }
    for (final Enumeration<String> e = servletContext.getInitParameterNames(); e.hasMoreElements();) {
        final String paramName = e.nextElement();
        final String paramValue = servletContext.getInitParameter(paramName);
        if (paramValue != null) {
            root.put(prefix + "parameter." + paramName, paramValue);
        }
    }
}
 
开发者ID:matiwinnetou,项目名称:spring-soy-view,代码行数:23,代码来源:ServletContextDataResolver.java


示例12: render

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
public void render(final RenderRequest renderRequest) throws Exception {
    if (!renderRequest.getCompiledTemplates().isPresent()) {
        logger.warn("compiled templates are not present, nothing to render!");
        return;
    }

    final SoyTofu compiledTemplates = renderRequest.getCompiledTemplates().get();

    final String templateName = renderRequest.getTemplateName();
    final SoyTofu.Renderer renderer = compiledTemplates.newRenderer(templateName);

    final Optional<SoyMapData> soyModel = toSoyDataConverter.toSoyMap(renderRequest.getModel());
    setupRenderer(renderer, renderRequest, soyModel);
    writeResponse(renderer, renderRequest);
}
 
开发者ID:matiwinnetou,项目名称:spring-soy-view,代码行数:17,代码来源:DefaultTemplateRenderer.java


示例13: setupRenderer

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
protected void setupRenderer(final SoyTofu.Renderer renderer, final RenderRequest renderRequest, final Optional<SoyMapData> model) throws Exception {
    if (model.isPresent()) {
        renderer.setData(model.get());
    }
    final Optional<SoyMapData> globalModel = renderRequest.getGlobalRuntimeModel();
    if (globalModel.isPresent()) {
        renderer.setIjData(globalModel.get());
    }
    final Optional<SoyMsgBundle> soyMsgBundleOptional = renderRequest.getSoyMsgBundle();
    if (soyMsgBundleOptional.isPresent()) {
        renderer.setMsgBundle(soyMsgBundleOptional.get());
        if (isHotReloadModeOff()) {
            if (renderRequest.getCompiledTemplates().isPresent()) {
                renderRequest.getCompiledTemplates().get().addToCache(soyMsgBundleOptional.get(), null);
            }
        }
    }
    if (isHotReloadMode()) {
        renderer.setDontAddToCache(true);
    }
}
 
开发者ID:matiwinnetou,项目名称:spring-soy-view,代码行数:22,代码来源:DefaultTemplateRenderer.java


示例14: testBindCookies

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Test
public void testBindCookies() throws Exception {
    final SoyMapData soyMapData = new SoyMapData();

    final HttpServletRequest request = mock(HttpServletRequest.class);
    final HttpServletResponse response = mock(HttpServletResponse.class);

    final Enumeration e = mock(Enumeration.class);
    when(e.hasMoreElements()).thenReturn(false);
    when(request.getParameterNames()).thenReturn(e);
    when(request.getHeaderNames()).thenReturn(e);
    when(request.getCookies()).thenReturn(new Cookie[]{new Cookie("name1", "value1"), new Cookie("name2", "value2")});

    cookieResolver.resolveData(request, response, null, soyMapData);

    Assert.assertEquals("should not be value1", "value1", soyMapData.get("_request.cookie.name1.value").stringValue());
    Assert.assertEquals("should not be value2", "value2", soyMapData.get("_request.cookie.name2.value").stringValue());

    Assert.assertEquals("should not be name1", "name1", soyMapData.get("_request.cookie.name1.name").stringValue());
    Assert.assertEquals("should not be name2", "name2", soyMapData.get("_request.cookie.name2.name").stringValue());
}
 
开发者ID:matiwinnetou,项目名称:spring-soy-view,代码行数:22,代码来源:CookieDataResolverTest.java


示例15: initMutatingEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
protected void initMutatingEppToolCommand() {
  setSoyTemplate(DeleteDomainSoyInfo.getInstance(), DeleteDomainSoyInfo.DELETEDOMAIN);
  addSoyRecord(clientId, new SoyMapData(
      "domainName", domainName,
      "reason", reason,
      "requestedByRegistrar", requestedByRegistrar));
}
 
开发者ID:google,项目名称:nomulus,代码行数:9,代码来源:DeleteDomainCommand.java


示例16: initMutatingEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
protected void initMutatingEppToolCommand() throws Exception {
  List<String> roids = Files.readAllLines(roidsFilePath, UTF_8);

  for (String roid : roids) {
    // Look up the HostResource from its roid.
    HostResource host = ofy().load().type(HostResource.class).id(roid).now();
    if (host == null) {
      System.err.printf("Record for %s not found.\n", roid);
      continue;
    }

    ArrayList<SoyMapData> ipAddresses = new ArrayList<>();
    for (InetAddress address : host.getInetAddresses()) {
      SoyMapData dataMap = new SoyMapData(
          "address", address.getHostAddress(),
          "version", address instanceof Inet6Address ? "v6" : "v4");
      ipAddresses.add(dataMap);
    }

    // Build and execute the EPP command.
    setSoyTemplate(
        RemoveIpAddressSoyInfo.getInstance(), RemoveIpAddressSoyInfo.REMOVE_IP_ADDRESS);
    addSoyRecord(registrarId, new SoyMapData(
        "name", host.getFullyQualifiedHostName(),
        "ipAddresses", ipAddresses,
        "requestedByRegistrar", registrarId));
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:30,代码来源:RemoveIpAddressCommand.java


示例17: initEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
void initEppToolCommand() {
  LaunchPhase launchPhase = checkArgumentNotNull(
      LaunchPhase.fromValue(Ascii.toLowerCase(phase)), "Illegal launch phase.");

  setSoyTemplate(
      DomainApplicationInfoSoyInfo.getInstance(),
      DomainApplicationInfoSoyInfo.DOMAINAPPLICATIONINFO);
  addSoyRecord(clientId, new SoyMapData(
      "domainName", domainName,
      "id", id,
      "phase", launchPhase.getPhase(),
      "subphase", launchPhase.getSubphase()));
}
 
开发者ID:google,项目名称:nomulus,代码行数:15,代码来源:DomainApplicationInfoCommand.java


示例18: initMutatingEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
protected void initMutatingEppToolCommand() throws Exception {
  // Project all domains as of the same time so that argument order doesn't affect behavior.
  DateTime now = DateTime.now(UTC);
  for (String domain : getDomains()) {
    DomainResource domainResource = loadByForeignKey(DomainResource.class, domain, now);
    checkArgument(domainResource != null, "Domain '%s' does not exist", domain);
    ImmutableSet<StatusValue> statusesToAdd =
        Sets.difference(REGISTRY_LOCK_STATUSES, domainResource.getStatusValues()).immutableCopy();
    if (statusesToAdd.isEmpty()) {
      logger.infofmt("Domain '%s' is already locked and needs no updates.", domain);
      continue;
    }

    setSoyTemplate(DomainUpdateSoyInfo.getInstance(), DomainUpdateSoyInfo.DOMAINUPDATE);
    addSoyRecord(
        clientId,
        new SoyMapData(
            "domain", domain,
            "add", true,
            "addNameservers", ImmutableList.of(),
            "addAdmins", ImmutableList.of(),
            "addTechs", ImmutableList.of(),
            "addStatuses",
                statusesToAdd.stream().map(StatusValue::getXmlName).collect(toImmutableList()),
            "remove", false,
            "removeNameservers", ImmutableList.of(),
            "removeAdmins", ImmutableList.of(),
            "removeTechs", ImmutableList.of(),
            "removeStatuses", ImmutableList.of(),
            "change", false));
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:34,代码来源:LockDomainCommand.java


示例19: initEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
void initEppToolCommand() {
  Multimap<String, String> domainNameMap = validateAndGroupDomainNamesByTld(mainParameters);
  for (Collection<String> values : domainNameMap.asMap().values()) {
    setSoyTemplate(DomainCheckFeeSoyInfo.getInstance(), DomainCheckFeeSoyInfo.DOMAINCHECKFEE);
    addSoyRecord(clientId, new SoyMapData("domainNames", values));
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:9,代码来源:DomainCheckFeeCommand.java


示例20: initEppToolCommand

import com.google.template.soy.data.SoyMapData; //导入依赖的package包/类
@Override
void initEppToolCommand() {
  Multimap<String, String> domainNameMap = validateAndGroupDomainNamesByTld(mainParameters);
  for (Collection<String> values : domainNameMap.asMap().values()) {
    setSoyTemplate(
        DomainCheckClaimsSoyInfo.getInstance(), DomainCheckClaimsSoyInfo.DOMAINCHECKCLAIMS);
    addSoyRecord(clientId, new SoyMapData("domainNames", values));
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:10,代码来源:DomainCheckClaimsCommand.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WebBrowser类代码示例发布时间:2022-05-22
下一篇:
Java OpenIDException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap