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

Java MessageContext类代码示例

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

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



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

示例1: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx) {
    if (req.getMethod().equals("Echo")) {
        JSONRPC2Error err = JSONRPC2Helper.validateParams(requiredArgs, req);
        if (err != null)
            return new JSONRPC2Response(err, req.getID());

        HashMap inParams = (HashMap) req.getParams();
        String echo = (String) inParams.get("Echo");
        Map outParams = new HashMap();
        outParams.put("Result", echo);
        return new JSONRPC2Response(outParams, req.getID());
    }
    else {
        // Method name not supported
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, req.getID());
    }
}
 
开发者ID:i2p,项目名称:i2p.plugins.i2pcontrol,代码行数:18,代码来源:EchoHandler.java


示例2: handleLoadData

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
private JSONRPC2Response handleLoadData(JSONRPC2Request request, MessageContext context){
	if (!request.getParamsType().equals(JSONRPC2ParamsType.OBJECT) ||
			!(request.getParams() instanceof Map)) {
		return new JSONRPC2Response(JSONRPC2Error.INVALID_PARAMS,
				request.getID());
	}
	Map<?,?> map = (Map<?,?>) request.getParams();
	if (!map.containsKey(JsonRpcConstants.PARAM_NAME_DATASET)) {
		return new JSONRPC2Response(JSONRPC2Error.INVALID_PARAMS,
				request.getID());
	}
	String datasetName = getArg(map, JsonRpcConstants.PARAM_NAME_DATASET);
	if (datasetName == null) {
		return new JSONRPC2Response(JSONRPC2Error.INVALID_PARAMS,
				request.getID());
	}
	datasetName = datasetName.trim();
	JSONRPC2Response response = new JSONRPC2Response(solver.getInputs(datasetName),request.getID());

	System.out.println("reponse: " + datasetName);
	return response;

}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:24,代码来源:JsonKidneyServer.java


示例3: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx) {
    if (req.getMethod().equals("I2PControl")) {
        return process(req);
    } else {
        // Method name not supported
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, req.getID());
    }
}
 
开发者ID:i2p,项目名称:i2p.plugins.i2pcontrol,代码行数:9,代码来源:I2PControlHandler.java


示例4: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx) {
    if (req.getMethod().equals("NetworkSetting")) {
        return process(req);
    } else {
        // Method name not supported
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, req.getID());
    }
}
 
开发者ID:i2p,项目名称:i2p.plugins.i2pcontrol,代码行数:9,代码来源:NetworkSettingHandler.java


示例5: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx) {
    if (req.getMethod().equals("RouterManager")) {
        return process(req);
    } else {
        // Method name not supported
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND,
                                    req.getID());
    }
}
 
开发者ID:i2p,项目名称:i2p.plugins.i2pcontrol,代码行数:10,代码来源:RouterManagerHandler.java


示例6: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx) {
    if (req.getMethod().equals("RouterInfo")) {
        return process(req);
    } else {
        // Method name not supported
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND,
                                    req.getID());
    }
}
 
开发者ID:i2p,项目名称:i2p.plugins.i2pcontrol,代码行数:10,代码来源:RouterInfoHandler.java


示例7: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx) {
    if (req.getMethod().equals("GetRate")) {
        JSONRPC2Error err = JSONRPC2Helper.validateParams(requiredArgs, req);
        if (err != null)
            return new JSONRPC2Response(err, req.getID());

        HashMap inParams = (HashMap) req.getParams();

        String input = (String) inParams.get("Stat");
        if (input == null) {
            return new JSONRPC2Response(JSONRPC2Error.INVALID_PARAMS, req.getID());
        }
        long period;
        try {
            period = (Long) inParams.get("Period");
        } catch (NumberFormatException e) {
            return new JSONRPC2Response(JSONRPC2Error.INVALID_PARAMS, req.getID());
        }

        RateStat rateStat = I2PAppContext.getGlobalContext().statManager().getRate(input);

        // If RateStat or the requested period doesn't already exist, create them.
        if (rateStat == null || rateStat.getRate(period) == null) {
            long[] tempArr = new long[1];
            tempArr[0] = period;
            I2PAppContext.getGlobalContext().statManager().createRequiredRateStat(input, "I2PControl", "I2PControl", tempArr);
            rateStat = I2PAppContext.getGlobalContext().statManager().getRate(input);
        }
        if (rateStat.getRate(period) == null)
            return new JSONRPC2Response(JSONRPC2Error.INTERNAL_ERROR, req.getID());
        Map outParams = new HashMap();
        Rate rate = rateStat.getRate(period);
        rate.coalesce();
        outParams.put("Result", rate.getAverageValue());
        return new JSONRPC2Response(outParams, req.getID());
    }
    return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, req.getID());
}
 
开发者ID:i2p,项目名称:i2p.plugins.i2pcontrol,代码行数:39,代码来源:GetRateHandler.java


