servlet urlMap中的java问题?

vwhgwdsa  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(239)
@PostMapping(path = "/images")  

    public void sendFiles( @RequestParam("transferFile")MultipartFile transferFile, @RequestParam("id") int id,  HttpServletRequest request,HttpServletResponse response) {
        response.setContentType("application/images");
        try {
            String requestUrl="http://localhost:9090/NewFileHandling/file";
            URL url = new URL(requestUrl);
            HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
            httpCon.setDoOutput(true);

            OutputStream outputStream = httpCon.getOutputStream();
            byte[] data = transferFile.getBytes();

            outputStream.write(data);

        }catch (Exception e) {
            e.printStackTrace();
            System.err.println(e);

        }    

    }

在web.xml中,我给出了dispatcherservlet

错误是没有post/springproject/images kinldy帮助的Map。提前谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题