當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpServerRequest.getParam方法代碼示例

本文整理匯總了Java中io.vertx.core.http.HttpServerRequest.getParam方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpServerRequest.getParam方法的具體用法?Java HttpServerRequest.getParam怎麽用?Java HttpServerRequest.getParam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.core.http.HttpServerRequest的用法示例。


在下文中一共展示了HttpServerRequest.getParam方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateAlipayPaySetting

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
private void updateAlipayPaySetting(RoutingContext rc) {
    if (forbidAccess(rc, "uid", true)) {
        return;
    }
    HttpServerRequest req = rc.request();
    HttpServerResponse resp = rc.response().putHeader("content-type", "application/json; charset=utf-8");
    //解析參數
    Long uid = Long.parseLong(req.getParam("uid"));
    Integer paySwitch = Integer.parseInt(req.getParam("paySwitch"));
    String appId = req.getParam("appId");
    String appPrivKey = req.getParam("appPrivKey");
    String zfbPubKey = req.getParam("zfbPubKey");

    //參數檢查
    if (paySwitch == 1 && !CommonUtils.notEmptyString(appId, appPrivKey, zfbPubKey)) {
        resp.end(new JsonObject().put("status", "invalid").toString());
        return;
    }

    //保存支付參數
    JsonObject acc = new JsonObject().put(ID, uid).put(ZFBAPPID, appId).put(ZFBPRIVKEY, appPrivKey).put(ZFBPUBKEY, zfbPubKey).put(ZFBPAYON, paySwitch);
    updatePaySetting(resp, acc, COMMAND_UPDATE_ALIPAY);
}
 
開發者ID:Leibnizhu,項目名稱:AlipayWechatPlatform,代碼行數:24,代碼來源:PaySettingSubRouter.java

示例2: updateOfficialAccount

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
/**
 * 更新公眾號配置
 * 請求方法:PUT
 * 請求參數:id,name郵箱,appid,appsecret,verify
 * 響應:success或fail
 */
private void updateOfficialAccount(RoutingContext rc) {
    if (forbidAccess(rc, "id", true)) {
        return;
    }
    HttpServerRequest req = rc.request();
    Long id = Long.valueOf(req.getParam("id"));
    String name = req.getParam("name");
    String appid = req.getParam("appid");
    String appsecret = req.getParam("appsecret");
    String verify = req.getParam("verify");
    JsonObject updateAcc = new JsonObject().put(ID, id).put(NAME, name).put(WXAPPID, appid).put(WXAPPSECRET, appsecret).put(VERIFY, verify);
    log.debug("更新公眾號配置:{}", updateAcc);
    vertx.eventBus().<Integer>send(ADDR_ACCOUNT_DB.get(), makeMessage(COMMAND_UPDATE_NORMAL, updateAcc), ar -> {
        HttpServerResponse response = rc.response();
        if(ar.succeeded()){
            Integer rows = ar.result().body();
            response.putHeader("content-type", "application/json; charset=utf-8").end(rows > 0 ? "success" : "fail");
        } else {
            log.error("EventBus消息響應錯誤", ar.cause());
            response.setStatusCode(500).end("EventBus error!");
        }
    });
}
 
開發者ID:Leibnizhu,項目名稱:AlipayWechatPlatform,代碼行數:30,代碼來源:OfficialAccountSubRouter.java

示例3: handle

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
public void handle(RoutingContext ctx) {
    HttpServerResponse response = ctx.response();
    HttpServerRequest request = ctx.request();
    String apiKey = request.getParam("api_key");
    String host = request.getParam("host_name");
    if (Guardian.checkParameters(apiKey, host) && userManager.isLogined(ctx)) {
        try {
            String uid = userManager.getUid(userManager.getIdFromSession(ctx));
            if(requestManager.addHost(uid, apiKey, host)){
                response.setStatusCode(200);
            }else{
                response.setStatusCode(304);
            }
        } catch (SQLException e) {
            e.printStackTrace();
            response.setStatusCode(500);
        }
    } else {
        response.setStatusCode(400);
    }
    response.end();
    response.close();
}
 
開發者ID:DSM-DMS,項目名稱:DMS,代碼行數:24,代碼來源:APIHostAddRouter.java

