Hi
I have created a class as you mentioned and implemented doFilter method,
but this method is not invoking while server starts.
I have added the below config in web.xml
<filter>
<filter-name>apidoc-config</filter-name>
<filter-class>com.test.servlet.SwaggerConfigFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>apidoc-config</filter-name>
<url-pattern>/api-docs/*</url-pattern>
</filter-mapping>
and
On Tuesday, April 29, 2014 at 12:59:00 PM UTC-5, Alexander Denissov wrote:
>
> If you need to dynamically figure out the basepath based on the external
> hostname where your app is deployed, you can write a servlet filter that
> will figure it out and then set it in the Swagger configuration.
>
> Inside the filter doFilter() method you can write:
>
> String contextPathUrl = new URL(request.getScheme(),
> request.getServerName(), request.getServerPort(), filterConfig
> .getServletContext().getContextPath()).toExternalForm();
>
> ConfigFactory.config().setBasePath(contextPathUrl);
>
> Make sure this is done only once (remember state in a private static
> boolean) and apply filter mapping in your web.xml
>
> <filter>
>
> <filter-name>apidoc-config</filter-name>
>
> <filter-class>my.ApiDocConfigFilter</filter-class>
>
> </filter>
>
> <filter-mapping>
>
> <filter-name>apidoc-config</filter-name>
>
> <url-pattern>/api-docs/*</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.