随笔分类 - 编码
摘要:在实体对象上添加@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;
阅读全文
摘要:使用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")); // 使用指定的编码 注意:编码和解码时,要
阅读全文

浙公网安备 33010602011771号