示例8: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx) {
    if (req.getMethod().equals("Authenticate")) {
        JSONRPC2Error err = JSONRPC2Helper.validateParams(requiredArgs, req, JSONRPC2Helper.USE_NO_AUTH);
        if (err != null)
            return new JSONRPC2Response(err, req.getID());

        HashMap inParams = (HashMap) req.getParams();

        String pwd = (String) inParams.get("Password");

        // Try get an AuthToken

        AuthToken token = SecurityManager.getInstance().validatePasswd(pwd);
        if (token == null) {
            return new JSONRPC2Response(JSONRPC2ExtendedError.INVALID_PASSWORD, req.getID());
        }

        Object api = inParams.get("API");
        err = validateAPIVersion(api);
        if (err != null)
            return new JSONRPC2Response(err, req.getID());


        Map outParams = new HashMap();
        outParams.put("Token", token.getId());
        outParams.put("API", I2PControlVersion.API_VERSION);
        return new JSONRPC2Response(outParams, req.getID());
    } else {
        // Method name not supported
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, req.getID());
    }
}
 
开发者ID:i2p,项目名称:i2p.plugins.i2pcontrol,代码行数:33,代码来源:AuthenticateHandler.java


示例9: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
@Override
public JSONRPC2Response process(JSONRPC2Request request, MessageContext messageContext) {
    if (request.getMethod().equalsIgnoreCase(TRAINING)) {
        return handleTraining(request);
    } else {
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, request.getID());
    }
}
 
开发者ID:victor-guoyu,项目名称:Review-It,代码行数:9,代码来源:TrainingHandler.java


示例10: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
@Override
public JSONRPC2Response process(JSONRPC2Request request, MessageContext messageContext) {
    if (request.getMethod().equalsIgnoreCase(COMMENT_SEARCH)) {
        return handleCommentSearch(request);
    } else {
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, request.getID());
    }
}
 
开发者ID:victor-guoyu,项目名称:Review-It,代码行数:9,代码来源:SearchTextHandler.java


示例11: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
@Override
public JSONRPC2Response process(JSONRPC2Request request, MessageContext messageContext) {
    if (request.getMethod().equalsIgnoreCase(TWEET_SEARCH)) {
        return handleTweetSearch(request);
    } else {
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, request.getID());
    }
}
 
开发者ID:victor-guoyu,项目名称:Review-It,代码行数:9,代码来源:SearchTweetHandler.java


示例12: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
@Override
public JSONRPC2Response process(JSONRPC2Request request, MessageContext messageContext) {
    if (request.getMethod().equalsIgnoreCase(VIDEO_SEARCH)) {
        return handleVideoSearch(request);
    } else {
        return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, request.getID());
    }
}
 
开发者ID:victor-guoyu,项目名称:Review-It,代码行数:9,代码来源:SearchVideoHandler.java


示例13: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
@Override
public JSONRPC2Response process(JSONRPC2Request request, MessageContext context) {
	StringBuilder logBuilder = new StringBuilder()
       .append(request.getMethod())
       .append(" request params")
       .append(request.getParams().toString())
       .append(" from ")
       .append(context.getClientInetAddress())
       .append(": ");
	if (request.getMethod().equals(JsonRpcConstants.METHOD_NAME_LOAD_DATA)) {
	      logger.info(logBuilder.append("dispatched.").toString());
	      return handleLoadData(request,context);
	}
	else if (request.getMethod().equals(JsonRpcConstants.METHOD_NAME_DATASETS)) {
	      logger.info(logBuilder.append("dispatched.").toString());
	      return handleDatasets(request,context);
	}
	else if (request.getMethod().equals(JsonRpcConstants.METHOD_NAME_SOLVE)) {
	      logger.info(logBuilder.append("dispatched.").toString());
	      return handleSolve(request,context);
	}
	else{
		logger.info(logBuilder.append("invalid.").toString());
	    return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND,
	                                request.getID());
	}		
}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:28,代码来源:JsonKidneyServer.java


示例14: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public JSONRPC2Response process(final JSONRPC2Request req,
        final MessageContext ctxt) {

    final ApiHandler m = this.handlers.get(req.getMethod());
    if (m != null) {

        if (m.getType() != JSONRPC2ParamsType.NO_PARAMS
                && m.getType() != req.getParamsType()) {
            return new JSONRPC2Response(new JSONRPC2Error(
                    JSONRPC2Error.INVALID_PARAMS.getCode(), req.getMethod()
                            + " requires: " + m.getType() + "; got: "
                            + req.getParamsType()), req.getID());
        }

        switch (m.getType()) {
        case NO_PARAMS:
            return m.process(null);
        case ARRAY:
            return m.process(req.getPositionalParams());
        case OBJECT:
            return m.process(req.getNamedParams());
        default:
            break;
        }
    }

    return new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, req.getID());
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:31,代码来源:MonitoringHandler.java


示例15: handleDatasets

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
private JSONRPC2Response handleDatasets(JSONRPC2Request request, MessageContext context){
	return new JSONRPC2Response(kidneyDataBase.availableDatasets(),request.getID());
}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:4,代码来源:JsonKidneyServer.java


示例16: process

import com.thetransactioncompany.jsonrpc2.server.MessageContext; //导入依赖的package包/类
public abstract JSONRPC2Response process(JSONRPC2Request req,
MessageContext ctxt);
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:3,代码来源:AbstractHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java JavadocTaskImpl类代码示例发布时间:2022-05-22
下一篇:
Java Completer类代码示例发布时间: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