url中不能直接写特殊字符 必须转码才可以

 public URI postParam(@RequestBody Person person, HttpServletResponse response) throws Exception {
        String param1 = URLEncoder.encode("https://www.baidu.com/s?wd="+person.getName(), "UTF-8");
        URI uri = new URI(param1);
        response.addHeader("Location", uri.toString());
        return uri;
    }

 

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