Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7117

Swagger2Feature not working in OSGi container when jaxrs server address not attached to CXF servlet

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.8
    • Fix Version/s: 3.1.9, 3.2.0
    • Component/s: OSGi
    • Labels:
      None
    • Environment:

      Apache Karaf 3.0.8

    • Estimated Complexity:
      Unknown

      Description

      Just modify sample description_swagger2_osgi as follows:

      <!-- CXF Swagger2Feature -->
      <bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
      <property name="basePath" value="/test/swaggerSample"/>
      <property name="usePathBasedConfig" value="true" />
      </bean>

      <cxf:bus>
      <cxf:features>
      <cxf:logging />
      </cxf:features>
      </cxf:bus>

      <jaxrs:server id="sampleServer" address="http://localhost:9091/test/swaggerSample">
      <jaxrs:serviceBeans>
      <ref component-id="sampleResource" />
      </jaxrs:serviceBeans>
      <jaxrs:providers>
      <ref component-id="jsonProvider" />
      <ref component-id="multipartProvider" />
      <ref component-id="originFilter" />
      </jaxrs:providers>
      <jaxrs:features>
      <ref component-id="swagger2Feature" />
      </jaxrs:features>
      </jaxrs:server>

      Then deploy modified bundle into Karaf and browse Swagger service definition at http://localhost:9091/test/swaggerSample/swagger.json

      Result is:

      {"swagger":"2.0"}

        Attachments

          Activity

            People

            • Assignee:
              reta Andriy Redko
              Reporter:
              nsaboy Concombre Masqué
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: