當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。