示例4: getDevNode

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
public Node getDevNode(App app,HttpServerRequest clientRequest){
	String hostport = clientRequest.getParam(app.name);
	String remoteip = clientRequest.remoteAddress().host();
	if(S.isNotBlank(hostport)){
		if("clear".equals(hostport)){
			devMode.remove(remoteip);
			log.debug("clear node of remote ip:"+remoteip);
			return null;
		}else{
			String[] ipp = hostport.split(":");
			Node n = app.createDevNode(ipp[0], Integer.parseInt(ipp[1]),1);
			devMode.put(remoteip, n);
			log.debug("remote ip visit setting:"+remoteip+" ["+app.name+"->"+hostport+"]");
			return n;
		}
	}else{
		return devMode.get(remoteip);
	}
}
 
開發者ID:troopson,項目名稱:etagate,代碼行數:20,代碼來源:DevModeSupport.java

示例5: oauthSuccessProcess

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
/**
 * 解析授權前訪問的地址,解析所需的json並編碼,最後重定向
 *
 * @param req      HTTP請求對象
 * @param resp     HTTP響應對象
 * @param res      ALipay接口返回的響應
 * @param callback 解析地址後的處理方法
 * @author Leibniz.Hu
 */
private void oauthSuccessProcess(HttpServerRequest req, HttpServerResponse resp, AlipayResponse res, Handler<String> callback) {
    if (res != null) {
        String visitUrl = req.getParam("visitUrl");//getRedirectAddress(request, REMOVE_PARAMS);
        if (visitUrl.length() > 0) {
            visitUrl = TuringBase64Util.decode(visitUrl).replaceAll("[\\s*\t\n\r]", "");
            callback.handle(visitUrl);
            resp.setStatusCode(302).putHeader("Location", visitUrl + (visitUrl.contains("?") ? "&rs=" : "?rs=") + TuringBase64Util.encode(getClearJson(res).toString())).end();
        } else {
            log.error("沒有找到授權後回調地址" + req.absoluteURI());
            resp.end("未設置授權後回調地址");
        }
    }
}
 
開發者ID:Leibnizhu,項目名稱:AlipayWechatPlatform,代碼行數:23,代碼來源:AlipayOauthSubRouter.java

示例6: getParam

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
private static String getParam(String mountPoint, HttpServerRequest request, int index) {

		String param = request.getParam("param" + index);
		if (param == null) { // failed to get directly ... try from request path

			String path = removeMountPoint(mountPoint, request.path());

			String[] items = path.split("/");
			if (index < items.length) { // simplistic way to find param value from path by index
				return items[index];
			}
		}

		return null;
	}
 
開發者ID:zandero,項目名稱:rest.vertx,代碼行數:16,代碼來源:ArgumentProvider.java

示例7: register

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
private void register(RoutingContext rc) {
    HttpServerRequest req = rc.request();
    HttpServerResponse resp = rc.response();
    String email = req.getParam("email");
    String name = req.getParam("name");
    String password = req.getParam("password");
    String rePassword = req.getParam("repassword");

    //參數判定
    if (email == null || email.trim().length() == 0) {
        log.error("輸入的郵箱為空");
        resp.setStatusCode(500).end("EMPTY_EMAIL");
        return;
    }
    if (name == null || name.trim().length() == 0) {
        log.error("輸入的用戶名為空");
        resp.setStatusCode(500).end("EMPTY_NAME");
        return;
    }
    if (password == null || password.trim().length() == 0) {
        log.error("輸入的密碼為空");
        resp.setStatusCode(500).end("EMPTY_PSWD");
        return;
    }
    if (rePassword == null || rePassword.trim().length() == 0) {
        log.error("輸入的重複密碼為空");
        resp.setStatusCode(500).end("EMPTY_REPEAT_PSWD");
        return;
    }
    if (!password.trim().equals(rePassword.trim())) {
        log.error("輸入的新密碼({})與重複密碼不一致({})", password, rePassword);
        resp.setStatusCode(500).end("PSWD_NOT_EQUAL");
        return;
    }

    //注冊處理
    log.debug("有用戶注冊請求,email={}登錄密碼MD5={}。", email, password);
    vertx.eventBus().<Integer>send(ADDR_ACCOUNT_DB.get(), makeMessage(COMMAND_REGISTER, email, password, name),
            ar -> {
                if (ar.succeeded()) {
                    JsonObject result = new JsonObject();
                    Integer id = ar.result().body();
                    if(id == -1){
                        resp.setStatusCode(500).end("DUPLICATE_EMAIL");
                        return;
                    }
                    //jwt保存
                    String token = provider.generateToken(new JsonObject().put("id", id).put("role", 1), JWT_OPTIONS);
                    log.info("用戶({},{})注冊成功,ID={},角色=普通用戶,token={}", name, email, id, token);
                    result.put("result", "success").put("token", token).put("name", name).put("role", 1)
                            .put("id", id).put("email", email);
                    resp.end(result.toString());
                } else {
                    log.error("EventBus消息響應錯誤", ar.cause());
                    resp.setStatusCode(500).end("EventBus error!");
                }
            });
}
 
