Hi

CXF does not contribute itself to the generation of 'host' within the Swagger JSON. For example, try a jaxrs/spring-boot demo, or some of other swagger2 demos...

If you'd like you can get the CXF source, and step through the CXF Swagger2Feature

Sergey

On 12/10/17 11:06, nino martinez wael wrote:
Hi Sergey,

I've tried this:

Swagger2Feature swagger =new Swagger2Feature();

swagger.setHost("127.0.0.1:9090 <http://127.0.0.1:9090>");

swagger.setUsePathBasedConfig(true);


BUT the swagger json still states:


0.0.0.0:9090 <http://0.0.0.0:9090>


As far as I can see it is something CXF generates.. I cant really pinpoint 
where CXF grabs the configuration from, but if I change

swagger.setLicense("Commercial DOES THIS APPLY?");


It does apply in the swagger json and I am able to change that part, it is as 
CXF ignores the swagger.getHOST method...



On Thu, Oct 12, 2017 at 11:25 AM, Sergey Beryozkin <[email protected] <mailto:[email protected]>> wrote:

    In this case it is really somewhere in the Swagger code

    Sergey
    On 11/10/17 18:29, nino martinez wael wrote:

        No problem, I tried both configurations but no matter what I do,
        the host remains the same 0.0.0.0:9090 <http://0.0.0.0:9090>
        <http://0.0.0.0:9090>

        On 11 Oct 2017 15:51, "Sergey Beryozkin" <[email protected]
        <mailto:[email protected]> <mailto:[email protected]
        <mailto:[email protected]>>> wrote:

             Sorry, I accidentally moved it from the users list,


             On 11/10/17 14:42, nino martinez wael wrote:

                 Sure, in my example you can see that host 0.0.0.0:9090
        <http://0.0.0.0:9090>
                 <http://0.0.0.0:9090> <http://0.0.0.0:9090> have been
                 generated.. However calling

        http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns
        <http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns>
<http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns
        <http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns>>
<http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns
        <http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns>
<http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns
        <http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns>>>



                 Will never work.. It has to be an IP or dns name..
        0.0.0.0 is
                 not valid..


             CXF Swagger2Feature is definitely not involved into
        generating a
             host value, but it has a 'host' property which if set is
        passed to
             Swagger.

             May be alternative option is to set a 'usePathBasedConfig'
        property
             - I think this may actually work better

             HTH, SErgey



                 On Wed, Oct 11, 2017 at 3:19 PM, Sergey Beryozkin
                 <[email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>
                 <mailto:[email protected]
        <mailto:[email protected]> <mailto:[email protected]
        <mailto:[email protected]>>>> wrote:

                      Can you please explain what is wrong with the returned
                 fragment ?

                      Sergey

                      On 11/10/17 14:12, nino martinez wael wrote:

                          Im not sure if I have explained myself
        correctly.. The
                 problem
                          is this:

        http://localhost:9090/tdc/dialer/webservices/v1/swagger.json#/
        <http://localhost:9090/tdc/dialer/webservices/v1/swagger.json#/>
<http://localhost:9090/tdc/dialer/webservices/v1/swagger.json#/
        <http://localhost:9090/tdc/dialer/webservices/v1/swagger.json#/>>
<http://localhost:9090/tdc/dialer/webservices/v1/swagger.json#/
        <http://localhost:9090/tdc/dialer/webservices/v1/swagger.json#/>
<http://localhost:9090/tdc/dialer/webservices/v1/swagger.json#/
        <http://localhost:9090/tdc/dialer/webservices/v1/swagger.json#/>>>

                          {
                              "swagger" : "2.0",
                              "info" : {
                                "description" : "Osgi Dialer Webservice",
                                "version" : "1.26.0.SNAPSHOT",
                                "title" : "Osgi Dialer Webservice",
                                "contact" : {
                                  "name" : "[email protected]
        <mailto:[email protected]>
                 <mailto:[email protected]
        <mailto:[email protected]>>
                          <mailto:[email protected]
        <mailto:[email protected]>
                 <mailto:[email protected]
        <mailto:[email protected]>>>"

                                },
                                "license" : {
                                  "name" : "Commercial",
                                  "url" :
                 "http://www.apache.org/licenses/LICENSE-2.0.html
        <http://www.apache.org/licenses/LICENSE-2.0.html>
                 <http://www.apache.org/licenses/LICENSE-2.0.html
        <http://www.apache.org/licenses/LICENSE-2.0.html>>
<http://www.apache.org/licenses/LICENSE-2.0.html
        <http://www.apache.org/licenses/LICENSE-2.0.html>
                 <http://www.apache.org/licenses/LICENSE-2.0.html
        <http://www.apache.org/licenses/LICENSE-2.0.html>>>"
                                }
                              },  "host" : "0.0.0.0:9090
        <http://0.0.0.0:9090> <http://0.0.0.0:9090>
                 <http://0.0.0.0:9090>",

                              "basePath" : "/tdc/dialer/webservices/v1",
                              "tags" : [ {
                                "name" : "api-docs"
                              }


                          Swagger UI then generates requests like this:

        http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns
        <http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns>
<http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns
        <http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns>>
<http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns
        <http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns>
<http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns
        <http://0.0.0.0:9090/tdc/dialer/webservices/v1/fullcampaigns>>>


                          Which obviously fails.. How can I change this
        behaviour?


                          On Tue, Oct 10, 2017 at 3:31 PM, nino martinez
        wael <
        [email protected]
        <mailto:[email protected]>
        <mailto:[email protected]
        <mailto:[email protected]>>
                          <mailto:[email protected]
        <mailto:[email protected]>
                 <mailto:[email protected]
        <mailto:[email protected]>>>> wrote:

                              Hi

                              I am running a dedicated CXF JAX RS on
        0.0.0.0:9090 <http://0.0.0.0:9090>
                 <http://0.0.0.0:9090>
                              <http://0.0.0.0:9090>


                              the issue are that my swagger.json states
        that the
                 host are
        0.0.0.0:9090 <http://0.0.0.0:9090> <http://0.0.0.0:9090>
        <http://0.0.0.0:9090>


                              I've tried to overwrite it using:

                              Swagger2Feature swagger = new
        Swagger2Feature();
                              swagger.setHost("127.0.0.1:9000
        <http://127.0.0.1:9000>
                 <http://127.0.0.1:9000> <http://127.0.0.1:9000>");


                              But swagger.json remains unchanged. What
        am I missing?


                              --
                              Best regards / Med venlig hilsen
                              Nino Martinez







                 --         Best regards / Med venlig hilsen
                 Nino Martinez





--
Best regards / Med venlig hilsen
Nino Martinez


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to