WEBDAV in GlassFish
Thursday Aug 14, 2008
WEBDAV (RFC 4918) protocol is a predecessor to HTTP/1.1 for management resources, etc. The WEBDAV code in GlassFish workspace is based on Tomcat. Jean-Francois blogged about this in 2006. WEBDAV Level 2 will be a supported feature in GlassFish v3. In this blog, we would provide additonal information about WEBDAV in GlassFish v3.
Configuration of WebDAVServlet
WEBDAV can be enabled by specifying the
org.apache.catalina.servlets.WebdavServlet in web.xml
for a given web application.
Also, it can be enabled and configured globally in
default-web.xml.
One can configure WebDAVServlet by specifying the init-param as follows:
| init-param | Type | Description | Default |
|---|---|---|---|
| debug | int | debug level | 0 (no debug) |
| listings | boolean | whether one can list resources | false |
| readonly | boolean | whether resources are readonly | true |
It is important to note that
when listings is set to true
or readonly is set to false, one must
set up security constraints and turn on security manager.
WEBDAV Clients
I have verified that the following WEBDAV clients work with GlassFish v3:- Microsoft Word 2002 and 2003
File > Open > the url - Internet Explorer 6 and 7
File > Open (check "Open as Web Folder") > the url
Note that under "Internet Options > Programs > HTML editor", we may like to set it to Microsoft Word above or Mircrosoft FrontPage.
Hand-On Examples on WEBDAV protocol
WEBDAV includes the following HTTP methods:- PROPFIND
- PROPMATCH
- MKCOL
- GET
- HEAD
- POST
- DELETE
- PUT
- COPY
- MOVE
- LOCK
- UNLOCK
- the following HTTP request copy index.html to index2.html:
COPY /webdavtest/index.html HTTP/1.1 Host: localhost Destination: http://localhost:8080/webdavtest/index2.html Connection: close
- the following HTTP request delete the index2.html created above:
DELETE /webdavtest/index2.html HTTP/1.1 Host: localhost Connection: close
#!/usr/bin/ruby
require "socket"
if ARGV.length != 3
puts "ruby httpclient.rb <host> <port> <http request file>\n"
exit
end
host = ARGV[0];
port = ARGV[1].to_i;
filename = ARGV[2];
socket = TCPSocket.open(host, port)
file = File.new(filename)
while line = file.gets
command = line.chomp
puts command + "\r\n"
socket.write(command + "\r\n")
end
puts socket.readlines
socket.close
Note that you may like to update the path of ruby or run the interpretator directly.











Posted by ias' me2DAY on August 15, 2008 at 12:14 PM PDT #