開發者ID:Leibnizhu,項目名稱:AlipayWechatPlatform,代碼行數:59,代碼來源:LoginSubRouter.java

示例8: updateWechatPaySetting

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
private void updateWechatPaySetting(RoutingContext rc) {
    if (forbidAccess(rc, "uid", true)) {
        return;
    }
    Set<FileUpload> uploads = rc.fileUploads();
    HttpServerRequest req = rc.request();
    HttpServerResponse resp = rc.response().putHeader("content-type", "application/json; charset=utf-8");
    //解析參數
    Long uid = Long.parseLong(req.getParam("uid"));
    Integer paySwitch = Integer.parseInt(req.getParam("paySwitch"));
    String mchId = req.getParam("mchId");
    String payKey = req.getParam("payKey");

    //參數檢查
    if (paySwitch == 1 && !CommonUtils.notEmptyString(mchId, payKey)) {
        resp.end(new JsonObject().put("status", "invalid").toString());
        return;
    }

    // 異步保存證書文件
    if (uploads != null && !uploads.isEmpty()) {
        for (FileUpload next : uploads) {
            if (paySwitch == 1 && "cert".equals(next.name()) && next.size() > 0) {
                String filePath = Constants.CERT_DIR + uid + "_wxPay.p12";
                FileSystem fs = this.vertx.fileSystem();
                fs.exists(filePath, ex -> {
                    if(ex.succeeded()){
                        Future<Void> delFuture = Future.future();
                        Future<Void> copyFuture = Future.future();
                        fs.delete(filePath, delFuture.completer());
                        fs.copy(next.uploadedFileName(), filePath, copyFuture.completer());
                        if(ex.result()){
                            delFuture.compose(res -> {}, copyFuture);
                        }
                        copyFuture.setHandler(res -> {
                            if (res.succeeded()) {
                                log.info("複製文件{}到{}成功!", next.uploadedFileName(), filePath);
                            } else {
                                log.error("複製文件" + next.uploadedFileName() + "到" + filePath + "失敗!", res.cause());
                            }
                        });
                    } else {
                        log.error("判斷文件" + filePath + "是否存在時拋出異常!", ex.cause());
                    }
                });
                break;
            }
        }
    }

    //保存支付參數
    JsonObject acc = new JsonObject().put(ID, uid).put(MCHID, mchId).put(MCHKEY, payKey).put(WXPAYON, paySwitch);
    updatePaySetting(resp, acc, COMMAND_UPDATE_WECHATPAY);
}
 
開發者ID:Leibnizhu,項目名稱:AlipayWechatPlatform,代碼行數:55,代碼來源:PaySettingSubRouter.java

示例9: updateEmailPassword

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
/**
 * 更新郵箱密碼
 * 請求方法:PUT
 * 請求參數:id,oldPassword舊密碼,newPassword新密碼,rePasswordo重複密碼
 * 響應:success或fail
 */
