com.blade.kit.DateKit Java Examples
The following examples show how to use
com.blade.kit.DateKit.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContentsService.java From tale with MIT License | 6 votes |
/** * 编辑文章 * * @param contents 文章对象 */ public void updateArticle(Contents contents) { contents.setModified(DateKit.nowUnix()); contents.setContent(EmojiParser.parseToAliases(contents.getContent())); contents.setTags(contents.getTags() != null ? contents.getTags() : ""); contents.setCategories(contents.getCategories() != null ? contents.getCategories() : ""); String tags = contents.getTags(); String categories = contents.getCategories(); Integer cid = contents.getCid(); contents.update(cid); if (null != contents.getType() && !contents.getType().equals(Types.PAGE)) { new Relationships().delete("cid", cid); } metasService.saveMetas(cid, tags, Types.TAG); metasService.saveMetas(cid, categories, Types.CATEGORY); }
Example #2
Source File: SiteService.java From tale with MIT License | 6 votes |
private Archive parseArchive(Archive archive) { String date_str = archive.getDate_str(); Date sd = DateKit.toDate(date_str + "01", "yyyy年MM月dd"); archive.setDate(sd); int start = DateKit.toUnix(sd); Calendar calender = Calendar.getInstance(); calender.setTime(sd); calender.add(Calendar.MONTH, 1); Date endSd = calender.getTime(); int end = DateKit.toUnix(endSd) - 1; List<Contents> contents = new Contents().where("type", Types.ARTICLE) .and("status", Types.PUBLISH) .and("created", ">", start) .and("created", "<", end) .findAll(OrderBy.desc("created")); archive.setArticles(contents); return archive; }
Example #3
Source File: SiteService.java From tale with MIT License | 6 votes |
/** * 初始化站点 * * @param users 用户 */ public void initSite(Users users) { String pwd = EncryptKit.md5(users.getUsername() + users.getPassword()); users.setPassword(pwd); users.setScreen_name(users.getUsername()); users.setCreated(DateKit.nowUnix()); Integer uid = users.save(); try { String cp = SiteService.class.getClassLoader().getResource("").getPath(); File lock = new File(cp + "install.lock"); lock.createNewFile(); TaleConst.INSTALLED = Boolean.TRUE; new Logs(LogActions.INIT_SITE, null, "", uid.intValue()).save(); } catch (Exception e) { throw new TipException("初始化站点失败"); } }
Example #4
Source File: CommentsService.java From tale with MIT License | 6 votes |
/** * 保存评论 * * @param comments */ public void saveComment(Comments comments) { if (comments.getContent().length() < 5 || comments.getContent().length() > 2000) { throw new TipException("评论字数在5-2000个字符"); } if (null == comments.getCid()) { throw new TipException("评论文章不能为空"); } Contents contents = new Contents().where("cid", comments.getCid()).find(); if (null == contents) { throw new TipException("不存在的文章"); } try { comments.setOwner_id(contents.getAuthorId()); comments.setCreated(DateKit.nowUnix()); comments.setParent(comments.getCoid()); comments.setCoid(null); comments.save(); Contents temp = new Contents(); temp.setCommentsNum(contents.getCommentsNum() + 1); temp.update(contents.getCid()); } catch (Exception e) { throw e; } }
Example #5
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 5 votes |
/** * 显示微信登陆二维码 */ public void showQrCode() { // post请求"https://login.weixin.qq.com/qrcode/" + this.uuid; 可以获取到微信的登陆二维码 String url = WechatInterface.SHOWQRCODEURL + this.Uuid; //将二维码存储在根目录下面 final File output = new File("temp.jpg"); //通过post 获取到二维码信息,并且将二维码存储在output(根目录下面temp.jpg)文件中 HttpRequest.post(url, true, "t", "webwx", "_", DateKit.getCurrentUnixTime()).receive(output); //判断:output不等于空, //isFile()测试此抽象路径名表示的文件是否是一个标准文件 //exists()测试此抽象路径名表示的文件或目录是否存在 if (null != output && output.exists() && output.isFile()) { //调用Runnable线程 EventQueue.invokeLater(new Runnable() { @Override //覆写Runnable线程类中的run()方法 public void run() { try { //设置窗口外观 //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); //将二维码传到qrCodeFrame 窗体中,并显示出来 qrCodeFrame = new QRCodeFrame(output.getPath()); } catch (Exception e) { e.printStackTrace(); } } }); } }
Example #6
Source File: HttpServerInitializer.java From blade with Apache License 2.0 | 5 votes |
public HttpServerInitializer(SslContext sslCtx, Blade blade, ScheduledExecutorService service) { this.sslCtx = sslCtx; this.blade = blade; this.useGZIP = blade.environment().getBoolean(Const.ENV_KEY_GZIP_ENABLE, false); this.isWebSocket = blade.routeMatcher().getWebSockets().size() > 0; this.httpServerHandler = new HttpServerHandler(); service.scheduleWithFixedDelay(() -> date = DateKit.gmtDate(LocalDateTime.now()), 1000, 1000, TimeUnit.MILLISECONDS); }
Example #7
Source File: OutputStreamWrapper.java From blade with Apache License 2.0 | 5 votes |
@Override public void close() throws IOException { try { this.flush(); FileChannel file = new FileInputStream(this.file).getChannel(); long fileLength = file.size(); HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK); httpResponse.headers().set(HttpConst.CONTENT_LENGTH, fileLength); httpResponse.headers().set(HttpConst.DATE, DateKit.gmtDate()); httpResponse.headers().set(HttpConst.SERVER, "blade/" + Const.VERSION); boolean keepAlive = WebContext.request().keepAlive(); if (keepAlive) { httpResponse.headers().set(HttpConst.CONNECTION, HttpConst.KEEP_ALIVE); } // Write the initial line and the header. ctx.write(httpResponse); ctx.write(new DefaultFileRegion(file, 0, fileLength), ctx.newProgressivePromise()); // Write the end marker. ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } finally { if(null != outputStream){ outputStream.close(); } } }
Example #8
Source File: Logs.java From tale with MIT License | 5 votes |
public Logs(String action, String data, String ip, Integer uid) { this.action = action; this.data = data; this.ip = ip; this.author_id = uid; this.created = DateKit.nowUnix(); }
Example #9
Source File: TaleUtils.java From tale with MIT License | 5 votes |
public static String getFileKey(String name) { String prefix = "/upload/" + DateKit.toString(new Date(), "yyyy/MM"); String dir = UP_DIR + prefix; if (!Files.exists(Paths.get(dir))) { new File(dir).mkdirs(); } return prefix + "/" + com.blade.kit.UUID.UU32() + "." + StringKit.fileExt(name); }
Example #10
Source File: TaleUtils.java From tale with MIT License | 5 votes |
/** * 获取RSS输出 * * @param articles * @return * @throws FeedException */ public static String getRssXml(java.util.List<Contents> articles) throws FeedException { Channel channel = new Channel("rss_2.0"); channel.setTitle(TaleConst.OPTIONS.get("site_title", "")); channel.setLink(Commons.site_url()); channel.setDescription(TaleConst.OPTIONS.get("site_description", "")); channel.setLanguage("zh-CN"); java.util.List<Item> items = new ArrayList<>(); articles.forEach(post -> { Item item = new Item(); item.setTitle(post.getTitle()); Content content = new Content(); String value = Theme.article(post.getContent()); char[] xmlChar = value.toCharArray(); for (int i = 0; i < xmlChar.length; ++i) { if (xmlChar[i] > 0xFFFD) { //直接替换掉0xb xmlChar[i] = ' '; } else if (xmlChar[i] < 0x20 && xmlChar[i] != 't' & xmlChar[i] != 'n' & xmlChar[i] != 'r') { //直接替换掉0xb xmlChar[i] = ' '; } } value = new String(xmlChar); content.setValue(value); item.setContent(content); item.setLink(Theme.permalink(post.getCid(), post.getSlug())); item.setPubDate(DateKit.toDate(post.getCreated())); items.add(item); }); channel.setItems(items); WireFeedOutput out = new WireFeedOutput(); return out.outputString(channel); }
Example #11
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 5 votes |
/** * 发送消息 */ private void webwxsendmsg(String content, String to) { String url = this.BASE_URL + "/webwxsendmsg?lang=zh_CN&pass_ticket=" + this.PASS_TICKET; JSONObject body = new JSONObject(); String clientMsgId = DateKit.getCurrentUnixTime() + StringKit.getRandomNumber(5); JSONObject Msg = new JSONObject(); Msg.put("Type", 1); Msg.put("Content", content); Msg.put("FromUserName", User.getString("UserName")); Msg.put("ToUserName", to); Msg.put("LocalID", clientMsgId); Msg.put("ClientMsgId", clientMsgId); body.put("BaseRequest", this.BaseRequest); body.put("Msg", Msg); HttpRequest request = HttpRequest.post(url) .header("Content-Type", "application/json;charset=utf-8") .header("Cookie", this.Cookie) .send(body.toString()); LOGGER.info("[*] " + request); request.body(); request.disconnect(); }
Example #12
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 5 votes |
/** * 微信状态通知 */ public boolean wxStatusNotify() { String Url = this.BASE_URL + WechatInterface.WXSTATUS_CODE + this.PASS_TICKET; JSONObject body = new JSONObject(); body.put("BaseRequest", BaseRequest); body.put("Code", 3); body.put("FromUserName", this.User.getString("UserName")); body.put("ToUserName", this.User.getString("UserName")); body.put("ClientMsgId", DateKit.getCurrentUnixTime()); HttpRequest request = HttpRequest.post(Url) .header("Content-Type", "application/json;charset=utf-8") .header("Cookie", this.Cookie) .send(body.toString()); LOGGER.info("[*] " + request); String res = request.body(); request.disconnect(); if (StringKit.isBlank(res)) { return false; } try { JSONObject jsonObject = (JSONObject) JSON.parse(res); JSONObject BaseResponse = (JSONObject) jsonObject.get("BaseResponse"); if (null != BaseResponse) { int ret = BaseResponse.getInt("Ret", -1); return ret == 0; } } catch (Exception e) { } return false; }
Example #13
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 5 votes |
/** * 等待登录 * 扫描二维码并登陆 */ public String waitForLogin() { this.Tip = 1; HttpRequest request = HttpRequest.get(WechatInterface.LOGIN_URL, true, "tip", this.Tip, "uuid", this.Uuid, "_", DateKit.getCurrentUnixTime()); LOGGER.info("[*] " + request.toString()); String Res = request.body(); request.disconnect(); if (null == Res) { LOGGER.info("[*] 扫描二维码验证失败"); return ""; } String Code = Matchers.match("window.code=(\\d+);", Res); if (null == Code) { LOGGER.info("[*] 扫描二维码验证失败"); return ""; } else { if (Code.equals("201")) { LOGGER.info("[*] 成功扫描,请在手机上点击确认以登录"); Tip = 0; } else if (Code.equals("200")) { LOGGER.info("[*] 正在登录..."); String pm = Matchers.match("window.redirect_uri=\"(\\S+?)\";", Res); this.REDIRECT_URL = pm + "&fun=new"; LOGGER.info("[*] redirect_uri=%s"+this.REDIRECT_URL); this.BASE_URL = this.REDIRECT_URL.substring(0, this.REDIRECT_URL.lastIndexOf("/")); LOGGER.info("[*] base_uri=%s"+ this.BASE_URL); } else if (Code.equals("408")) { LOGGER.info("[*] 登录超时"); } else { LOGGER.info("[*] 扫描code=%s"+ Code); } } return Code; }
Example #14
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 5 votes |
/** * 获取UUID:uuid是唯一的识别码 */ public String getUUID() { HttpRequest request = HttpRequest.get(WechatInterface.UUID_URL, true, "appid", "wx782c26e4c19acffb", "fun", "new", "lang", "zh_CN", "_", DateKit.getCurrentUnixTime()); // LOGGER.info 记录信息 LOGGER.info("[*] " + request); String res = request.body(); //res 为UUID request.disconnect(); //如果返回的uuid信息不等于空 if (StringKit.isNotBlank(res)) { //将登陆信息赋值给code String code = Matchers.match("window.QRLogin.code = (\\d+);", res); //如果登陆信息不等于空,那么微信登陆成功,否则反馈错误状态码 if (null != code) { if (code.equals("200")) { this.Uuid = Matchers.match("window.QRLogin.uuid = \"(.*)\";", res); return this.Uuid; } else { LOGGER.info("[*] 错误的状态码: %s"+ code); } } } return null; }
Example #15
Source File: TaleUtils.java From tale with MIT License | 4 votes |
private static Url parse(Contents contents) { Url url = new Url(Commons.site_url() + "/article/" + contents.getCid()); url.lastmod = DateKit.toString(contents.getModified(), "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); return url; }
Example #16
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 4 votes |
/** * 获取最新消息 */ public JSONObject webwxsync() { String url = this.BASE_URL + "/webwxsync?lang=zh_CN&pass_ticket=" + this.PASS_TICKET + "&skey=" + this.SKEY + "&sid=" + this.WXSID + "&r=" + DateKit.getCurrentUnixTime(); JSONObject body = new JSONObject(); body.put("BaseRequest", BaseRequest); body.put("SyncKey", this.SyncKey); body.put("rr", DateKit.getCurrentUnixTime()); HttpRequest request = HttpRequest.post(url) .header("Content-Type", "application/json;charset=utf-8") .header("Cookie", this.Cookie) .send(body.toString()); LOGGER.info("[*] " + request); String res = request.body(); request.disconnect(); if (StringKit.isBlank(res)) { return null; } JSONObject jsonObject = (JSONObject) JSON.parse(res); JSONObject BaseResponse = (JSONObject) jsonObject.get("BaseResponse"); if (null != BaseResponse) { int ret = BaseResponse.getInt("Ret", -1); if (ret == 0) { this.SyncKey = (JSONObject) jsonObject.get("SyncKey"); StringBuffer synckey = new StringBuffer(); JSONArray list = (JSONArray) SyncKey.get("List"); for (int i = 0, len = list.size(); i < len; i++) { JSONObject item = (JSONObject) list.get(i); synckey.append("|" + item.getInt("Key", 0) + "_" + item.getInt("Val", 0)); } this.SYNCKEY = synckey.substring(1); } } return jsonObject; }
Example #17
Source File: AuthController.java From tale with MIT License | 4 votes |
@Route(value = "login", method = HttpMethod.POST) @JSON public RestResponse doLogin(LoginParam loginParam, Request request, Session session, Response response) { Integer error_count = cache.get("login_error_count"); try { error_count = null == error_count ? 0 : error_count; if (null != error_count && error_count > 3) { return RestResponse.fail("您输入密码已经错误超过3次,请10分钟后尝试"); } long count = new Users().where("username", loginParam.getUsername()).count(); if (count < 1) { return RestResponse.fail("不存在该用户"); } String pwd = EncryptKit.md5(loginParam.getUsername(), loginParam.getPassword()); Users user = new Users().where("username", loginParam.getUsername()).and("password", pwd).find(); if (null == user) { return RestResponse.fail("用户名或密码错误"); } session.attribute(TaleConst.LOGIN_SESSION_KEY, user); if (StringKit.isNotBlank(loginParam.getRemeberMe())) { TaleUtils.setCookie(response, user.getUid()); } Users temp = new Users(); temp.setLogged(DateKit.nowUnix()); temp.update(user.getUid()); log.info("登录成功:{}", loginParam.getUsername()); cache.set("login_error_count", 0); new Logs(LogActions.LOGIN, loginParam.getUsername(), request.address(), user.getUid()).save(); } catch (Exception e) { error_count += 1; cache.set("login_error_count", error_count, 10 * 60); String msg = "登录失败"; if (e instanceof TipException) { msg = e.getMessage(); } else { log.error(msg, e); } return RestResponse.fail(msg); } return RestResponse.ok(); }
Example #18
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 4 votes |
/** * 消息检查 */ public int[] syncCheck() { int[] arr = new int[2]; String Url = this.WEBPUSH_URL + "/synccheck"; JSONObject body = new JSONObject(); body.put("BaseRequest", BaseRequest); HttpRequest request = null; String res = null; request = HttpRequest.get(Url, true, "r", DateKit.getCurrentUnixTime() + StringKit.getRandomNumber(5), "skey", this.SKEY, "uin", this.WXUIN, "sid", this.WXSID, "deviceid", this.DEVICEID, "synckey", this.SYNCKEY, "_", System.currentTimeMillis()) .header("Cookie", this.Cookie); LOGGER.info("[*] " + request); // 当res为空的时候,程序就开始报错了 //res = request.body(); /** * 循环的作用是排错 * 原理:当res 为空的情况下,会一直循环获取内容,直到有内容的才跳出循环 */ int i = 1; while (i > 0) { // 当 res 出错的时候,异常不处理,res 字符串为空;然后继续执行循环提,直到拿到内容。 try { res = request.body(); } catch (Exception e) { res = ""; } if (res != null || "".equals(res) || res.length() != 0) { break; } } request.disconnect(); if (StringKit.isBlank(res)) { return arr; } String retcode = Matchers.match("retcode:\"(\\d+)\",", res); String selector = Matchers.match("selector:\"(\\d+)\"}", res); if (null != retcode && null != selector) { arr[0] = Integer.parseInt(retcode); arr[1] = Integer.parseInt(selector); return arr; } return arr; }
Example #19
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 4 votes |
/** * 获取联系人 */ public boolean getContact() { String url = this.BASE_URL + "/webwxgetcontact?pass_ticket=" + this.PASS_TICKET + "&skey=" + this.SKEY + "&r=" + DateKit.getCurrentUnixTime(); JSONObject body = new JSONObject(); body.put("BaseRequest", BaseRequest); HttpRequest request = HttpRequest.post(url) .header("Content-Type", "application/json;charset=utf-8") .header("Cookie", this.Cookie) .send(body.toString()); LOGGER.info("[*] " + request); String res = request.body(); request.disconnect(); if (StringKit.isBlank(res)) { return false; } try { JSONObject jsonObject = (JSONObject) JSON.parse(res); //AddressBook类的作用: //1.导出好友列表 //2.判断好友是否在数据库中存在,如果是数据库中不存在的好友,那么会将最新的好友存储在数据库中 AddressBook.getAddressBookList(jsonObject); JSONObject BaseResponse = (JSONObject) jsonObject.get("BaseResponse"); if (null != BaseResponse) { int ret = BaseResponse.getInt("Ret", -1); if (ret == 0) { this.MemberList = (JSONArray) jsonObject.get("MemberList"); this.ContactList = new JSONArray(); if (null != MemberList) { for (int i = 0, len = MemberList.size(); i < len; i++) { JSONObject contact = (JSONObject) this.MemberList.get(i); //公众号/服务号 if (contact.getInt("VerifyFlag", 0) == 8) { continue; } //特殊联系人 // if (SpecialUsers.contains(contact.getString("UserName"))) { // continue; // } //群聊 if (contact.getString("UserName").indexOf("@@") != -1) { continue; } //自己 if (contact.getString("UserName").equals(this.User.getString("UserName"))) { continue; } ContactList.add(contact); } return true; } } } } catch (Exception e) { } return false; }
Example #20
Source File: SiteService.java From tale with MIT License | 4 votes |
/** * 系统备份 * * @param bkType * @param bkPath * @param fmt */ public BackResponse backup(String bkType, String bkPath, String fmt) throws Exception { BackResponse backResponse = new BackResponse(); if ("attach".equals(bkType)) { if (StringKit.isBlank(bkPath)) { throw new TipException("请输入备份文件存储路径"); } if (!Files.isDirectory(Paths.get(bkPath))) { throw new TipException("请输入一个存在的目录"); } String bkAttachDir = AttachController.CLASSPATH + "upload"; String bkThemesDir = AttachController.CLASSPATH + "templates/themes"; String fname = DateKit.toString(new Date(), fmt) + "_" + StringKit.rand(5) + ".zip"; String attachPath = bkPath + "/" + "attachs_" + fname; String themesPath = bkPath + "/" + "themes_" + fname; ZipUtils.zipFolder(bkAttachDir, attachPath); ZipUtils.zipFolder(bkThemesDir, themesPath); backResponse.setAttach_path(attachPath); backResponse.setTheme_path(themesPath); } // 备份数据库 if ("db".equals(bkType)) { String filePath = "upload/" + DateKit.toString(new Date(), "yyyyMMddHHmmss") + "_" + StringKit.rand(8) + ".db"; String cp = AttachController.CLASSPATH + filePath; Files.createDirectory(Paths.get(cp)); Files.copy(Paths.get(SqliteJdbc.DB_PATH), Paths.get(cp)); backResponse.setSql_path("/" + filePath); // 10秒后删除备份文件 new Timer().schedule(new TimerTask() { @Override public void run() { new File(cp).delete(); } }, 10 * 1000); } return backResponse; }
Example #21
Source File: ContentsService.java From tale with MIT License | 4 votes |
/** * 发布文章 * * @param contents 文章对象 */ public Integer publish(Contents contents) { if (null == contents) { throw new TipException("文章对象为空"); } if (StringKit.isBlank(contents.getTitle())) { throw new TipException("文章标题不能为空"); } if (contents.getTitle().length() > TaleConst.MAX_TITLE_COUNT) { throw new TipException("文章标题最多可以输入" + TaleConst.MAX_TITLE_COUNT + "个字符"); } if (StringKit.isBlank(contents.getContent())) { throw new TipException("文章内容不能为空"); } // 最多可以输入5w个字 int len = contents.getContent().length(); if (len > TaleConst.MAX_TEXT_COUNT) { throw new TipException("文章内容最多可以输入" + TaleConst.MAX_TEXT_COUNT + "个字符"); } if (null == contents.getAuthorId()) { throw new TipException("请登录后发布文章"); } if (StringKit.isNotBlank(contents.getSlug())) { if (contents.getSlug().length() < 5) { throw new TipException("路径太短了"); } if (!TaleUtils.isPath(contents.getSlug())) { throw new TipException("您输入的路径不合法"); } long count = new Contents().where("type", contents.getType()).and("slug", contents.getSlug()).count(); if (count > 0) { throw new TipException("该路径已经存在,请重新输入"); } } contents.setContent(EmojiParser.parseToAliases(contents.getContent())); int time = DateKit.nowUnix(); contents.setCreated(time); contents.setModified(time); String tags = contents.getTags(); String categories = contents.getCategories(); Integer cid = contents.save(); metasService.saveMetas(cid, tags, Types.TAG); metasService.saveMetas(cid, categories, Types.CATEGORY); return cid; }
Example #22
Source File: WechatApp.java From squirrelAI with Apache License 2.0 | 4 votes |
/** * 微信初始化 */ public boolean wxInit() { String url = this.BASE_URL + "/webwxinit?r=" + DateKit.getCurrentUnixTime() + "&pass_ticket=" + this.PASS_TICKET + "&skey=" + this.SKEY; JSONObject body = new JSONObject(); body.put("BaseRequest", this.BaseRequest); HttpRequest request = HttpRequest.post(url) .header("Content-Type", "application/json;charset=utf-8") .header("Cookie", this.Cookie) .send(body.toString()); LOGGER.info("[*] " + request); String res = request.body(); request.disconnect(); if (StringKit.isBlank(res)) { return false; } try { JSONObject jsonObject = (JSONObject) JSON.parse(res); if (null != jsonObject) { JSONObject BaseResponse = (JSONObject) jsonObject.get("BaseResponse"); if (null != BaseResponse) { int ret = BaseResponse.getInt("Ret", -1); if (ret == 0) { this.SyncKey = (JSONObject) jsonObject.get("SyncKey"); this.User = (JSONObject) jsonObject.get("User"); StringBuffer synckey = new StringBuffer(); JSONArray list = (JSONArray) SyncKey.get("List"); for (int i = 0, len = list.size(); i < len; i++) { JSONObject item = (JSONObject) list.get(i); synckey.append("|" + item.getInt("Key", 0) + "_" + item.getInt("Val", 0)); } this.SYNCKEY = synckey.substring(1); return true; } } } } catch (Exception e) { } return false; }
Example #23
Source File: RestResponse.java From blade with Apache License 2.0 | 4 votes |
public RestResponse() { this.timestamp = DateKit.nowUnix(); }
Example #24
Source File: RestResponse.java From blade with Apache License 2.0 | 4 votes |
public RestResponse(boolean success) { this.timestamp = DateKit.nowUnix(); this.success = success; }
Example #25
Source File: RestResponse.java From blade with Apache License 2.0 | 4 votes |
public RestResponse(boolean success, T payload) { this.timestamp = DateKit.nowUnix(); this.success = success; this.payload = payload; }