Scott Gray wrote:
> Hi Adam,
> 
> This is what the method returns now instead of the absolute file path:
> jndi:/0.0.0.0/googlecheckout/WEB-INF/controller.xml
> 
> Was that your intention?  I can work with it if I have to, but life was a bit 
> easier before this change.

Yes, that was my intention.  context.getRealPath() can return null.
The resources managed by a servlet container don't have to be real
files.  Even if they are, the container can choose not to return the
real path.

Even when a file can be found for a context path, you can't make any
guarantees about paths that seem relative inside the context.
Different paths could end up being completely unrelated paths on disk,
or may even be completely virtual.

webslinger is a servlet container.  Similar to jetty or catalina or
glashfish.  What sets webslinger apart is that it is deployed *inside*
some other existing container.  It then remaps all path/resource
access thru commons-vfs.  commons-vfs is a virtual file system.  Files
can be on a remote server(smb, http), virtually mounted, or redirected
all over the place.

Since the api below was returning a url, that means that it should not
be assuming anything about the contents of the url.  No relative
directory lookups, no converting it to a file to do input processing.
 Any code should be doing url calls on the returned value.

This change was necessary to run the ControlServlet underneath webslinger.

Plus, before this change, ofbiz wasn't following the servlet spec.

> 
> Thanks
> Scott
> 
> On 27/05/2010, at 2:22 AM, [email protected] wrote:
> 
>> Author: doogie
>> Date: Wed May 26 14:22:14 2010
>> New Revision: 948439
>>
>> URL: http://svn.apache.org/viewvc?rev=948439&view=rev
>> Log:
>> There is no reason to convert the controller xml url to a file first.
>>
>> Modified:
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
>>
>> Modified: 
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=948439&r1=948438&r2=948439&view=diff
>> ==============================================================================
>> --- 
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
>>  (original)
>> +++ 
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
>>  Wed May 26 14:22:14 2010
>> @@ -57,7 +57,7 @@ public class ConfigXMLReader {
>>
>>     public static URL getControllerConfigURL(ServletContext context) {
>>         try {
>> -            return new 
>> File(context.getRealPath(controllerXmlFileName)).toURI().toURL();
>> +            return context.getResource(controllerXmlFileName);
>>         } catch (MalformedURLException e) {
>>             Debug.logError(e, "Error Finding XML Config File: " + 
>> controllerXmlFileName, module);
>>             return null;
>>
>>
> 

Reply via email to