You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by David Daniel <da...@gmail.com> on 2016/06/01 20:24:01 UTC

Get a list of paths of registered servlets

Is it possible to find out what servlets have been registered with the
httpservice.  I am dynamically registering servlets and want to verify that
a servlet has not already been registered with the same path.  Is there a
way to query the httpservice for all servlet paths that are registered,
should I be keeping that information elsewhere or is there a tracker of
some sort.

Thanks for any help,
  David

Re: Get a list of paths of registered servlets

Posted by Timothy Ward <ti...@hotmail.com>.
> On 2 Jun 2016, at 06:04, Carsten Ziegeler <cz...@apache.org> wrote:
> 
> Marcel Offermans wrote
>> That only helps him if he uses the whiteboard API. If he directly talks to HttpService it probably won’t work.
>> 
> The Felix implementation also lists all servlets registered with the
> HttpService using the DTO api.

Note that this behaviour is defined by the Http Whiteboard spec. The description in 140.15.2.4 states what negative service ids mean.

> 
> Carsten
> -- 
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Get a list of paths of registered servlets

Posted by Carsten Ziegeler <cz...@apache.org>.
Marcel Offermans wrote
> That only helps him if he uses the whiteboard API. If he directly talks to HttpService it probably won\u2019t work.
> 
The Felix implementation also lists all servlets registered with the
HttpService using the DTO api.
 
Carsten
-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Get a list of paths of registered servlets

Posted by David Daniel <da...@gmail.com>.
Thank you all for your help. I will just try and register and keep track of
what is registered with the whiteboard API. I had not known about it and
appreciate all the help
On Jun 1, 2016 5:45 PM, "Raymond Auge" <ra...@liferay.com> wrote:

> On Wed, Jun 1, 2016 at 5:43 PM, Raymond Auge <ra...@liferay.com>
> wrote:
>
> > increments downward from -1
> >
>
> decrementing from -1
>

Re: Get a list of paths of registered servlets

Posted by Raymond Auge <ra...@liferay.com>.
On Wed, Jun 1, 2016 at 5:43 PM, Raymond Auge <ra...@liferay.com>
wrote:

> increments downward from -1
>

decrementing from -1

Re: Get a list of paths of registered servlets

Posted by Raymond Auge <ra...@liferay.com>.
Also, the runtime API DOES include information about the legacy HttpService
registrations, the service id numbering increments downward from -1
indicating they aren't real services.

that's the only difference.

- Ray

On Wed, Jun 1, 2016 at 5:40 PM, Neil Bartlett <nj...@gmail.com> wrote:

> Well, you CAN atomically find out whether the name you want to register is
> already registered: just try to do it, and catch the NamespaceException.
>
> Neil
>
>
> > On 1 Jun 2016, at 22:37, Marcel Offermans <ma...@luminis.nl>
> wrote:
> >
> > That only helps him if he uses the whiteboard API. If he directly talks
> to HttpService it probably won’t work.
> >
> > Another problem is that you probably can’t do this as an atomic
> operation so after you’ve checked, someone else can still beat you to it.
> >
> > That said I don’t have a great solution to your problem beyond keeping
> track of this yourself and delegating the registration of the servlets to a
> service you design (which can then atomically do such a check). Again, that
> only works if everything then goes through your service.
> >
> > Greetings, Marcel
> >
> > On 1 June 2016 at 22:56:01, Raymond Auge (raymond.auge@liferay.com)
> wrote:
> >
> > The Http Whiteboard API contains a runtime introspection API which
> returns
> > DTOs of what's registered.
> >
> > look for a service registered under interface:
> >
> > org.osgi.service.http.runtime.HttpServiceRuntime
> >
> >
> > - Ray
> >
> > On Wed, Jun 1, 2016 at 4:24 PM, David Daniel <
> david.daniel.1979@gmail.com>
> > wrote:
> >
> >> Is it possible to find out what servlets have been registered with the
> >> httpservice. I am dynamically registering servlets and want to verify
> that
> >> a servlet has not already been registered with the same path. Is there a
> >> way to query the httpservice for all servlet paths that are registered,
> >> should I be keeping that information elsewhere or is there a tracker of
> >> some sort.
> >>
> >> Thanks for any help,
> >> David
> >>
> >
> >
> >
> > --
> > *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
> > (@rotty3000)
> > Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
> > (@Liferay)
> > Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org>
> (@OSGiAlliance)
>
>


