Ok, I've figured out it DOES listen on ALL addresses no matter what hostname is, but somehow requests only succeed if they have the hostname matching with the one set by Tomcat.setHostname(...) (which is localhost by default). I'm not sure where the requests fail, but they do.
2012/7/17 Alexander Shutyaev <shuty...@gmail.com> > Hi all! > > I've embedded tomcat 7 using org.apache.catalina.startup.Tomcat class. It > seems that by default it listens on "localhost". I've noticed there is a > method org.apache.catalina.startup.Tomcat.setHostname(String) which I can > use to change this. But I can't find how I can tell tomcat to listen on ALL > addresses. I know how to do this in server.xml (just omit the address > attribute in connector), but as new embedded tomcat does not use config > file I'm not sure how to achieve this. Can anyone help me? >