hxlovexn 2016-12-02 07:47 采纳率: 0%
浏览 3989

dubbox rest服务接受参数乱码

dubbo服务接口如下

@Path("addcustomer")
public interface IncrCustomerInterface {

@POST
@Path("saveenter")
@Consumes
@Produces
public String saveEnterpriseInfo(@BeanParam EnterpriseInfo enterpriseInfo,@BeanParam CustomerBean custBean);

调用方代码如下
@RestController

@RequestMapping("/bankCustomer")
public class BankCustomerController {

@Autowired
private DubboSupport dubboSupport;

@RequestMapping("/testSingle")
public void testSingle() throws Exception {
    EnterpriseInfo enterpriseInfo = new EnterpriseInfo();
    enterpriseInfo.setName(new String("测试企业名称".getBytes("ISO-8859-1"), "gbk"));
    enterpriseInfo.setCustomerNo("000001111");
    enterpriseInfo.setIdCardType(new String("二代身份证".getBytes("ISO-8859-1"), "UTF-8"));
    enterpriseInfo.setAddress(new String("测试企业地址".getBytes("ISO-8859-1"), "gb2312"));
    enterpriseInfo.setIdentityAddress("测试企业身份证地址");
    enterpriseInfo.setIdentityNo("测试企业身份证号码110");
    IncrCustomerInterface incrCustomerInterface = dubboSupport.getIncrCustomerInterface();
    CustomerBean bean =  new CustomerBean();
    bean.setCustomerNo("11111");
    incrCustomerInterface.saveEnterpriseInfo(enterpriseInfo,bean);
}

}

服务端接口接受到参数以后,里面的中文全部为乱码,怎么解决?

  • 写回答

1条回答 默认 最新

  • dabocaiqq 2016-12-31 11:27
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题