Hi,

here's a sample (itest) on how to use services for the jetty handler:

https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/java/org/ops4j/pax/web/itest/jetty/JettyHandlerServiceIntegrationTest.java

regards, Achim

Am Fr., 19. Okt. 2018 um 09:05 Uhr schrieb Grzegorz Grzybek <
gr.grzy...@gmail.com>:

> Hello
>
> if you want global filters or prometheus integration (I imagine it like
>>> single endpoint, like /health or /metrics or something) you could try doing
>>> something container (jetty/undertow/tomcat) specific. Tomcat has
>>> valves, jetty and undertow have handlers - you can look at the code to
>>> check how for example NSCA logging interceptor/handler/valve is implemented.
>>>
>>
>> What would be the right place to register my handler directly on Jetty?
>>
>> It is somewhere created internally in Pax-Web and it is not exposed to
>> OSGi context....
>>
>
> I didn't check it, but you could try adding some additional handlers in
> etc/jetty.xml (in Karaf). Something like:
>
> <Configure id="Server" class="org.eclipse.jetty.server.Server">
>   <Call name="addBean">
>     <Arg>
>       <New class="org.eclipse.jetty.server.Handler">
>
> I'm not sure if it will work, but jetty.xml syntax is quite powerful. You
> can add different "beans" to different objects.
> Also I see that pax-web-jetty tracks instances of OSGi services for
> org.eclipse.jetty.server.Handler - so you should be able to register your
> own. See
> org.ops4j.pax.web.service.jetty.internal.JettyServerImpl#addHandler() for
> where it's used and how - it can even be prioritized.
>
> The main handler (actually HandlerCollection) is
> org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection and
> when a handler is added to this collection, it'll be called - see here
> how pax-web-jetty calls all the handlers
> <https://github.com/ops4j/org.ops4j.pax.web/blob/pax-web-7.2.x/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerHandlerCollection.java#L93-L105>
> .
>
> best regards
> Grzegorz Grzybek
>
>
>>
>> Best regards,
>>
>> Lukasz Lech
>>
>>
>>
>> --
>> --
>> ------------------
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ops4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to