通过va_list和/dev/kmsg在串口打印调试信息
2011-12-13 17:16
519 查看
参考文献:http://kodemaniak.de/?p=62(我是没怎么看懂啊,哪位看懂了给无留个言谢谢了)
jquery代码:
$.ajax({
type: 'post',
url: url,
dataType: 'json',
contentType: "application/json",
success: function(response){
var md5 = response.md5;
$("#"+id).html("| "+md5);
},
error: function(data) {
$.messager.alert("info","error");
}
});
restlet:
ajax 发送post请求,由于大多数浏览器不支持这样的跨域请求,需要使用options 询问,服务器端使用reponse 应答,允许post方式。
@Options
public void doOptions(Representation entity) {
Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers");
if (responseHeaders == null) {
responseHeaders = new Form();
getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders);
}
responseHeaders.add("Access-Control-Allow-Origin", "*");
responseHeaders.add("Access-Control-Allow-Methods", "POST,OPTIONS");
responseHeaders.add("Access-Control-Allow-Headers", "Content-Type");
responseHeaders.add("Access-Control-Allow-Credentials", "false");
responseHeaders.add("Access-Control-Max-Age", "60");
}
@Post
public Representation fileToMd5(){
try{
Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers");
if (responseHeaders == null) {
responseHeaders = new Form();
getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders);
}
responseHeaders.add("Access-Control-Allow-Origin", "*");
File f = new File(fileDir);
String md5 ="{\"md5\":\""+ MD5Util.md5(f)+"\"}";
Representation rep = new StringRepresentation(md5,MediaType.APPLICATION_JSON);
return rep;
}catch(Exception e){
e.printStackTrace();
}
return null;
}
jquery代码:
$.ajax({
type: 'post',
url: url,
dataType: 'json',
contentType: "application/json",
success: function(response){
var md5 = response.md5;
$("#"+id).html("| "+md5);
},
error: function(data) {
$.messager.alert("info","error");
}
});
restlet:
ajax 发送post请求,由于大多数浏览器不支持这样的跨域请求,需要使用options 询问,服务器端使用reponse 应答,允许post方式。
@Options
public void doOptions(Representation entity) {
Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers");
if (responseHeaders == null) {
responseHeaders = new Form();
getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders);
}
responseHeaders.add("Access-Control-Allow-Origin", "*");
responseHeaders.add("Access-Control-Allow-Methods", "POST,OPTIONS");
responseHeaders.add("Access-Control-Allow-Headers", "Content-Type");
responseHeaders.add("Access-Control-Allow-Credentials", "false");
responseHeaders.add("Access-Control-Max-Age", "60");
}
@Post
public Representation fileToMd5(){
try{
Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers");
if (responseHeaders == null) {
responseHeaders = new Form();
getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders);
}
responseHeaders.add("Access-Control-Allow-Origin", "*");
File f = new File(fileDir);
String md5 ="{\"md5\":\""+ MD5Util.md5(f)+"\"}";
Representation rep = new StringRepresentation(md5,MediaType.APPLICATION_JSON);
return rep;
}catch(Exception e){
e.printStackTrace();
}
return null;
}
相关文章推荐
- 通过va_list和/dev/kmsg在串口打印调试信息
- adb打印内核调试信息dmsg和kmsg说明
- Android 用adb 打印linux内核调试信息dmesg和kmsg命令
- 让Eclipse支持串口打印调试信息(SSH及Telnet也可以参考)
- 串口打印调试信息的延时问题
- 调试MTK mmi程序时通过debug口打印调试信息的方法
- WinCE 中调试串口打印信息的实现介绍
- STM8串口打印调试信息
- 通过串口打印GPS的信息------SF2820模块
- 安卓应用程序在真机上调试时无打印信息,提示Unable to open log device ‘/dev/log/main’: No such file or directory在我们使用真机进行An
- 通过串口打印GPS的信息------SF2820模块
- U-Boot没有串口打印信息 调试u-boot
- 解放串口调试(使用JLink SEGGER RTT来打印和输入调试信息)
- 通过串口打印GPS的信息------SF2820模块
- Android 用adb 打印linux内核调试信息dmesg和kmsg命令
- STM8串口打印调试信息
- Windbg和VirtualBox通过虚拟串口调试Win 8
- 关于断点调试输出信息出不来,用po打印变量也没有值的问题
- Qt 打印调试信息
- 正在进行调试的Web服务器进程已由Internet信息服务(IIS)终止。可以通过在IIS中配置应用程序池Ping设置来避免这一问题。有关更多详细信息,请参见“帮助”