문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
programming:documentation:swagger [2015/02/04 16:43] kwon37xi |
programming:documentation:swagger [2018/07/24 13:44] kwon37xi [SpringBoot] |
||
---|---|---|---|
줄 2: | 줄 2: | ||
* http:// | * http:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
===== Spring MVC and swagger ===== | ===== Spring MVC and swagger ===== | ||
줄 13: | 줄 14: | ||
@Override | @Override | ||
protected void addResourceHandlers(ResourceHandlerRegistry registry) { | protected void addResourceHandlers(ResourceHandlerRegistry registry) { | ||
- | | + | |
- | .addResourceLocations(WEB_JAR_RESOURCE_LOCATION, | + | .addResourceLocations(WEB_JAR_RESOURCE_LOCATION, |
- | WEB_JAR_RESOURCE_LOCATION + " | + | |
- | super.addResourceHandlers(registry); | + | |
+ | WEB_JAR_RESOURCE_LOCATION + " | ||
+ | | ||
+ | | ||
+ | super.addResourceHandlers(registry); | ||
} | } | ||
줄 22: | 줄 27: | ||
@Controller | @Controller | ||
public class SwaggerController { | public class SwaggerController { | ||
- | | + | |
- | private ResourceLoader resourceLoader; | + | private ResourceLoader resourceLoader; |
- | | + | |
- | public void swagger(HttpServletResponse response) throws IOException { | + | public void swagger(HttpServletResponse response) throws IOException { |
- | final Resource swaggerHtmlResource = resourceLoader.getResource(" | + | final Resource swaggerHtmlResource = |
+ | | ||
- | | + | |
- | final String refinedHtml = swaggerHtmlContents | + | |
- | .replaceAll(" | + | final String refinedHtml = swaggerHtmlContents |
+ | .replaceAll(" | ||
- | | + | |
- | final PrintWriter writer = response.getWriter(); | + | final PrintWriter writer = response.getWriter(); |
- | writer.write(refinedHtml); | + | writer.write(refinedHtml); |
- | writer.close(); | + | writer.close(); |
- | } | + | } |
} | } | ||
</ | </ | ||
+ | |||
+ |