You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Ja...@sybase.com on 2001/05/10 02:59:52 UTC

SOAP DefaultConfigManager and ServerHTTPUtils

SOAP Developers,

As I'm sure you are all well aware, when SOAP is initially installed on an
application server, it needs to create a DeployedServices.ds file.  To do
this, the DefaultConfigManager.java defaults the fileName to
"DeployedServices.ds".  DefaultConfigManager invokes
getFileFromNameAndContext() method located in ServerHTTPUtils.java.  The
problem I've encountered (and I've verified in the 5/9/01 nightly build
this situation still exists) is that there is no exception handling when
context.getRealPath() is invoked:


  public static File getFileFromNameAndContext(String fileName,
                                               ServletContext context) {
    File file = new File(fileName);

    return (file.isAbsolute()
            ? file
            : new File(context.getRealPath(fileName)));
  }


According to the J2EE specs, ServletContext.getRealPath() may return a null
if the servlet container cannot translate the virtual path to a real path,
for any reason.  Yet, there is no exception handling for this case in the
source code, and when I try to Deploy my first service, I receive an
exception from the Servlet container because the File returned was null,
and DefaultConfigManager tried to use that null File object, assuming it
would be valid.

I've spoken with peers of mine at Sun in the J2EE group, and they have
confirmed that resources within a web app should be referenced with a
proceeding / (this point was vague in the Servlet 2.2 spec).  In other
words, it is my position that the fileName variable should be declared

fileName = "/DeployedServices.ds"

instead of

fileName = "DeployedServices.ds"

In addition, an extra null check would be nice in the
getFileFromNameAndContext() method, in the event the Servlet container
returned a null, something within its perogative.

As soon as I recompile the source code with the added "/", my SOAP service can  be deploying successfully.

Can someone please address this issue, and incorporate the "/" into the baseline, and possibly a null check?

Many thanks,

Jason Weiss
eBusiness Division Engineering
Sybase, Inc.