It should work, yes. Pretty much like you’d serve any other static content.

You’d need to modify the index.html and point it the the URL where your API 
definition is served.

You do not need to enable CORS if the app and swagger-ui run in the same 
application.

 

 

 

From: <[email protected]> on behalf of Sayak Paul 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Tuesday, February 20, 2018 at 23:12
To: Swagger <[email protected]>
Subject: Running Swagger UI on Tomcat

 

Hello. I have downloaded the zip version of Swagger-UI from Git. Now I want to 
host it from Tomcat locally with my customized .json spec. If I simply put the 
whole Swagger-UI folder in the webapps folder of Tomcat, will it work? And how 
do I add my own spec into it? Let's say my APIs are running in the same Tomcat 
Server itslef. 

What are steps that are to be taken care of? How do I do the CORS in this case? 
Will adding the following do the work? 

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>
-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to