private void updateEmailPassword(RoutingContext rc) {
    if (forbidAccess(rc, "id", true)) {
        return;
    }
    HttpServerRequest req = rc.request();
    HttpServerResponse resp = rc.response().putHeader("content-type", "text/plain; charset=utf-8");
    Long id = Long.valueOf(req.getParam("id"));
    String oldPassword = req.getParam("oldPassword");
    log.debug("即將發送EventBus消息查詢(ID={},密碼={})是否正確", id, oldPassword);
    Future.<Message<JsonObject>>future(f ->
        vertx.eventBus().send(ADDR_ACCOUNT_DB.get(), makeMessage(COMMAND_ID_LOGIN, id, oldPassword), f)
    ).compose(msg ->
        Future.<Message<Integer>>future(f -> {
            JsonObject acc = msg.body();
            if (acc == null) {
                log.warn("賬戶({})不存在或密碼({})錯誤", id, oldPassword);
                rc.response().end("errPswd");
                return;
            }
            String email = req.getParam("email");
            String newPassword = req.getParam("newPassword");
            boolean needUpdatePassword = false;
            if (newPassword != null && newPassword.trim().length() > 0) {
                String rePassword = req.getParam("rePassword");
                if (rePassword == null || rePassword.trim().length() == 0) {
                    log.error("輸入的重複密碼為空");
                    resp.setStatusCode(500).end("EMPTY_REPEAT_PSWD");
                    return;
                }
                if (!newPassword.trim().equals(rePassword.trim())) {
                    log.error("輸入的新密碼({})與重複密碼不一致({})", newPassword, rePassword);
                    resp.setStatusCode(500).end("PSWD_NOT_EQUAL");
                    return;
                }
                needUpdatePassword = true;
            }
            JsonObject updateAcc = new JsonObject().put(ID, id).put(EMAIL, email);
            if (needUpdatePassword) {
                updateAcc.put(PASSWORD, newPassword);
            }
            vertx.eventBus().send(ADDR_ACCOUNT_DB.get(), makeMessage(COMMAND_UPDATE_NORMAL, updateAcc), f);
        })
    ).setHandler(res -> {
        if(res.succeeded()){
            Integer rows = res.result().body();
            log.info("更新密碼/郵箱完畢,影響了{}條數據庫記錄", rows);
            rc.response().end(rows > 0 ? "success" : "fail");
        } else {
            log.error("更新密碼/郵箱時拋出異常", res.cause());
            rc.response().setStatusCode(500).end();
        }
    });
}
 
開發者ID:Leibnizhu,項目名稱:AlipayWechatPlatform,代碼行數:60,代碼來源:OfficialAccountSubRouter.java

示例10: handle

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
@Override
public void handle(RoutingContext ctx, Server server, DiscordBot bot, DSLContext database) {
    HttpServerRequest request = ctx.request();
    HttpServerResponse response = ctx.response();

    String guildId = request.getParam("guildId");
    int shardId = DiscordUtils.getShardIdFromGuildId(Long.parseLong(guildId), bot.getConfig().jim.shard_count);
    JDA shard = bot.getShards().get(shardId).getShard();
    Guild guild = shard.getGuildById(guildId);
    SettingsRecord record = database.selectFrom(Tables.SETTINGS)
                                    .where(Tables.SETTINGS.GUILDID.eq(guildId))
                                    .fetchAny();

    if (record == null || guild == null) {
        response.setStatusCode(404);
        response.end();
        return;
    }

    Gson gson = new GsonBuilder().serializeNulls().create();
    List<PartialChannel> channels = guild.getTextChannels()
                                         .stream()
                                         .map((channel) -> new PartialChannel(channel.getId(), channel.getName()))
                                         .collect(Collectors.toList());
    List<PartialRole> roles = guild.getRoles()
                                   .stream()
                                   .map((role) -> new PartialRole(role.getId(), role.getName()))
                                   .collect(Collectors.toList());

    Channel modLogChannel = shard.getTextChannelById(record.getModlogchannelid());
    PartialChannel modLogChannelPartial = new PartialChannel(modLogChannel.getId(), modLogChannel.getName());
    Channel welcomeMessageChannel = shard.getTextChannelById(record.getWelcomemessagechannelid());
    PartialChannel welcomeMessageChannelPartial = new PartialChannel(welcomeMessageChannel.getId(), welcomeMessageChannel.getName());
    Role holdingRoomRole = null;
    PartialRole holdingRoomRolePartial = null;

    if (record.getHoldingroomroleid() != null) {
        holdingRoomRole = shard.getRoleById(record.getHoldingroomroleid());
        holdingRoomRolePartial = new PartialRole(holdingRoomRole.getId(), holdingRoomRole.getName());
    }

    GuildSettings settings = new GuildSettings(
            guildId,
            record.getModlog(),
            modLogChannelPartial,
            record.getHoldingroom(),
            holdingRoomRolePartial,
            record.getHoldingroomminutes(),
            record.getInvitelinkremover(),
            record.getWelcomemessage(),
            record.getMessage(),
            welcomeMessageChannelPartial,
            record.getPrefix(),
            record.getSilentcommands(),
            record.getNospaceprefix(),
            record.getStatistics(),
            channels,
            roles
    );
    String responseJson = gson.toJson(settings);
    response.putHeader("Content-Type", "application/json");
    response.end(responseJson);
}
 
