Class DefaultGetHandler

  extended bysmbdav.AbstractHandler
      extended bysmbdav.DefaultGetHandler
All Implemented Interfaces:

public class DefaultGetHandler
extends AbstractHandler

Default implementation of a handler for requests using the HTTP GET method.

In addition to providing standard GET functionality for resources, this implementation provides directory listings for collections. An XSL stylesheet can be specified to customize the appearance of the listing. The default stylesheet location is provided in the Davenport servlet's deployment descriptor as the "directory.xsl" initialization parameter, i.e.:


The stylesheet location is resolved as follows:

If not specified, this is set to "/META-INF/directory.xsl", which will load a default stylesheet from the Davenport jarfile.

Users can also configure their own directory stylesheets. The configuration page can be accessed by pointing your web browser at any Davenport collection resource and passing "configure" as a URL parameter:


The configuration page can be specified in the deployment descriptor via the "directory.configuration" initialization parameter, i.e.:


The configuration page's location is resolved in the same manner as the default stylesheet described above.

If not specified, this is set to "/META-INF/configuration.html", which will load and cache a default configuration page from the Davenport jarfile.

Both the stylesheet and configuration page will attempt to load a resource appropriate to the locale; the loading order is similar to that used by resource bundles, i.e.:


The client's locale will be tried first, followed by the server's locale.

Eric Glass

Field Summary
Fields inherited from interface smbdav.MethodHandler
Constructor Summary
Method Summary
 void destroy()
          Called by the Davenport servlet to indicate that the handler is being taken out of service.
protected  PropertiesBuilder getPropertiesBuilder()
          Returns the PropertiesBuilder that will be used to build the PROPFIND result XML document for directory listings.
 void init(javax.servlet.ServletConfig config)
          Initializes the method handler.
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, jcifs.smb.NtlmPasswordAuthentication auth)
          Services requests which use the HTTP GET method.
Methods inherited from class smbdav.AbstractHandler
checkConditionalRequest, checkLockOwnership, createSmbFile, getFilter, getLockManager, getPrincipal, getRequestURICharset, getRequestURL, getServletConfig, getSmbFile, getSmbURL, getSmbURL, rewriteURL
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DefaultGetHandler()
Method Detail


public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Description copied from class: AbstractHandler
Initializes the method handler. This implementation stores the provided ServletConfig object and makes it available via the getServletConfig method. Subclasses overriding this method should start by invoking


Specified by:
init in interface MethodHandler
init in class AbstractHandler
config - a ServletConfig object containing the servlet's configuration and initialization parameters.
javax.servlet.ServletException - If an error occurs during initialization.


public void destroy()
Description copied from interface: MethodHandler
Called by the Davenport servlet to indicate that the handler is being taken out of service. Semantics are identical to the Servlet destroy method. This method gives the handler an opportunity to clean up any resources that are being held. After this method has been called, the service method will not be invoked again.

Specified by:
destroy in interface MethodHandler
destroy in class AbstractHandler


public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response,
                    jcifs.smb.NtlmPasswordAuthentication auth)
             throws javax.servlet.ServletException,
Services requests which use the HTTP GET method. This implementation retrieves the content for non-collection resources, using the content type information mapped in SmbDAVUtilities. For collection resources, the collection listing is retrieved as from a PROPFIND request with a depth of 1 (the collection and its immediate contents). The directory listing stylesheet is applied to the resultant XML document.
If the specified file does not exist, a 404 (Not Found) error is sent to the client.

Specified by:
service in interface MethodHandler
Specified by:
service in class AbstractHandler
request - The request being serviced.
response - The servlet response.
auth - The user's authentication information.
javax.servlet.ServletException - If an application error occurs. - If an IO error occurs while handling the request.


protected PropertiesBuilder getPropertiesBuilder()
Returns the PropertiesBuilder that will be used to build the PROPFIND result XML document for directory listings.

The PropertiesBuilder used to build the XML document.

Copyright © 2004 Eric Glass