I\'m retrieving the content of a invalid web address with volley, i.e. http://www.gigd32fdsu.com
:
This is my test code:
// Instantiate the Reque
@VinceStyling 's answer is ok, or you can extend Request class and do what you wanna do. For example,
ServerStatusRequestObject extends Request {
private final Response.Listener mListener;
private String mBody = "";
private String mContentType;
public ServerStatusRequestObject(int method,
String url,
Response.Listener listener,
Response.ErrorListener errorListener) {
super(method, url, errorListener);
mListener = listener;
mContentType = "application/json";
if (method == Method.POST) {
RetryPolicy policy = new DefaultRetryPolicy(5000, 0, 5);
setRetryPolicy(policy);
}
}
@Override
protected Response parseNetworkResponse(NetworkResponse response) {
return Response.success(response.statusCode, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(Object response) {
if (mListener != null) {
mListener.onResponse(response);
}
}
@Override
public byte[] getBody() throws AuthFailureError {
return mBody.getBytes();
}
@Override
public String getBodyContentType() {
return mContentType;
}
@Override
public int compareTo(Object another) {
return 0;
}
then in your response handler, you can still receive the whole messages from server. Try it.