-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Re: Get a list of paths of registered servlets

Posted by Neil Bartlett <nj...@gmail.com>.
Well, you CAN atomically find out whether the name you want to register is already registered: just try to do it, and catch the NamespaceException.

Neil


> On 1 Jun 2016, at 22:37, Marcel Offermans <ma...@luminis.nl> wrote:
> 
> That only helps him if he uses the whiteboard API. If he directly talks to HttpService it probably won’t work.
> 
> Another problem is that you probably can’t do this as an atomic operation so after you’ve checked, someone else can still beat you to it.
> 
> That said I don’t have a great solution to your problem beyond keeping track of this yourself and delegating the registration of the servlets to a service you design (which can then atomically do such a check). Again, that only works if everything then goes through your service.
> 
> Greetings, Marcel
> 
> On 1 June 2016 at 22:56:01, Raymond Auge (raymond.auge@liferay.com) wrote:
> 
> The Http Whiteboard API contains a runtime introspection API which returns  
> DTOs of what's registered.  
> 
> look for a service registered under interface:  
> 
> org.osgi.service.http.runtime.HttpServiceRuntime  
> 
> 
> - Ray  
> 
> On Wed, Jun 1, 2016 at 4:24 PM, David Daniel <da...@gmail.com>  
> wrote:  
> 
>> Is it possible to find out what servlets have been registered with the  
>> httpservice. I am dynamically registering servlets and want to verify that  
>> a servlet has not already been registered with the same path. Is there a  
>> way to query the httpservice for all servlet paths that are registered,  
>> should I be keeping that information elsewhere or is there a tracker of  
>> some sort.  
>> 
>> Thanks for any help,  
>> David  
>> 
> 
> 
> 
> --  
> *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>  
> (@rotty3000)  
> Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>  
> (@Liferay)  
> Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Get a list of paths of registered servlets

Posted by Marcel Offermans <ma...@luminis.nl>.
That only helps him if he uses the whiteboard API. If he directly talks to HttpService it probably won’t work.

Another problem is that you probably can’t do this as an atomic operation so after you’ve checked, someone else can still beat you to it.

That said I don’t have a great solution to your problem beyond keeping track of this yourself and delegating the registration of the servlets to a service you design (which can then atomically do such a check). Again, that only works if everything then goes through your service.

Greetings, Marcel

On 1 June 2016 at 22:56:01, Raymond Auge (raymond.auge@liferay.com) wrote:

The Http Whiteboard API contains a runtime introspection API which returns  
DTOs of what's registered.  

look for a service registered under interface:  

org.osgi.service.http.runtime.HttpServiceRuntime  


- Ray  

On Wed, Jun 1, 2016 at 4:24 PM, David Daniel <da...@gmail.com>  
wrote:  

> Is it possible to find out what servlets have been registered with the  
> httpservice. I am dynamically registering servlets and want to verify that  
> a servlet has not already been registered with the same path. Is there a  
> way to query the httpservice for all servlet paths that are registered,  
> should I be keeping that information elsewhere or is there a tracker of  
> some sort.  
>  
> Thanks for any help,  
> David  
>  



--  
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>  
(@rotty3000)  
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>  
(@Liferay)  
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)  

Re: Get a list of paths of registered servlets

Posted by Raymond Auge <ra...@liferay.com>.
The Http Whiteboard API contains a runtime introspection API which returns
DTOs of what's registered.

look for a service registered under interface:

org.osgi.service.http.runtime.HttpServiceRuntime


- Ray

On Wed, Jun 1, 2016 at 4:24 PM, David Daniel <da...@gmail.com>
wrote:

> Is it possible to find out what servlets have been registered with the
> httpservice.  I am dynamically registering servlets and want to verify that
> a servlet has not already been registered with the same path.  Is there a
> way to query the httpservice for all servlet paths that are registered,
> should I be keeping that information elsewhere or is there a tracker of
> some sort.
>
> Thanks for any help,
>   David
>



-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)