小编use*_*978的帖子

android rest客户端不支持的媒体类型

我尝试从android模拟器发送请求到一个安静的服务器.但我总是得到错误:

415不支持的媒体类型.

客户代码:

public JSONtest() throws Exception, IOException{

    HttpPost request = new HttpPost(AppServerIP);
    JSONObject param = new JSONObject();
    param.put("name", "weiping");
    param.put("password", "123456");
    StringEntity se = new StringEntity(param.toString());
    request.setEntity(se);
    HttpResponse httpResponse = new DefaultHttpClient().execute(request);
    String retSrc = EntityUtils.toString(httpResponse.getEntity());
    System.out.println(httpResponse.getStatusLine().getReasonPhrase());
}
Run Code Online (Sandbox Code Playgroud)

服务器的代码:

public class resource {
    @POST
    @Path("/trigger")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response trigger(JSONObject notify) throws Exception{            
        return Response.status(Response.Status.OK).entity("134124").tag("213q").type(MediaType.APPLICATION_JSON).build();       
}
Run Code Online (Sandbox Code Playgroud)

media rest android types

7
推荐指数
1
解决办法
4864
查看次数

通过HTML在Mobile Safari上实现UIPickerview

有没有办法通过HTML/javascript/css在Iphone Mobile Safari上创建类似于UIPickerView的效果?

safari mobile uipickerview

7
推荐指数
1
解决办法
520
查看次数

标签 统计

android ×1

media ×1

mobile ×1

rest ×1

safari ×1

types ×1

uipickerview ×1