You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tim Dudgeon <td...@gmail.com> on 2015/06/22 16:24:16 UTC

swagger + jetty with REST DSL

Can someone provide some info on how to get swagger set up with the REST 
DSL in a simple jetty environment.
e.g. something very similar to what Christian described here:
http://blog.christianposta.com/camel/easy-rest-endpoints-with-apache-camel-2-14/
e.g. Java only, no Spring.

Thanks
Tim

Re: swagger + jetty with REST DSL

Posted by Tim Dudgeon <td...@gmail.com>.
Not sure I really understand. What I really want is to add the Swagger 
servlet so that it can doument my REST api that is provided by the Camel 
REST DSL, both running in the same Jetty server.
So I use the REST DSL to define operations under /rest and want to have 
swagger running and documenting those endpoints.

Tim


On 24/06/2015 11:39, Claus Ibsen wrote:
> Its not intended to add handlers that work with different
> context-paths. eg those handlers are for adding security, logging and
> whatnot.
>
> But you can turn on matchOnUriPrefix=true and then the camel jetty
> route should react. If you want /hello then add /hello to the jetty
> route.
>
>
>
> On Wed, Jun 24, 2015 at 12:34 PM, Tim Dudgeon <td...@gmail.com> wrote:
>> I'm struggling with this, so I tried setting up a dead simple servlet
>> example and can't even get that working.
>> Using plain Jetty its fine, but I don't seem able to wire it into camel .
>> I created this GIST to illustrate it:
>> https://gist.github.com/tdudgeon/69ff3cdeb4e3ac68df87
>>
>> Jetty responds on
>> localhost:8000/
>> but the helloServlet does not respond on anything under
>> localhost:8000/hello/
>>
>> What am I doing wrong?
>>
>> Tim
>>
>>
>> On 22/06/2015 15:36, Claus Ibsen wrote:
>>> Hi
>>>
>>> You need to use the camel-swagger as a servlet
>>> http://camel.apache.org/swagger
>>>
>>> How you configure this can be done with web.xml or some fancy @servlet
>>> annotations.
>>>
>>> The camel route can be in java dsl and camel-swagger servlet discovers
>>> this using JMX - so they have to be in the same JVM, or better in same
>>> deployment unit. There is a pending ticket to make it separate and so
>>> you can specify which camel context you wanna see the api.
>>>
>>> There is an example in the examples dir using tomcat.
>>>
>>> On Mon, Jun 22, 2015 at 4:24 PM, Tim Dudgeon <td...@gmail.com>
>>> wrote:
>>>> Can someone provide some info on how to get swagger set up with the REST
>>>> DSL
>>>> in a simple jetty environment.
>>>> e.g. something very similar to what Christian described here:
>>>>
>>>> http://blog.christianposta.com/camel/easy-rest-endpoints-with-apache-camel-2-14/
>>>> e.g. Java only, no Spring.
>>>>
>>>> Thanks
>>>> Tim
>>>
>>>
>
>


Re: swagger + jetty with REST DSL

Posted by Claus Ibsen <cl...@gmail.com>.
Its not intended to add handlers that work with different
context-paths. eg those handlers are for adding security, logging and
whatnot.

But you can turn on matchOnUriPrefix=true and then the camel jetty
route should react. If you want /hello then add /hello to the jetty
route.



On Wed, Jun 24, 2015 at 12:34 PM, Tim Dudgeon <td...@gmail.com> wrote:
> I'm struggling with this, so I tried setting up a dead simple servlet
> example and can't even get that working.
> Using plain Jetty its fine, but I don't seem able to wire it into camel .
> I created this GIST to illustrate it:
> https://gist.github.com/tdudgeon/69ff3cdeb4e3ac68df87
>
> Jetty responds on
> localhost:8000/
> but the helloServlet does not respond on anything under
> localhost:8000/hello/
>
> What am I doing wrong?
>
> Tim
>
>
> On 22/06/2015 15:36, Claus Ibsen wrote:
>>
>> Hi
>>
>> You need to use the camel-swagger as a servlet
>> http://camel.apache.org/swagger
>>
>> How you configure this can be done with web.xml or some fancy @servlet
>> annotations.
>>
>> The camel route can be in java dsl and camel-swagger servlet discovers
>> this using JMX - so they have to be in the same JVM, or better in same
>> deployment unit. There is a pending ticket to make it separate and so
>> you can specify which camel context you wanna see the api.
>>
>> There is an example in the examples dir using tomcat.
>>
>> On Mon, Jun 22, 2015 at 4:24 PM, Tim Dudgeon <td...@gmail.com>
>> wrote:
>>>
>>> Can someone provide some info on how to get swagger set up with the REST
>>> DSL
>>> in a simple jetty environment.
>>> e.g. something very similar to what Christian described here:
>>>
>>> http://blog.christianposta.com/camel/easy-rest-endpoints-with-apache-camel-2-14/
>>> e.g. Java only, no Spring.
>>>
>>> Thanks
>>> Tim
>>
>>
>>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: swagger + jetty with REST DSL

Posted by Tim Dudgeon <td...@gmail.com>.
I'm struggling with this, so I tried setting up a dead simple servlet 
example and can't even get that working.
Using plain Jetty its fine, but I don't seem able to wire it into camel .
I created this GIST to illustrate it:
https://gist.github.com/tdudgeon/69ff3cdeb4e3ac68df87

Jetty responds on
localhost:8000/
but the helloServlet does not respond on anything under
localhost:8000/hello/

What am I doing wrong?

Tim

On 22/06/2015 15:36, Claus Ibsen wrote:
> Hi
>
> You need to use the camel-swagger as a servlet
> http://camel.apache.org/swagger
>
> How you configure this can be done with web.xml or some fancy @servlet
> annotations.
>
> The camel route can be in java dsl and camel-swagger servlet discovers
> this using JMX - so they have to be in the same JVM, or better in same
> deployment unit. There is a pending ticket to make it separate and so
> you can specify which camel context you wanna see the api.
>
> There is an example in the examples dir using tomcat.
>
> On Mon, Jun 22, 2015 at 4:24 PM, Tim Dudgeon <td...@gmail.com> wrote:
>> Can someone provide some info on how to get swagger set up with the REST DSL
>> in a simple jetty environment.
>> e.g. something very similar to what Christian described here:
>> http://blog.christianposta.com/camel/easy-rest-endpoints-with-apache-camel-2-14/
>> e.g. Java only, no Spring.
>>
>> Thanks
>> Tim
>
>


Re: swagger + jetty with REST DSL

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You need to use the camel-swagger as a servlet
http://camel.apache.org/swagger

How you configure this can be done with web.xml or some fancy @servlet
annotations.

The camel route can be in java dsl and camel-swagger servlet discovers
this using JMX - so they have to be in the same JVM, or better in same
deployment unit. There is a pending ticket to make it separate and so
you can specify which camel context you wanna see the api.

There is an example in the examples dir using tomcat.

On Mon, Jun 22, 2015 at 4:24 PM, Tim Dudgeon <td...@gmail.com> wrote:
> Can someone provide some info on how to get swagger set up with the REST DSL
> in a simple jetty environment.
> e.g. something very similar to what Christian described here:
> http://blog.christianposta.com/camel/easy-rest-endpoints-with-apache-camel-2-14/
> e.g. Java only, no Spring.
>
> Thanks
> Tim



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/