随笔分类 -  编码

摘要:在实体对象上添加@JsonAutoDetect , 表明对该实体对象序列化成json串。@JsonAutoDetect public class User{ private int id; private String name; // 省略getter 和 setter }如果不想序列化某个属性,可以使用@JsonIgnoreProperties 进行标记@JsonAutoDetect @JsonIgnoreProperties (value = { "id" , "age" }) public class User{ private int id; 阅读全文
posted @ 2013-12-16 13:47 coreWars 阅读(873) 评论(0) 推荐(0)
摘要:使用RestTemplate传输带有图片的表单时,需要对表单中的中文参数进行URL编码, eg :URLDecoder.decode(name); // 使用默认的解码 params.add("name", URLEncoder.encode(name)); // 使用默认的编码 URLDecoder.decode(name,"UTF-8"); // 使用指定的解码 params.add("name", URLEncoder.encode(name,"UTF-8")); // 使用指定的编码 注意:编码和解码时,要 阅读全文
posted @ 2013-11-22 19:28 coreWars 阅读(884) 评论(0) 推荐(0)