smbdav
Class Davenport

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bysmbdav.Davenport
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Davenport
extends javax.servlet.http.HttpServlet

This servlet provides a WebDAV gateway to CIFS/SMB shared resources.

You can specify jCIFS configuration settings in the servlet's initialization parameters which will be applied to the environment. Settings of particular interest to the Davenport servlet include:

ParameterDescription
jcifs.smb.client.domain Provides the default domain if not specified during HTTP Basic authentication. If the user enters "username" rather than "DOMAIN\username", this specifies the default domain against which the user should be authenticated.
jcifs.http.domainController Provides the IP address or name of the server used to authenticate clients. This is only used for browsing the root ("smb://") and workgroups (if a server cannot be found). For servers, shares, directories and files, the corresponding server is used. If not specified, the system will attempt to locate a controller for the domain specified in jcifs.smb.client.domain (if present). If neither jcifs.http.domainController nor jcifs.smb.client.domain are specified, authentication will not be required for browsing the SMB root (or workgroups for which a server cannot be found). This may pose a security risk.

It is not necessary for this to specify a real domain controller; any machine offering SMB services can be used.

jcifs.netbios.wins Specifies the IP address of a WINS server to be used in resolving server and domain/workgroup names. This is needed to locate machines in other subnets.
jcifs.http.enableBasic Enables/disables HTTP Basic authentication support. This allows non-NTLM-capable browsers to successfully authenticate. NTLM-capable clients will authenticate using NTLM. This defaults to true. Setting this to false will disable HTTP Basic authentication entirely, allowing only NTLM-capable browsers to connect.
jcifs.http.insecureBasic Enables/disables HTTP Basic authentication over an insecure channel. Normally, HTTP Basic authentication will only be available over HTTPS. Setting this to true will offer HTTP Basic authentication over insecure HTTP, sending login information over the network unencrypted. This is a severe security risk, and is strongly advised against. This defaults to false.
jcifs.http.basicRealm Specifies the HTTP Basic realm that will be presented during authentication. Defaults to "Davenport".

Further details regarding configuration of the jCIFS environment can be found in the jCIFS documentation (available from http://jcifs.samba.org).

Additionally, you can specify your own custom handlers for HTTP methods. By implementing MethodHandler, you can provide your own behavior for GET, PUT, etc. requests. To enable your handler, add an initialization parameter with the handler's classname. For example:

 <init-param>
     <param-name>handler.GET</param-name>
     <param-value>com.foo.MyGetHandler</param-value>
 </init-param>
 

This will install a com.foo.MyGetHandler instance as the handler for GET requests.

Author:
Eric Glass
See Also:
Serialized Form

Field Summary
static java.lang.String CONTEXT_BASE
          The name of the request attribute containing the context base for URL rewriting.
static java.lang.String LOCK_MANAGER
          The name of the servlet context attribute containing the LockManager which maintains WebDAV locks.
static java.lang.String PRINCIPAL
          The name of the request attribute containing the authenticated principal.
static java.lang.String REQUEST_URI_CHARSET
          The name of the servlet context attribute containing the charset used to interpret request URIs.
static java.lang.String RESOURCE_FILTER
          The name of the servlet context attribute containing the SmbFileFilter applied to resource requests.
 
Constructor Summary
Davenport()
           
 
Method Summary
 void destroy()
           
protected  MethodHandler getHandler(java.lang.String method)
          Returns the MethodHandler for the specified method.
 void init()
           
protected  void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Authenticates the user against a domain before forwarding the request to the appropriate handler.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_FILTER

public static final java.lang.String RESOURCE_FILTER
The name of the servlet context attribute containing the SmbFileFilter applied to resource requests.

See Also:
Constant Field Values

LOCK_MANAGER

public static final java.lang.String LOCK_MANAGER
The name of the servlet context attribute containing the LockManager which maintains WebDAV locks.

See Also:
Constant Field Values

REQUEST_URI_CHARSET

public static final java.lang.String REQUEST_URI_CHARSET
The name of the servlet context attribute containing the charset used to interpret request URIs.

See Also:
Constant Field Values

CONTEXT_BASE

public static final java.lang.String CONTEXT_BASE
The name of the request attribute containing the context base for URL rewriting.

See Also:
Constant Field Values

PRINCIPAL

public static final java.lang.String PRINCIPAL
The name of the request attribute containing the authenticated principal.

See Also:
Constant Field Values
Constructor Detail

Davenport

public Davenport()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

destroy

public void destroy()

service

protected void service(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws java.io.IOException,
                       javax.servlet.ServletException
Authenticates the user against a domain before forwarding the request to the appropriate handler.

Parameters:
request - The request being handled.
response - The response supplied by the servlet.
Throws:
java.io.IOException - If an IO error occurs while handling the request.
javax.servlet.ServletException - If an application error occurs.

getHandler

protected MethodHandler getHandler(java.lang.String method)
Returns the MethodHandler for the specified method.

Parameters:
method - The HTTP method (GET, POST, PUT, etc.) being handled.
Returns:
A MethodHandler capable of servicing the request using the given method.


Copyright © 2004 Eric Glass