Hi Senaka, I came across this strange behavior in GReg's webDAV feature, after adding a resource via (Entries -> Add Resource -> Medthod -> Create Text content) from the UI(this enables creation of resources without an extension), irrespective of the specified media-type, it's always shown as plain/text at client(even after setting the getcontenttype property), and editing them with certain editors such as vim and gedit causes the media type information is lost in the process at the server.
Why? There behavior of these editors when saving a file not only does a PUT, but also a DELETE request, similar discussion were found at [1]<http://stackoverflow.com/questions/607435/why-does-vim-save-files-with-a-extension>and [2] <http://platform.xwiki.org/xwiki/bin/view/Features/WebDAVDavFs2> . Editors such as vim allows this behavior to be changed, where as gedit does not. In situation such as this, the result at the server end is havoc, because of the DELETE request, which cause the resource to be deleted from the server end. Note: The vi editor does not issue a DELETE operation when saving, hence it's does not involve any tweaks. Possible alternatives: 1) We can set the media-type to 'text/plain' as default for resources created WITHOUT an extension, and use editors like gedit(which does not allow to change the behavior of save) to edit ONLY 'text/plain' type resources. No issue with vim, because the behavior of save can be changed. Impact: This causes some what a coupling between the mime-type and the editor(gedit). However, if the user makes changes to non 'text/plain' type files via gedit, the media-type of the file will get changed to 'text/plain', because it'll treat this file as a new file( since DELETE is performed in the request before). 2) We add the file extension to the requested resource using its media-type at the server end. Impact: The file name will get changed after the first PROPFIND request, but now since the extension of the file is available, the above problem is solved. e.g: we create a resource from UI: name --> xmlfile with Media type --> application/xml and after the webDAV request, its name changes to xmlfile.xml, media-type remains the same. 3) We ask the users to use only the editors such as vi and vim that can change the default save behavior when editing files that has no extension, and include these instruction(the ones from the associated links [1] and [2]) in the User Guide of GReg documentation. Impact: Restricts the available editors for modifying resources with no extension. WDYT? [1] http://stackoverflow.com/questions/607435/why-does-vim-save-files-with-a-extension [2] http://platform.xwiki.org/xwiki/bin/view/Features/WebDAVDavFs2 -- Thanks, Fazlan
_______________________________________________ Carbon-dev mailing list [email protected] http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
