本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}