2

I have a Spring Boot application that responds to most requests, but does not fully respond to POST with multipart form data. I've read that all Spring requests go through DispatcherServlet. However, when I'm debugging the Spring app, nothing in DispatcherServlet ever catches for this request.

However, it does react, so it's doing something. Specifically, when the request comes in, the server logs something like the following:

2021-03-07 03:10:56 DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /bluecost/spreadsheet/upload/SSCSpreadsheetUpload-01012020.xlsx
2021-03-07 03:10:57 TRACE o.s.w.s.m.m.a.RequestMappingHandlerMapping - Found 1 matching mapping(s) for [/bluecost/spreadsheet/upload/SSCSpreadsheetUpload-01012020.xlsx] : [{[/bluecost/spreadsheet/upload/{filename}],methods=[POST]}]
2021-03-07 03:10:57 DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Returning handler method [public org.springframework.http.ResponseEntity<java.util.HashMap<java.lang.String, java.lang.Object>> com.ibm.cio.cloud.cost.spreadsheet.rest.controller.BlueCostRestController.uploadSpreadsheet(org.springframework.web.multipart.MultipartFile,java.lang.String)]

FWIW, I'm launching this in Eclipse as a Spring Boot Application. My question is what is the initial entry point that Spring lands on when a web request comes in if it's not DispatcherServlet?

POM snippet indicating Spring version

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath/>
    </parent>

The web method that it found but refuses to run is

   @ApiOperation(      
    value = "Upload spreadsheet data file",       
    notes = "Allows you to upload a single file with each request",      
    consumes = "application/json")   

    @PostMapping("/spreadsheet/upload/{filename}")
    public ResponseEntity<HashMap<String,Object>> uploadSpreadsheet(@RequestParam MultipartFile file, @PathVariable("filename") String filename) {

Please note, it does not issue any error, there's no stack trace. I might not have provided enough to solve, but I'd be happier if I knew where to set a breakpoint that it would land on.

Woodsman
  • 901
  • 21
  • 61
  • So what is the actual response u get your multipart request? It must go through Dsipatcher servlet. Or else try placing debugger at MultipartResolver and check. I believe you must have enabled spring multipart resolver also :) – karthick M Mar 08 '21 at 05:33

0 Answers0