Title: WebLogic 5.1 SP8 & DatabaseServlet.pathname() behavior

My experience with WLS 5.1 SP8 is that WLS chooses to return null from getServletContext().getRealPath("/"), which according to the J2EE API documentation, it is entitled to do:

"The real path returned will be in a form appropriate to the computer and operating system on which the servlet container is running, including the proper path separators. This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive)."

I see in (org.apache.struts.example.)DatabaseServlet.java that its private pathname() method makes such a call. That is, it seems (based on my WLS experience) that the pathname() implementation:

    /**
     * Return the pathname of our persistent storage file.
     */
    private String pathname() {

        if (this.pathname != null)
            return (this.pathname);
        else
            return (getServletContext().getRealPath("/") +
                    "/WEB-INF/database.xml");
    }

will likely return "/WEB-INF/database.xml. How is this acceptable when the root name of the web (e.g. struts-example) is missing from the URI? Can WLS be configured to allow this URI to work? Is there an issue here in the Struts example that needs to be fixed for app servers that behave like WLS 5.1?

Thanks in advance for any help on this.

-Craig

Reply via email to