极光JMessage 报错401

zhangchaoyang
2017-06-12 17:51 647 0

height="28">="515" height="337"> 发布生产两次 两次晚上出问题,我这个聊天系统平时很稳定,今天晚上突然获取聊天消息失败了 说我401? 查了一圈没有发现问题。 程序员何苦为难程序员呢? 这么晚了 搞什么?

String base64 = getBase64("ae10f874532f3604****59706:d9277****83b62db32e");
// 加密  
public static String getBase64(String str) {  

    byte[] b = null;  
    String s = null;  
    try {  
        b = str.getBytes("utf-8");  
    } catch (UnsupportedEncodingException e) {  
        e.printStackTrace();  
    }  
    if (b != null) {  
        s = new BASE64Encoder().encode(b);  
    }  
    return s;  
}  


    conn.setRequestMethod(sendType); 
    conn.setRequestProperty("Authorization", "Basic "+base64);//YWRtaW46YWRtaW4=");
    // 设置访问提交模式,表单提交
    conn.setRequestProperty("Content-Type", "application/json");
    conn.setRequestProperty("Accept-Charset", "UTF-8");
    conn.setRequestProperty("Charset", "UTF-8");

1个回答

热门排序
  • 请问现在还有问题吗?是否只是晚上偶尔出现?有找到错误原因吗?