Hi all,

I'd like to discuss a requirement relating to the HttpService, which I
haven't been able to satisfactorily solve with the present specification.
Perhaps I am missing something that is already possible, otherwise I hope
the following considered for the updated RFC.

Essentially I want to know the host and port on which the HTTP service is
listening. The challenge is that I need this information *prior* to any
HTTP request being received; ideally at the time that I register my
servlet. My motivation is to work out the full URL of my servlet and
advertise its existence, e.g. using the discovery aspect of OSGi Remote
Services.

The Felix implementation publishes HttpService with a service property of
"org.osgi.service.http.port", which is helpful but non-standard, and other
implementations don't follow the same practice. Also it doesn't provide a
full answer because the host address is not published... although I can
guess at the localhost address using standard Java calls, that may be wrong
on a server with multiple IP interfaces.

The HttpService according to the spec invokes each servlet's init() method
with a ServletConfig object, which contains a ServletContext... but as far
as I can tell the host and port are not available from these APIs, even in
the latest Servlet spec. Or have I missed something here?

Any suggestions or comments appreciated.

Regards,
Neil
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to