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


Java IMSJSONRequest类代码示例

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


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

示例1: doErrorJSON

import org.imsglobal.json.IMSJSONRequest; //导入依赖的package包/类
public void doErrorJSON(HttpServletRequest request,HttpServletResponse response,
			IMSJSONRequest json, String message, Exception e)
		throws java.io.IOException
	{
		if (e != null) {
			M_log.log(Level.WARNING, e.getLocalizedMessage(), e);
		}
        M_log.info(message);
		String output = IMSJSONRequest.doErrorJSON(request, response, json, message, e);
System.out.println(output);
    }
 
开发者ID:IMSGlobal,项目名称:basiclti-util-java,代码行数:12,代码来源:LTI2Servlet.java

示例2: doErrorJSON

import org.imsglobal.json.IMSJSONRequest; //导入依赖的package包/类
private void doErrorJSON(HttpServletRequest request,HttpServletResponse response,
	IMSJSONRequest json, String message, Exception e)
			throws java.io.IOException
			{
if (e != null) {
	M_log.error(e.getLocalizedMessage(), e);
}
M_log.info(message);
String output = IMSJSONRequest.doErrorJSON(request, response, json, message, e);
System.out.println(output);
			}
 
开发者ID:karutaproject,项目名称:karuta-backend,代码行数:12,代码来源:LTIv2Servlet.java

示例3: oauthValidate

import org.imsglobal.json.IMSJSONRequest; //导入依赖的package包/类
protected static void oauthValidate(HttpServletRequest request, Map<String, Object> payload, ServletContext application) {
	final String oauth_consumer_key = (String) payload.get(LTIServletUtils.OAUTH_CONSUMER_KEY);
	final String configPrefix = "basiclti.provider." + oauth_consumer_key + ".";
       final String oauth_secret = (String)application.getAttribute(configPrefix+ "secret");


	IMSJSONRequest ijr = new IMSJSONRequest(request);
	ijr.validateRequest(oauth_consumer_key, oauth_secret, request);
}
 
开发者ID:karutaproject,项目名称:karuta-backend,代码行数:10,代码来源:LTIServletUtils.java

示例4: doRequest

import org.imsglobal.json.IMSJSONRequest; //导入依赖的package包/类
@SuppressWarnings("unused")
protected void doRequest(HttpServletRequest request, HttpServletResponse response, HttpSession session, ServletContext application, String toolProxyPath, StringBuffer outTrace)
		throws ServletException, IOException
		{

	outTraceFormattedMessage(outTrace, "getServiceURL="+getServiceURL(request));

	String ipAddress = request.getRemoteAddr();
	outTraceFormattedMessage(outTrace, "LTI Service request from IP=" + ipAddress);

	String rpi = request.getPathInfo();
	String uri = request.getRequestURI();
	String [] parts = uri.split("/");
	if ( parts.length < 4 ) {
		response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
		doErrorJSON(request, response, null, "Incorrect url format", null);
		return;
	}

	Map<String, Object> payload = LTIServletUtils.processRequest(request, outTrace);
	String url = getServiceURL(request);

	String controller = parts[3];
	if ( "register".equals(controller) ) {
		payload.put("base_url", url);
		payload.put("launch_url", url + "register");
		doRegister(response, payload, application, toolProxyPath, outTrace);
		return;
	} else if ( "launch".equals(controller) ) {
		doLaunch(request, response, session, payload, application, outTrace);
		return;
	}

	// Check if json request if valid
	IMSJSONRequest jsonRequest = new IMSJSONRequest(request);
	if ( jsonRequest.valid ) {
		outTraceFormattedMessage(outTrace, jsonRequest.getPostBody());
	}

	response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
	M_log.warn("Unknown request="+uri);
	doErrorJSON(request, response, null, "Unknown request="+uri, null);
}
 
开发者ID:karutaproject,项目名称:karuta-backend,代码行数:44,代码来源:LTIv2Servlet.java


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