Sending the request the server behaves with no error, but on the side of the response it generates the following error "com.android.volley.volleyerror java.lang.runtimeException: bad url." I'm using Android studio, WebView and Volley.
MainActivity class;
Map<String, String> postParam= new HashMap<>();
postParam.put("username", "admin");
postParam.put("password", "onblox");
CustonRequest jsObjRequest = new CustonRequest(
Request.Method.POST,
"http//:192.168.0.13:8088/onblox/login",
postParam,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Toast.makeText(MainActivity.this,response.toString(),Toast.LENGTH_LONG).show();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(MainActivity.this,error.toString(),Toast.LENGTH_LONG).show();
}
});
rq.add(jsObjRequest);
CustonRequest class:
public class CustonRequest extends Request<JSONObject> {
private Response.Listener<JSONObject> response;
private Map<String,String> parm;
public CustonRequest(int method, String url, Map<String,String> parm, Response.Listener<JSONObject> response, Response.ErrorListener listener) {
super(method, url, listener);
this.response = response;
this.parm = parm;
}
public CustonRequest( String url, Map<String,String> parm, Response.Listener<JSONObject> response, Response.ErrorListener listener) {
super(Method.GET, url, listener);
this.response = response;
this.parm = parm;
}
public Map<String,String> getParm()throws AuthFailureError{
return parm;
}
@Override
protected Response<JSONObject> parseNetworkResponse(NetworkResponse response) {
try {
String js = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
return (Response.success(new JSONObject(js),HttpHeaderParser.parseCacheHeaders(response)));
}catch (UnsupportedEncodingException e){
e.printStackTrace();
}catch (JSONException e){
e.printStackTrace();
}
return null;
}
@Override
protected void deliverResponse(JSONObject response) {
this.response.onResponse(response);
}
}