9
9
import org .springdoc .core .SwaggerUiConfigProperties ;
10
10
import org .springdoc .ui .AbstractSwaggerWelcome ;
11
11
12
+ import org .springframework .http .HttpStatus ;
13
+ import org .springframework .http .ResponseEntity ;
12
14
import org .springframework .web .servlet .support .ServletUriComponentsBuilder ;
13
- import org .springframework .web .servlet .view .UrlBasedViewResolver ;
14
15
import org .springframework .web .util .UriComponentsBuilder ;
15
16
16
17
import static org .springdoc .core .Constants .SWAGGER_UI_URL ;
@@ -26,15 +27,17 @@ public SwaggerWelcomeCommon(SwaggerUiConfigProperties swaggerUiConfig, SpringDoc
26
27
super (swaggerUiConfig , springDocConfigProperties , swaggerUiConfigParameters );
27
28
}
28
29
29
- protected String redirectToUi (HttpServletRequest request ) {
30
+ protected ResponseEntity < Void > redirectToUi (HttpServletRequest request ) {
30
31
buildConfigUrl (request .getContextPath (), ServletUriComponentsBuilder .fromCurrentContextPath ());
31
- String sbUrl = swaggerUiConfigParameters .getUiRootPath () + SWAGGER_UI_URL ;
32
+ String sbUrl = request . getContextPath () + swaggerUiConfigParameters .getUiRootPath () + SWAGGER_UI_URL ;
32
33
UriComponentsBuilder uriBuilder = getUriComponentsBuilder (sbUrl );
33
34
34
35
// forward all queryParams from original request
35
36
request .getParameterMap ().forEach (uriBuilder ::queryParam );
36
37
37
- return UrlBasedViewResolver .REDIRECT_URL_PREFIX + uriBuilder .build ().encode ().toString ();
38
+ return ResponseEntity .status (HttpStatus .FOUND )
39
+ .location (uriBuilder .build ().encode ().toUri ())
40
+ .build ();
38
41
}
39
42
40
43
protected Map <String , Object > openapiJson (HttpServletRequest request ) {
0 commit comments