pascal jacob wrote:

>     There is no problem to obtain the host and port # while in the doPost()
> or doGet() method - I just use request.getServerName() and
> Request.getServerPort().
>     My problem is that I need these infos while in the init() method, before
> any doGet() or doPost() is called.
>     Any idea of how to have the host name and port # while still in the
> init() method??
>
> ZartC++
>

There is no portable way (that is, available in the servlet API) for you to find
out the server host and port in the init() method.  As you are aware, they are
available in each request that comes in.

Perhaps you could arrange your code to recognize the first request being
processed (perhaps by a boolean instance variable in the servlet class), and
initialize whatever it is that depends on this at that time, rather than in the
init() method.

Craig McClanahan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to