I am returning the HTML page located in the resources/static folder. But, if it's like a single slash, it's working fine, giving me the HTML content. But when there is multiple slash added to the path its giving 404.
@Controller
@RequestMapping(value = "/api-documentation")
public class ApiDocumentationController {
@GetMapping
String gotoRedocUi(){
return "Redoc-Integrate.html"; // return html file defined in resources/static.
}
}
Above is working code for controller
@Controller
@RequestMapping(value = "/api-documentation")
public class ApiDocumentationController {
@GetMapping(/some/more/value)
String gotoRedocUi(){
return "Redoc-Integrate.html"; // return html file defined in resources/static.
}
}
While this gives 404. even if i dont declare @getmapping, similar issues happen for @requestmapping, i.e on adding more like /api-docume.../some/... it gives 404. Like I know its about error while changing name, but had tried many things still not getting whats wrong, any help would be appreciated. Also Is there any other way to throw HTML if only requestmapping with above working name type would only work?
As I know, default location for HTML files in Spring Boot project is resources/templates
.
I suggest to move your Redoc-Integrate.html
file to this directory and it should work.
Alternatively, you can return a relative path, starting from resources/templates
. In this case: "../static/Redoc-Integrate.html".