Привет всем, я использую android studio для входа в REST API с помощью spring, и у меня возникает ошибка, когда я хочу войти в систему. Ошибка в Android studio приведена ниже:
E/Volley: [249] BasicNetwork.performRequest: Unexpected response code 403 for
https://192.168.0.35:8443/login
E/Volley: [249] BasicNetwork.performRequest: Unexpected response code 403 for
https://192.168.0.35:8443/login
W/System.err: com.android.volley.AuthFailureError
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:195)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
D/EGL_emulation: eglMakeCurrent: 0xa26844e0: ver 3 0 (tinfo 0xa2683b80)
D/EGL_emulation: eglMakeCurrent: 0xa26844e0: ver 3 0 (tinfo 0xa2683b80)
А в Eclipse у меня ошибка, и я чего-то не понимаю, потому что в клиенте Adavce REST он работает очень хорошо:
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-
of-input
at [Source: (org.apache.catalina.connector.CoyoteInputStream); line: 1, column: 0]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
~[jackson-databind-2.10.4.jar:2.10.4]
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4360) ~[jackson-
databind-2.10.4.jar:2.10.4]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4205) ~[jackson-
databind-2.10.4.jar:2.10.4]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3251) ~[jackson-databind-
2.10.4.jar:2.10.4]
at
Это мой код в студии Android с залпом библиотека:
final JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url,null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.println(Log.ERROR,"TAG",response.toString());
//String token = response.getString(0);
//callback.onSuccess(token);
//Log.println(Log.INFO,"LOG",token);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
callback.onError(error.getMessage());
error.printStackTrace();
}
}){
@Override
public Map<String, String> getHeaders() {
Map<String, String> headers = new HashMap<>();
String auth =username + ":" + password;
byte[] data = auth.getBytes();
String base64 = Base64.encodeToString(data, Base64.NO_WRAP);
headers.put("Authorization",base64);
headers.put("accept-language","EN");
headers.put("Content-type","application/json");
headers.put("Accept","application/json");
return headers;
}
};