The technology level is generally limited. what's wrong? Let us know. The popularity of small programs is almost the same, recording the ups and downs in your development. Follow the official process to log on:
Logon process
The technology level is generally limited. what's wrong? Let us know.
The popularity of small programs is almost the same, recording the ups and downs in your development.
Follow the official process to log on:
First, create a request method to implement a communication between your server and the server:
Public static String GET (String url) {String result = ""; BufferedReader in = null; try {URL realUrl = new URL (url); URLConnection conn = realUrl. openConnection (); conn. connect (); Map
> Map = conn. getHeaderFields (); in = new BufferedReader (new InputStreamReader (conn. getInputStream (); String line; while (line = in. readLine ())! = Null) {result + = line ;}} catch (Exception e) {} finally {try {if (in! = Null) {in. close () ;}} catch (Exception e2) {// log records} return result ;}
Then construct the request url (change the property changed from the red circle to the corresponding data ):
Use the GET () method to communicate with the server. if the request is correct, we can GET session_key and openid, and store these two values in the session:
Jedis jedis = new Jedis("localhost"); String openid = openid;String session_key = session_key;String uid = UUID.randomUUID().toString();StringBuffer sb = new StringBuffer();sb.append(openid);sb.append(","+session_key);jedis.set(uid, sb.toString());
Return the uid to the client. in the future, each request from the client will contain the uid.
Troubleshooting
If you need to obtain the user name and profile picture of the logged-on user during the process, garbled characters will appear if the user name has Chinese characters. the solution is as follows:
String nickNameDecode = new String(nickName.getBytes("ISO-8859-1"),"utf-8");
The above is a detailed description of the logon instance for applet development. For more information, see other related articles in the first PHP community!