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


Java Hallmark类代码示例

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


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

示例1: processRequest

import nxt.peer.Hallmark; //导入依赖的package包/类
@Override
JSONStreamAware processRequest(HttpServletRequest req) {

    String hallmarkValue = req.getParameter("hallmark");
    if (hallmarkValue == null) {
        return MISSING_HALLMARK;
    }

    try {

        Hallmark hallmark = Hallmark.parseHallmark(hallmarkValue);

        return JSONData.hallmark(hallmark);

    } catch (RuntimeException e) {
        return INCORRECT_HALLMARK;
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:19,代码来源:DecodeHallmark.java

示例2: processRequest

import nxt.peer.Hallmark; //导入依赖的package包/类
@Override
JSONStreamAware processRequest(HttpServletRequest req) {

    String hallmarkValue = req.getParameter("hallmark");
    if (hallmarkValue == null) {
        return MISSING_HALLMARK;
    }

    try {

        Hallmark hallmark = Hallmark.parseHallmark(hallmarkValue);

        JSONObject response = new JSONObject();
        response.put("account", Convert.toUnsignedLong(Account.getId(hallmark.getPublicKey())));
        response.put("host", hallmark.getHost());
        response.put("weight", hallmark.getWeight());
        String dateString = Hallmark.formatDate(hallmark.getDate());
        response.put("date", dateString);
        response.put("valid", hallmark.isValid());

        return response;

    } catch (RuntimeException e) {
        return INCORRECT_HALLMARK;
    }
}
 
开发者ID:aspnmy,项目名称:NasCoin,代码行数:27,代码来源:DecodeHallmark.java

示例3: processRequest

import nxt.peer.Hallmark; //导入依赖的package包/类
JSONStreamAware processRequest(HttpServletRequest paramHttpServletRequest)
{
  String str1 = paramHttpServletRequest.getParameter("hallmark");
  if (str1 == null) {
    return JSONResponses.MISSING_HALLMARK;
  }
  try
  {
    Hallmark localHallmark = Hallmark.parseHallmark(str1);
    
    JSONObject localJSONObject = new JSONObject();
    localJSONObject.put("account", Convert.toUnsignedLong(Account.getId(localHallmark.getPublicKey())));
    localJSONObject.put("host", localHallmark.getHost());
    localJSONObject.put("weight", Integer.valueOf(localHallmark.getWeight()));
    String str2 = Hallmark.formatDate(localHallmark.getDate());
    localJSONObject.put("date", str2);
    localJSONObject.put("valid", Boolean.valueOf(localHallmark.isValid()));
    
    return localJSONObject;
  }
  catch (RuntimeException localRuntimeException) {}
  return JSONResponses.INCORRECT_HALLMARK;
}
 
开发者ID:stevedoe,项目名称:nxt-client,代码行数:24,代码来源:DecodeHallmark.java

示例4: processRequest

import nxt.peer.Hallmark; //导入依赖的package包/类
JSONStreamAware processRequest(HttpServletRequest paramHttpServletRequest)
{
  String str1 = paramHttpServletRequest.getParameter("secretPhrase");
  String str2 = paramHttpServletRequest.getParameter("host");
  String str3 = paramHttpServletRequest.getParameter("weight");
  String str4 = paramHttpServletRequest.getParameter("date");
  if (str1 == null) {
    return JSONResponses.MISSING_SECRET_PHRASE;
  }
  if (str2 == null) {
    return JSONResponses.MISSING_HOST;
  }
  if (str3 == null) {
    return JSONResponses.MISSING_WEIGHT;
  }
  if (str4 == null) {
    return JSONResponses.MISSING_DATE;
  }
  if (str2.length() > 100) {
    return JSONResponses.INCORRECT_HOST;
  }
  int i;
  try
  {
    i = Integer.parseInt(str3);
    if ((i <= 0) || (i > 1000000000L)) {
      return JSONResponses.INCORRECT_WEIGHT;
    }
  }
  catch (NumberFormatException localNumberFormatException)
  {
    return JSONResponses.INCORRECT_WEIGHT;
  }
  try
  {
    String str5 = Hallmark.generateHallmark(str1, str2, i, Hallmark.parseDate(str4));
    
    JSONObject localJSONObject = new JSONObject();
    localJSONObject.put("hallmark", str5);
    return localJSONObject;
  }
  catch (RuntimeException localRuntimeException) {}
  return JSONResponses.INCORRECT_DATE;
}
 
开发者ID:stevedoe,项目名称:nxt-client,代码行数:45,代码来源:MarkHost.java


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