You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Scott Gray <sc...@hotwaxmedia.com> on 2010/06/20 13:40:53 UTC

Re: svn commit: r948439 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java

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.

Thanks
Scott

On 27/05/2010, at 2:22 AM, doogie@apache.org 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;
> 
> 


Re: svn commit: r948439 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java

Posted by Bilgin Ibryam <bi...@gmail.com>.
We should probably restart the conversation about why it is included in
OFBiz at some point.

>
> Regards
> Scott
>
>

Good idea

Bilgin

Re: svn commit: r948439 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Thanks for clarifying, just wanted to make sure you had a reason before I spend time trying to work with the method's new behavior.

On the bright side, I'm so glad we were able to better support the enigmatic webslinger.  We should probably restart the conversation about why it is included in OFBiz at some point.

Regards
Scott

On 21/06/2010, at 3:46 AM, Adam Heath wrote:

> 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, doogie@apache.org 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;
>>> 
>>> 
>> 
> 


Re: svn commit: r948439 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java

Posted by Adam Heath <do...@brainfood.com>.
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, doogie@apache.org 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;
>>
>>
>