I think this is being addressed by RFC 189 which is under discussion. --
BJ Hargrave Senior Technical Staff Member, IBM OSGi Fellow and CTO of the OSGi Alliance [email protected] office: +1 386 848 1781 mobile: +1 386 848 3788 From: Neil Bartlett <[email protected]> To: OSGi Developer Mail List <[email protected]>, Date: 2012/12/05 13:17 Subject: [osgi-dev] Obtaining HTTP host and port from HttpService Sent by: [email protected] 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
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