開發者ID:Samoxive,項目名稱:SafetyJim,代碼行數:64,代碼來源:GetGuildSettings.java

示例11: handle

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
@Override
public void handle(RoutingContext ctx, Server server, DiscordBot bot, DSLContext database) {
    HttpServerRequest request = ctx.request();
    HttpServerResponse response = ctx.response();

    String userId = ServerUtils.authUser(request, response, config);
    if (userId == null) {
        return;
    }

    String guildId = request.getParam("guildId");
    String channelId = request.getParam("channelId");
    String fromParam = request.getParam("from");
    String toParam = request.getParam("to");

    long from;
    long to;

    try {
        from = Long.parseLong(fromParam);
        to = Long.parseLong(toParam);

        if (from <= 0 || to <= 0 || from >= to) {
            response.setStatusCode(400);
            response.end();
            return;
        }
    } catch (NumberFormatException e) {
        response.setStatusCode(400);
        response.end();
        return;
    }

    Guild guild = DiscordUtils.getGuildFromBot(bot, guildId);
    if (guild == null) {
        response.setStatusCode(404);
        response.end();
        return;
    }

    TextChannel channel = guild.getTextChannelById(channelId);
    if (channel == null) {
        response.setStatusCode(403);
        response.end();
        return;
    }

    Member member = guild.getMemberById(userId);
    if (member == null) {
        response.setStatusCode(403);
        response.end();
        return;
    }

    if (!member.hasPermission(channel, Permission.MESSAGE_READ)) {
        response.setStatusCode(403);
        response.end();
        return;
    }

    SettingsRecord settings = DatabaseUtils.getGuildSettings(database, guild);
    if (!settings.getStatistics()) {
        response.setStatusCode(404);
        response.end();
        return;
    }

    Gson gson  = new Gson();
    List<Stat> stats = Stat.getChannelMessageStats(database, guildId, channelId, from, to, 60);
    response.putHeader("Content-Type", "application/json");
    response.end(gson.toJson(stats, stats.getClass()));
}
 
開發者ID:Samoxive,項目名稱:SafetyJim,代碼行數:73,代碼來源:ChannelMessageStats.java

示例12: handle

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
@Override
public void handle(RoutingContext ctx, Server server, DiscordBot bot, DSLContext database) {
    HttpServerRequest request = ctx.request();
    HttpServerResponse response = ctx.response();

    String userId = ServerUtils.authUser(request, response, config);
    if (userId == null) {
        return;
    }

    String guildId = request.getParam("guildId");
    String fromParam = request.getParam("from");
    String toParam = request.getParam("to");

    long from;
    long to;

    try {
        from = Long.parseLong(fromParam);
        to = Long.parseLong(toParam);

        if (from <= 0 || to <= 0 || from >= to) {
            response.setStatusCode(400);
            response.end();
            return;
        }
    } catch (NumberFormatException e) {
        response.setStatusCode(400);
        response.end();
        return;
    }

    Guild guild = DiscordUtils.getGuildFromBot(bot, guildId);
    if (guild == null) {
        response.setStatusCode(404);
        response.end();
        return;
    }

    Member member = guild.getMemberById(userId);
    if (member == null) {
        response.setStatusCode(403);
        response.end();
        return;
    }

    SettingsRecord settings = DatabaseUtils.getGuildSettings(database, guild);
    if (!settings.getStatistics()) {
        response.setStatusCode(404);
        response.end();
        return;
    }

    Map<String, List<Stat>> stats = guild.getTextChannels()
            .stream()
            .filter((channel) -> member.hasPermission(channel, Permission.MESSAGE_READ))
            .collect(Collectors.toMap((channel) -> channel.getId(), (channel) -> Stat.getChannelMessageStats(database, guildId, channel.getId(), from, to, 60)));

    if (stats.isEmpty()) {
        response.setStatusCode(403);
        response.end();
        return;
    }

    Gson gson  = new Gson();
    response.putHeader("Content-Type", "application/json");
    response.end(gson.toJson(stats, stats.getClass()));
}
 
