gpt4 book ai didi

java - HttpClient : error: com. android.volley.RedirectError

转载 作者:太空宇宙 更新时间:2023-11-04 11:15:57 25 4
gpt4 key购买 nike

loginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{

String userName = editTextEmail.getText().toString().trim();
String password editTextPassword.getText().toString().trim();
String LOGIN_URL = "http://www.someurl.com/Rest/AIwebservice/Authenticate?user="+userName+"&password="+password;
//String uri = String.format("https://www.auruminfo.com/Rest/AIwebservice/Authenticate?user=subhash&password=Subhash");

//String uri = String.format("https://www.someurl.com/Rest/AIwebservice/Authenticate?user="+userName+"&password="+password);
StringRequest sr = new StringRequest(Request.Method.GET,LOGIN_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("HttpClient", "success! response: " + response.toString());
}
},new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("HttpClient", "error: error.toString());
}
})
{
@Override
protected Map<String,String> getParams(){
Map<String,String> params = new HashMap<String, String>();
params.put("user","");
params.put("password","");
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> params = new HashMap<String, String>();
params.put("Content-Type","application/json;charset=UTF-8");
return params;
}
};
queue.add(sr);

}
});


}

和日志猫:-

08-02 18:17:08.778 7070-7091/com.some.eww.logindemo E/Volley: [9414] BasicNetwork.performRequest: Request at http://www.someurl.com/Rest/AIwebservice/Authenticate?user=&password= has been redirected to https://www.someurl.com/Rest/AIwebservice/Authenticate?user=&password= 08-02 18:17:08.794 7070-7070/com.anghatechsolution.eww.logindemo E/HttpClient: error: com.android.volley.RedirectError

最佳答案

我在 String LOGIN_URL = "http://www.someurl.com ; 中发现了我的案例中的问题

原始API使用HTTPS而不是HTTP

关于java - HttpClient : error: com. android.volley.RedirectError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45461579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com