如何获得默认的内容类型Android截击
我想知道如何在volley android中从标题中获取默认内容类型如何获得默认的内容类型Android截击,android,http-headers,android-volley,Android,Http Headers,Android Volley,我想知道如何在volley android中从标题中获取默认内容类型 @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> headers = new HashMap<String, String>(); headers.put("Authkey"
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Authkey", Agent_Name);
headers.put("apptype", "android");
headers.put("apptoken", gcmID);
return headers;
}
@覆盖
公共映射getHeaders()引发AuthFailureError{
Map headers=newhashmap();
headers.put(“Authkey”,代理名称);
headers.put(“apptype”、“android”);
headers.put(“apptoken”,gcmID);
返回标题;
}
这里我没有提到内容类型,所以如何获取默认内容类型。您需要什么内容类型?只需添加
标题。设置(“内容类型”、“应用程序/json”)
或whatever@NoumanCh我不认为我认为默认的内容类型是申请表数据是的,你是对的,亲爱的
I just append text fields to the body and created the following function to do it in multipart :
private void buildTextPart(DataOutputStream dataOutputStream, String
parameterName, String parameterValue) throws IOException {
dataOutputStream.writeBytes(twoHyphens + boundary + lineEnd);
dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"");
dataOutputStream.write(parameterName.getBytes("UTF-8"));
dataOutputStream.writeBytes(lineEnd);
dataOutputStream.writeBytes("Content-Type: text/plain; charset=UTF-8" +
lineEnd);
dataOutputStream.writeBytes(lineEnd);
dataOutputStream.write(parameterValue.getBytes("UTF-8"));
dataOutputStream.writeBytes(lineEnd)
}
here mention multipart data format ,and text format as utf8,its working fine