本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
示例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;
}