0
REST google apiからsendind POSTにContent-Type: application/x-www-form-urlencoded
を送ります。私の方法ではJava、JBOSS、スペイン語のアクセント付きのMULTIPART_FORM_DATAとJSONを受け入れます。
------WebKitFormBoundary
Content-Disposition: form-data; name="model"
Content-type: application/json
{
"placeId":2,
"reportDate":"2016-03-10T05:00:00.000Z",
"form":{
"apply" :"NO",
"microbasin": {
"id": 1,
"name": "Caño Rubiales"
}
}
}
------WebKitFormBoundary--
私は消費:
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response create (@Context UriInfo uriInfo,
@Context HttpServletRequest req,
MultipartFormDataInput input) throws IOException
{
List<InputPart> l = input.getFormDataMap().get("model");
String str = new String (l.get(0).getBodyAsString().getBytes("iso-8859-1"), "UTF-8");
System.out.println(str);
InputStream file = input.getFormDataPart("file", new GenericType<InputStream>() {});
return null;
}
のでCaño
のための受信シンボルはCaýýo
です。私はすべてのエンコーディングタイプで多くのオプションを試しましたが、成功しませんでした。誰かが私を助けてくれますか、適切な記号を使ってただ1つの方法でファイルとjsonを受け入れる方法についていくつかのアドバイスをしてください。
チェック[この](http://stackoverflow.com/questions/10226018/jboss-encoding-utf-8)。私はJBOSSを使ってからしばらくしていますが、私はポルトガル語のキャラクタの設定ファイルに何かを設定する必要があることを覚えています。 – dambros
私は昨日試しましたが、それでも動作しません。 –
次の '@Consumes(MediaType.MULTIPART_FORM_DATA +"; charset = utf-8 ")を試してください。 – dambros