String plainCredentials = "test1:123456";
String base64Credentials = new String(Base64.encodeBase64(plainCredentials.getBytes()));
//输出结果dGVzdDE6MTIzNDU2
//在js请求时,把Authorization:Basic dGVzdDE6MTIzNDU2放到header请求中即可