Return-Path: X-Original-To: apmail-felix-users-archive@minotaur.apache.org Delivered-To: apmail-felix-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 803F2DD18 for ; Sun, 2 Sep 2012 15:33:31 +0000 (UTC) Received: (qmail 89730 invoked by uid 500); 2 Sep 2012 15:33:30 -0000 Delivered-To: apmail-felix-users-archive@felix.apache.org Received: (qmail 89686 invoked by uid 500); 2 Sep 2012 15:33:30 -0000 Mailing-List: contact users-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@felix.apache.org Delivered-To: mailing list users@felix.apache.org Received: (qmail 89678 invoked by uid 99); 2 Sep 2012 15:33:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Sep 2012 15:33:30 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of fmeschbe@adobe.com designates 64.18.1.25 as permitted sender) Received: from [64.18.1.25] (HELO exprod6og110.obsmtp.com) (64.18.1.25) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 02 Sep 2012 15:33:25 +0000 Received: from outbound-smtp-2.corp.adobe.com ([193.104.215.16]) by exprod6ob110.postini.com ([64.18.5.12]) with SMTP ID DSNKUEN8L7PsF3//f6cfBsQL/6BJZJRa6Q4a@postini.com; Sun, 02 Sep 2012 08:33:04 PDT Received: from inner-relay-4.eur.adobe.com (inner-relay-4b [10.128.4.237]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id q82FX3P7024760 for ; Sun, 2 Sep 2012 08:33:03 -0700 (PDT) Received: from nahub01.corp.adobe.com (nahub01.corp.adobe.com [10.8.189.97]) by inner-relay-4.eur.adobe.com (8.12.10/8.12.9) with ESMTP id q82FX0Ys004434 for ; Sun, 2 Sep 2012 08:33:02 -0700 (PDT) Received: from eurhub01.eur.adobe.com (10.128.4.30) by nahub01.corp.adobe.com (10.8.189.97) with Microsoft SMTP Server (TLS) id 8.3.264.0; Sun, 2 Sep 2012 08:33:00 -0700 Received: from eurmbx01.eur.adobe.com ([10.128.4.32]) by eurhub01.eur.adobe.com ([10.128.4.30]) with mapi; Sun, 2 Sep 2012 16:32:59 +0100 From: Felix Meschberger To: "users@felix.apache.org" Date: Sun, 2 Sep 2012 16:33:05 +0100 Subject: Re: Determining Servlet class which handles a given HTTP request Thread-Topic: Determining Servlet class which handles a given HTTP request Thread-Index: Ac2JIDtk/sIbO8SCTHKzO3c87okNhw== Message-ID: <4719A960-B787-46A9-BC4C-E8E4928DCB81@adobe.com> References: In-Reply-To: Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: de-DE, en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Hi, Am 02.09.2012 um 09:00 schrieb Chetan Mehrotra: > At times while debugging we need to find the servlet class name which > handles a particular request. In a JEE based Web Application one can find > out that by looking at the web.xml. However in OSGi it becomes bit tricky > to find out the information easily. Some information is provided by the > "Http Whiteboard" WebConsole Plugin [1]. However it does not provide > information about servlets which are registered directly through > org.osgi.service.http.HttpService.registerServlet(String, Servlet, > Dictionary, HttpContext) method or servlets which are managed by other Fw= k > like Sling Right. I created the "Http Whiteboard" plugin to see how and whether the whiteboar= d works. But maybe it is too short-sighted with respect to servlets and fil= ters registered through the service. This is definitively something which s= hould be improved. As to registration through other frameworks, particularly Sling: This is no= t something that we in the Apache Felix project can do much about (except f= or those servlets and filters registered through the HttpService (or ExtHtt= pService). Particularly in the case of Sling the servlets are only register= ed inside of Sling and not with the Http Service, that is the Http Service = does not know anything about them. So I think these other frameworks should care to display that information a= nd you should contact that community. >=20 > In case of Felix HttpService implementation this information is present > with o.a.f.http.base.internal.handler.HandlerRegistry [2] so I had to use > Sling Script Console [3] with script [7] to extract that information. It > would useful if all this information is exposed as part of some WebConsol= e > plugin similar to "Http Whiteboard" plugin. I am not sure what would be t= he > best way to achieve that but if we have a WebConsole plugin which exposes > some sort of API to allow various sub systems to provide Servlet > registration info then it can be used to provide all the required > information at one place collected from various sources like >=20 > 1. Http Whiteboard information exists > 2. HttpService handlerRegistry (possibly a super set of #1) +1, as I said > 3. SlingServletResolver [4] Problem of Sling. But I have been thinking about a plugin for that one wher= e you could enter an URL (or path) and the plugin would return the candidat= e scripts and servlets and mark the selected one. > 4. Sling Filter Printer [5] >=20 > At minimum having access to HandlerRegistry state via current Http > Whiteboard would also help. Information related to Sling can somewhat be > extracted from Recent Requests plugin [6] >=20 > Thoughts? I am not sure whether it is possible at all to have a single plugin suitabl= e for all of the Http Service plus any existing frameworks ... This would r= ather be something pluggable... Regards Felix >=20 > Chetan Mehrotra >=20 > [1] > https://github.com/apache/felix/blob/trunk/http/whiteboard/src/main/java/= org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsoleP= lugin.java >=20 > [2] > https://github.com/apache/felix/blob/trunk/http/base/src/main/java/org/ap= ache/felix/http/base/internal/handler/HandlerRegistry.java >=20 > [3] https://github.com/chetanmeh/c/wiki/Sling-Script-Console > [4] > https://github.com/apache/sling/blob/trunk/bundles/servlets/resolver/src/= main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.= java >=20 > [5] > https://github.com/apache/sling/blob/trunk/bundles/engine/src/main/java/o= rg/apache/sling/engine/impl/WebConsoleConfigPrinter.java > [6] http://sling.apache.org/site/monitoring-requests.html >=20 > [7] > import org.osgi.service.http.HttpService > import org.osgi.framework.FrameworkUtil > import org.osgi.framework.Bundle >=20 > def httpService =3D sling.getService(HttpService.class) > httpService.handlerRegistry.aliasMap.each{alias,servlet -> > Bundle bnd =3D FrameworkUtil.getBundle(servlet.class) > println "$alias : ${servlet.class.name} ($bnd.symbolicName)" > } --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@felix.apache.org For additional commands, e-mail: users-help@felix.apache.org