So how do I construct the URL of the spec file? And suppose the war of my 
application is present within the webapp folder of Tomcat, where do I have 
put the Swagger UI so that CORS is not needed?

On Thursday, February 22, 2018 at 8:08:06 PM UTC+5:30, Ron wrote:
>
> Even if you have the spec in the webapp folder, it’d be hosted just like 
> swagger-ui and have a URL – feed that to it.
>
> CORS is only needed if the host and port of the javascript and the target 
> calls are not the same, by definition.
>
>  
>
>  
>
>  
>
> *From: *<swagger-sw...@googlegroups.com <javascript:>> on behalf of Sayak 
> Paul <spsay...@gmail.com <javascript:>>
> *Reply-To: *"swagger-sw...@googlegroups.com <javascript:>" <
> swagger-sw...@googlegroups.com <javascript:>>
> *Date: *Wednesday, February 21, 2018 at 20:57
> *To: *Swagger <swagger-sw...@googlegroups.com <javascript:>>
> *Subject: *Re: Running Swagger UI on Tomcat
>
>  
>
> Thanks Ron for clearing the doubts. Furthermore, what if I am having the 
> spec locally inside the webapps folder? How do I point it to the index.html 
> of Swagger-UI? And also I didn't get CORS will not be needed if my app and 
> Swagger UI are running in the same application. Could you please provide an 
> example?
> On Wednesday, February 21, 2018 at 11:48:04 PM UTC+5:30, Ron wrote: 
>
> 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: *<swagger-sw...@googlegroups.com> on behalf of Sayak Paul <
> spsay...@gmail.com>
> *Reply-To: *"swagger-sw...@googlegroups.com" <
> swagger-sw...@googlegroups.com>
> *Date: *Tuesday, February 20, 2018 at 23:12
> *To: *Swagger <swagger-sw...@googlegroups.com>
> *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 swagger-swaggersocket+unsubscr...@googlegroups.com.
> 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 swagger-swaggersocket+unsubscr...@googlegroups.com <javascript:>.
> 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 swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to