排球网络请求响应没有HTML标记

时间:2018-10-24 12:40:07

标签: android android-volley

我正在对所有网络请求使用Volley,但是它没有返回大多数HTML标签作为响应。示例:

我需要这样的答复:

{
    "id": "9407159",
    "jJ": "<mark class='highlighted'>Java</mark> Project Internship",
    "jRrl": null,
    "jCD": null,
    "jCNe": "Sparkcoders",
    "jD": 681901,
    "jL": ["Junagarh", "Gandhinagar", "Gandhidham", "Rajkot", "Bhuj", "Anand", "Bhavnagar", "Vadodara", "Mehsana", "Ahmedabad"],
    "jPe": "2018-10-23T00:00:00",
    "jCpe": true,
    "jKd": null,
    "jp": "0 to 2 Yrs",
    "jKs": "",
    "jR": 1,
    "jTe": 1,
    "jWC": "",
    "jWL": null,
    "jWD": null,
    "jEe": "2019-01-21T00:00:00",
    "jPJ": 0,
    "jHJ": 1
}

但是我没有获得()HTML标记。

我的代码:

  @Override
protected Response<T> parseNetworkResponse(NetworkResponse response) {
    try {

        // Volley does not handle null properly, so implement null response
        // check

        Log.d("RESPONSE code ","res "+response.statusCode);
        if (response.data.length == 0) {
            byte[] responseData = "{}".getBytes("UTF8");
            response = new NetworkResponse(response.statusCode,
                    responseData, response.headers, response.notModified);
        }


        String jsonString = new String(response.data,
                HttpHeaderParser.parseCharset(response.headers));

        Log.d("Volley::GsonReq", "JsonResponse: " + jsonString);


        T parseObject = gson.fromJson(jsonString, listType);


        return Response.success(
                parseObject,
                parseIgnoreCacheHeaders(response));

    } catch (UnsupportedEncodingException e) {
        System.out.println("VolleyQueue: Encoding Error for " + getTag()
                + " (" + getSequence() + ")");
        return Response.error(new ParseError(e));
    }
    catch (Exception e){
        e.printStackTrace();
        System.out.println("VolleyQueue: Fatal Error for " + getTag()
                + " (" + getSequence() + ")");
        return Response.error(new VolleyError(e));
    }
}

我尝试了JSONObjectRequest和字符串请求。但是两者似乎都不起作用。 jsonString变量没有任何HTML标记。我可以随时获得标签,但没有其他标签。

找不到原因。有解决方案吗?

0 个答案:

没有答案