> From: Pierre de Soyres [mailto:[EMAIL PROTECTED] > > with a HttpServletRequest, i can retrieve the Host name with : > request.getServerName(); > > does anyone know if it is possible to retrieve such information within the > Maverick Dispacher's init(ServletConfig) method ?
No, that doesn't actually make sense. The request.getServerName() method returns the actual server name encoded in the request (for HTTP 1.1 requests; HTTP 1.0 requests don't include that information). This is the value used for virtual hosting. Compare the results of viewing this URL with a HTTP1.1 browser: http://mysun-mail.sun.com/servlet/SnoopServlet with the results of a HTTP1.0 browser: telnet mysun-mail.sun.com 80 Trying 192.18.129.22... Connected to mysun-mail.sun.com. Escape character is '^]'. GET /servlet/SnoopServlet HTTP/1.0 ... Since getServerName() is specific to a particular request, it doesn't make any sense in the context of Servlet.init(). If you're looking for the native hostname of the machine, use the standard java mechanism. I'm not quite sure what that is offhand, but try this: InetAddress.getLocalHost().getHostName(); Jeff Schnitzer [EMAIL PROTECTED] ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf [INVALID FOOTER]
