You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marvin <mg...@novomind.com> on 2016/12/05 20:11:56 UTC

swagger-java with multiple wars returns no content

Hi,

I'm working with multiple wars which are running in a tomcat. In each
application I defined some rest interfaces and use a servlet (each servlet
has it's own unique name). I also configured swagger in each application.

Now I have the problem that swagger works with one application only. If I
deploy another war swagger doesn't work anymore. If I call the api-docs I
get an empty response (http 204). 

Currently I'm working with camel version 2.18.1 and I'm using camel-core as
shared library due to vm component (maybe this could be helpful). With
camel-swagger (2.15.2) it worked fine.

Following my configuration (similar in each application):

*web.xml*:

	<servlet>
		<display-name>Camel Http Transport Servlet</display-name>
		<servlet-name>TestCamelServlet</servlet-name>
	
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>TestCamelServlet</servlet-name>
		<url-pattern>/rest/*</url-pattern>
	</servlet-mapping>


	<servlet>	
		<servlet-name>ApiDeclarationServlet</servlet-name>
	
<servlet-class>org.apache.camel.swagger.servlet.RestSwaggerServlet</servlet-class>

		<init-param>
			<param-name>base.path</param-name>
			<param-value>rest</param-value>
		</init-param>
		<init-param>
			<param-name>api.path</param-name>
			<param-value>api-docs</param-value>
		</init-param>
		<init-param>
			<param-name>api.version</param-name>
			<param-value>1.0</param-value>
		</init-param>
		<init-param>
			<param-name>api.title</param-name>
			<param-value>Test API</param-value>
		</init-param>
		<init-param>
			<param-name>api.description</param-name>
			<param-value>Test Description</param-value>
		</init-param>
		<load-on-startup>2</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>ApiDeclarationServlet</servlet-name>
		<url-pattern>/api-docs/*</url-pattern>
	</servlet-mapping>

        <filter>
            <filter-name>RestSwaggerCorsFilter</filter-name>
          
<filter-class>org.apache.camel.swagger.servlet.RestSwaggerCorsFilter</filter-class>
        </filter>
  
        <filter-mapping>
            <filter-name>RestSwaggerCorsFilter</filter-name>
            <url-pattern>/api-docs/*</url-pattern>
            <url-pattern>/rest/*</url-pattern>
        </filter-mapping>

*restConfiguration*:
        restConfiguration().component("servlet")
                .endpointProperty("servletName", "TestCamelServlet")
                .dataFormatProperty("prettyPrint", "true")
                .bindingMode(RestBindingMode.auto)
                .contextPath("test-api/rest");

Does anyone have an idea how I can solve this?

BR
Marvin



--
View this message in context: http://camel.465427.n5.nabble.com/swagger-java-with-multiple-wars-returns-no-content-tp5791067.html
Sent from the Camel - Users mailing list archive at Nabble.com.