You should use something like

        ServletContext ct = config.getServletContext();

        URL url=ct.getResource("/WEB-INF/foo/bar/bletch")

This avoid hard coding in a path in to your servlet, which avoids all sorts of
.. problems.

D.


>Received-Date: Tue, 19 Mar 2002 16:16:36 GMT
>X-Complaints-To: [EMAIL PROTECTED]
>Delivered-To: [EMAIL PROTECTED]
>MIME-Version: 1.0
>Date: Tue, 19 Mar 2002 15:35:33 -0000
>From: "Varley, Roger" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>
>Hi
>
>I'm using Tomcat 3.2 and IIS on Windows NT. I have a servlet that is
>accessed by the url wwwroot/Application/servlet/ServletName and is
>physically located at e:\tomcat\Application\WEB-INF\classes\ServletName.
>Within the servlet I want to open a URLConnection and I want to build the
>URL object specifying a relative path to wwwroot/cgibin/program_name. I
>can't work out how the Tomcat path fits into the web hierachy so I get the
>right number of "/../../'s" into my path. How do I specify the path?
>
>url = new URL("../../cgibin/programe_name") doesn't appear to work.
>
>Regards
>Roger
>
>************************************************************************
>Information in this message is confidential and may be privileged.  It is
>for the exclusive use of the intended recipient(s).  If you are not the
>intended recipient(s) please notify the sender and delete the message
>immediately.  Unauthorised disclosure, distribution and copying of this
>email is strictly prohibited.  The opinions expressed within this message
>are those of the individual author.  Whilst Brake Bros takes reasonable
>steps to scan this email it does not accept liability for any virus that may
>be contained in it.
>Bros Foodservice Limited, Enterprise House, Eureka Business Park, Ashford,
>Kent TN25 4AG.
>Registered in England and Wales number 706764.
>Telephone 01233 206000 Fax 01233 206006.
>
>___________________________________________________________________________
>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
>

--                      email           [EMAIL PROTECTED]
--                      web             www.pinan.co.uk
--The opinions expressed in this article are personal and do not
--represent the views of Pinan Software.

___________________________________________________________________________
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