開發者ID:Samoxive,項目名稱:SafetyJim,代碼行數:69,代碼來源:ChannelsMessageStats.java

示例13: handle

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
@Override
public void handle(RoutingContext ctx, Server server, DiscordBot bot, DSLContext database) {
    HttpServerRequest request = ctx.request();
    HttpServerResponse response = ctx.response();

    String userId = ServerUtils.authUser(request, response, config);
    if (userId == null) {
        return;
    }

    String guildId = request.getParam("guildId");
    String fromParam = request.getParam("from");
    String toParam = request.getParam("to");

    long from;
    long to;

    try {
        from = Long.parseLong(fromParam);
        to = Long.parseLong(toParam);

        if (from <= 0 || to <= 0 || from >= to) {
            response.setStatusCode(400);
            response.end();
            return;
        }
    } catch (NumberFormatException e) {
        response.setStatusCode(400);
        response.end();
        return;
    }

    Guild guild = DiscordUtils.getGuildFromBot(bot, guildId);
    if (guild == null) {
        response.setStatusCode(404);
        response.end();
        return;
    }

    Member member = guild.getMemberById(userId);
    if (member == null) {
        response.setStatusCode(403);
        response.end();
        return;
    }

    SettingsRecord settings = DatabaseUtils.getGuildSettings(database, guild);
    if (!settings.getStatistics()) {
        response.setStatusCode(404);
        response.end();
        return;
    }

    Gson gson  = new Gson();
    response.putHeader("Content-Type", "application/json");
    response.end(gson.toJson(Stat.getGuildMessageStats(database, guildId, from, to, 60), new TypeToken<List<Stat>>() {}.getType()));
}
 
開發者ID:Samoxive,項目名稱:SafetyJim,代碼行數:58,代碼來源:GuildMessageStats.java

示例14: handle

import io.vertx.core.http.HttpServerRequest; //導入方法依賴的package包/類
@Override
public void handle(RoutingContext ctx, Server server, DiscordBot bot, DSLContext database) {
    HttpServerRequest request = ctx.request();
    HttpServerResponse response = ctx.response();
    String code = request.getParam("code");

    if (code == null) {
        response.setStatusCode(400);
        response.end();
        return;
    }

    DiscordSecrets secrets = DiscordApiUtils.getUserSecrets(config, code);
    if (secrets == null || !secrets.scope.equals("guilds identify")) {
        response.setStatusCode(400);
        response.end();
        return;
    }

    SelfUser self = DiscordApiUtils.getSelf(secrets.accessToken);
    if (self == null) {
        response.setStatusCode(400);
        response.end();
        return;
    }

    Long now = (new Date().getTime()) / 1000;
    OauthsecretsRecord record = database.newRecord(Tables.OAUTHSECRETS);
    record.setUserid(self.id);
    record.setAccesstoken(secrets.accessToken);
    record.setRefreshtoken(secrets.refreshToken);
    record.setExpirationdate(now + secrets.expiresIn);

    database.insertInto(Tables.OAUTHSECRETS)
            .set(record)
            .onDuplicateKeyUpdate()
            .set(record)
            .execute();

    String token = getJwtToken(self.id);
    response.putHeader("Content-Type", "application/json");
    response.end("\"" + token + "\"");
}
 
開發者ID:Samoxive,項目名稱:SafetyJim,代碼行數:44,代碼來源:Login.java


注:本文中的io.vertx.core.http.HttpServerRequest.getParam方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。