문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
programming:documentation:swagger [2018/07/18 17:00] kwon37xi |
programming:documentation:swagger [2019/02/22 17:10] kwon37xi |
||
---|---|---|---|
줄 1: | 줄 1: | ||
====== Swagger ====== | ====== Swagger ====== | ||
* http:// | * http:// | ||
+ | * [[springframework: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
- | ===== Spring MVC and swagger | + | ===== ReDoc ===== |
- | * [[https:// | + | * [[https:// |
- | * [[https:// | + | |
- | * Spring MVC Swagger 튜토리얼 시리즈 | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * Spring MVC API 적용 Servlet의 "/" | + | |
- | // /css/*, /js/* 등에 대한 핸들러 추가. | + | |
- | @Override | + | |
- | protected void addResourceHandlers(ResourceHandlerRegistry registry) { | + | |
- | registry.addResourceHandler(" | + | |
- | .addResourceLocations(WEB_JAR_RESOURCE_LOCATION, | + | |
- | WEB_JAR_RESOURCE_LOCATION + " | + | |
- | WEB_JAR_RESOURCE_LOCATION + " | + | |
- | WEB_JAR_RESOURCE_LOCATION + " | + | |
- | WEB_JAR_RESOURCE_LOCATION + " | + | |
- | .setCachePeriod(0); | + | |
- | super.addResourceHandlers(registry); | + | |
- | } | + | |
- | @ApiIgnore | + | ===== Swagger2MarkUp |
- | @Controller | + | * [[https://github.com/Swagger2Markup/ |
- | public class SwaggerController { | + | |
- | @Autowired | + | |
- | private ResourceLoader resourceLoader; | + | |
- | + | ||
- | @RequestMapping("/ | + | |
- | public void swagger(HttpServletResponse response) throws IOException { | + | |
- | final Resource swaggerHtmlResource | + | |
- | resourceLoader.getResource(" | + | |
- | + | ||
- | final String swaggerHtmlContents | + | |
- | CoupangIOUtils.toString(swaggerHtmlResource.getInputStream(), | + | |
- | final String refinedHtml | + | |
- | .replaceAll(" | + | |
- | + | ||
- | response.setContentType(" | + | |
- | final PrintWriter writer | + | |
- | writer.write(refinedHtml); | + | |
- | writer.close(); | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | ===== SpringBoot | + | |
- | * [[http://springboot.tistory.com/24|Spring REST API에 Swagger 2 설정하기]] | + | |