org.apache.jackrabbit.webdav.simple
Class SimpleWebdavServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.jackrabbit.webdav.server.AbstractWebdavServlet
              extended by org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, DavConstants
Direct Known Subclasses:
SimpleWebdavServlet

public abstract class SimpleWebdavServlet
extends AbstractWebdavServlet

WebdavServlet provides WebDAV support (level 1, 2, 3 and bind compliant) for repository resources.

Implementations of this abstract class must implement the getRepository() method to access the repository.

See Also:
Serialized Form

Field Summary
static String CTX_ATTR_RESOURCE_PATH_PREFIX
          Servlet context attribute used to store the path prefix instead of having a static field with this servlet.
static String INIT_PARAM_AUTHENTICATE_HEADER
          Name of the optional init parameter that defines the value of the 'WWW-Authenticate' header.
static String INIT_PARAM_MIME_INFO
          Name of the parameter that specifies the servlet resource path of a custom <mime-info/> configuration file.
static String INIT_PARAM_MISSING_AUTH_MAPPING
          the 'missing-auth-mapping' init parameter
static String INIT_PARAM_RESOURCE_CONFIG
          Name of the init parameter that specify a separate configuration used for filtering the resources displayed.
static String INIT_PARAM_RESOURCE_PATH_PREFIX
          init param name of the repository prefix
 
Fields inherited from class org.apache.jackrabbit.webdav.server.AbstractWebdavServlet
DEFAULT_AUTHENTICATE_HEADER
 
Fields inherited from interface org.apache.jackrabbit.webdav.DavConstants
creationDateFormat, DEPTH_0, DEPTH_1, DEPTH_INFINITY, DEPTH_INFINITY_S, HEADER_AUTHORIZATION, HEADER_CONTENT_LANGUAGE, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_DAV, HEADER_DEPTH, HEADER_DESTINATION, HEADER_ETAG, HEADER_IF, HEADER_LAST_MODIFIED, HEADER_LOCK_TOKEN, HEADER_OVERWRITE, HEADER_TIMEOUT, INFINITE_TIMEOUT, modificationDateFormat, NAMESPACE, OPAQUE_LOCK_TOKEN_PREFIX, PROPERTY_CREATIONDATE, PROPERTY_DISPLAYNAME, PROPERTY_GETCONTENTLANGUAGE, PROPERTY_GETCONTENTLENGTH, PROPERTY_GETCONTENTTYPE, PROPERTY_GETETAG, PROPERTY_GETLASTMODIFIED, PROPERTY_LOCKDISCOVERY, PROPERTY_RESOURCETYPE, PROPERTY_SOURCE, PROPERTY_SUPPORTEDLOCK, PROPFIND_ALL_PROP, PROPFIND_ALL_PROP_INCLUDE, PROPFIND_BY_PROPERTY, PROPFIND_PROPERTY_NAMES, TIMEOUT_INFINITE, UNDEFINED_TIME, UNDEFINED_TIMEOUT, XML_ACTIVELOCK, XML_ALLPROP, XML_COLLECTION, XML_DEPTH, XML_DST, XML_EXCLUSIVE, XML_HREF, XML_INCLUDE, XML_KEEPALIVE, XML_LINK, XML_LOCKENTRY, XML_LOCKINFO, XML_LOCKROOT, XML_LOCKSCOPE, XML_LOCKTOKEN, XML_LOCKTYPE, XML_MULTISTATUS, XML_OMIT, XML_OWNER, XML_PROP, XML_PROPERTYBEHAVIOR, XML_PROPERTYUPDATE, XML_PROPFIND, XML_PROPNAME, XML_PROPSTAT, XML_REMOVE, XML_RESPONSE, XML_RESPONSEDESCRIPTION, XML_SET, XML_SHARED, XML_SOURCE, XML_STATUS, XML_TIMEOUT, XML_WRITE
 
Constructor Summary
SimpleWebdavServlet()
           
 
Method Summary
 String getAuthenticateHeaderValue()
          Returns the header value retrieved from the INIT_PARAM_AUTHENTICATE_HEADER init parameter.
protected  CredentialsProvider getCredentialsProvider()
          Factory method for creating the credentials provider to be used for accessing the credentials associated with a request.
 DavSessionProvider getDavSessionProvider()
          Returns the DavSessionProvider.
 DavLocatorFactory getLocatorFactory()
          Returns the DavLocatorFactory.
 LockManager getLockManager()
          Returns the LockManager.
 String getPathPrefix()
          Returns the configured path prefix
static String getPathPrefix(javax.servlet.ServletContext ctx)
          Returns the configured path prefix
abstract  Repository getRepository()
          Returns the Repository.
 ResourceConfig getResourceConfig()
          Returns the resource configuration to be applied
 DavResourceFactory getResourceFactory()
          Returns the DavResourceFactory.
 SessionProvider getSessionProvider()
          Returns the SessionProvider.
 void init()
          Init this servlet
protected  boolean isPreconditionValid(WebdavRequest request, DavResource resource)
          Checks if the precondition for this request and resource is valid.
 void setDavSessionProvider(DavSessionProvider sessionProvider)
          Sets the DavSessionProvider.
 void setLocatorFactory(DavLocatorFactory locatorFactory)
          Sets the DavLocatorFactory.
 void setLockManager(LockManager lockManager)
          Sets the LockManager.
 void setResourceConfig(ResourceConfig config)
          Set the resource configuration
 void setResourceFactory(DavResourceFactory resourceFactory)
          Sets the DavResourceFactory.
 void setSessionProvider(SessionProvider sessionProvider)
          Sets the SessionProvider.
 
Methods inherited from class org.apache.jackrabbit.webdav.server.AbstractWebdavServlet
doAcl, doBaselineControl, doBind, doCheckin, doCheckout, doCopy, doDelete, doGet, doHead, doLabel, doLock, doMerge, doMkActivity, doMkCol, doMkWorkspace, doMove, doOptions, doOrderPatch, doPoll, doPost, doPropFind, doPropPatch, doPut, doRebind, doReport, doSearch, doSubscribe, doUnbind, doUncheckout, doUnlock, doUnsubscribe, doUpdate, doVersionControl, execute, getInputContext, getOutputContext, sendUnauthorized, service, validateDestination
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, 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

INIT_PARAM_RESOURCE_PATH_PREFIX

public static final String INIT_PARAM_RESOURCE_PATH_PREFIX
init param name of the repository prefix

See Also:
Constant Field Values

INIT_PARAM_AUTHENTICATE_HEADER

public static final String INIT_PARAM_AUTHENTICATE_HEADER
Name of the optional init parameter that defines the value of the 'WWW-Authenticate' header.

If the parameter is omitted the default value "Basic Realm=Jackrabbit Webdav Server" is used.

See Also:
getAuthenticateHeaderValue(), Constant Field Values

INIT_PARAM_MISSING_AUTH_MAPPING

public static final String INIT_PARAM_MISSING_AUTH_MAPPING
the 'missing-auth-mapping' init parameter

See Also:
Constant Field Values

INIT_PARAM_RESOURCE_CONFIG

public static final String INIT_PARAM_RESOURCE_CONFIG
Name of the init parameter that specify a separate configuration used for filtering the resources displayed.

See Also:
Constant Field Values

INIT_PARAM_MIME_INFO

public static final String INIT_PARAM_MIME_INFO
Name of the parameter that specifies the servlet resource path of a custom <mime-info/> configuration file. The default setting is to use the MIME media type database included in Apache Tika.

See Also:
Constant Field Values

CTX_ATTR_RESOURCE_PATH_PREFIX

public static final String CTX_ATTR_RESOURCE_PATH_PREFIX
Servlet context attribute used to store the path prefix instead of having a static field with this servlet. The latter causes problems when running multiple

See Also:
Constant Field Values
Constructor Detail

SimpleWebdavServlet

public SimpleWebdavServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Init this servlet

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

isPreconditionValid

protected boolean isPreconditionValid(WebdavRequest request,
                                      DavResource resource)
Checks if the precondition for this request and resource is valid.

Specified by:
isPreconditionValid in class AbstractWebdavServlet
Returns:

getPathPrefix

public String getPathPrefix()
Returns the configured path prefix

Returns:
resourcePathPrefix
See Also:
INIT_PARAM_RESOURCE_PATH_PREFIX

getPathPrefix

public static String getPathPrefix(javax.servlet.ServletContext ctx)
Returns the configured path prefix

Parameters:
ctx - The servlet context.
Returns:
resourcePathPrefix
See Also:
INIT_PARAM_RESOURCE_PATH_PREFIX

getLocatorFactory

public DavLocatorFactory getLocatorFactory()
Returns the DavLocatorFactory. If no locator factory has been set or created a new instance of LocatorFactoryImpl is returned.

Specified by:
getLocatorFactory in class AbstractWebdavServlet
Returns:
the locator factory
See Also:
AbstractWebdavServlet.getLocatorFactory()

setLocatorFactory

public void setLocatorFactory(DavLocatorFactory locatorFactory)
Sets the DavLocatorFactory.

Specified by:
setLocatorFactory in class AbstractWebdavServlet
Parameters:
locatorFactory - The DavLocatorFactory to use.
See Also:
AbstractWebdavServlet.setLocatorFactory(DavLocatorFactory)

getLockManager

public LockManager getLockManager()
Returns the LockManager. If no lock manager has been set or created a new instance of SimpleLockManager is returned.

Returns:
the lock manager

setLockManager

public void setLockManager(LockManager lockManager)
Sets the LockManager.

Parameters:
lockManager - The LockManager to be used.

getResourceFactory

public DavResourceFactory getResourceFactory()
Returns the DavResourceFactory. If no request factory has been set or created a new instance of ResourceFactoryImpl is returned.

Specified by:
getResourceFactory in class AbstractWebdavServlet
Returns:
the resource factory
See Also:
AbstractWebdavServlet.getResourceFactory()

setResourceFactory

public void setResourceFactory(DavResourceFactory resourceFactory)
Sets the DavResourceFactory.

Specified by:
setResourceFactory in class AbstractWebdavServlet
Parameters:
resourceFactory - The DavResourceFactory to use.
See Also:
AbstractWebdavServlet.setResourceFactory(org.apache.jackrabbit.webdav.DavResourceFactory)

getSessionProvider

public SessionProvider getSessionProvider()
Returns the SessionProvider. If no session provider has been set or created a new instance of SessionProviderImpl that extracts credentials from the Authorization request header is returned.

Returns:
the session provider

getCredentialsProvider

protected CredentialsProvider getCredentialsProvider()
Factory method for creating the credentials provider to be used for accessing the credentials associated with a request. The default implementation returns a BasicCredentialsProvider instance, but subclasses can override this method to add support for other types of credentials.

Returns:
the credentials provider
Since:
1.3

setSessionProvider

public void setSessionProvider(SessionProvider sessionProvider)
Sets the SessionProvider.

Parameters:
sessionProvider - The SessionProvider to use.

getDavSessionProvider

public DavSessionProvider getDavSessionProvider()
Returns the DavSessionProvider. If no session provider has been set or created a new instance of DavSessionProviderImpl is returned.

Specified by:
getDavSessionProvider in class AbstractWebdavServlet
Returns:
the session provider
See Also:
AbstractWebdavServlet.getDavSessionProvider()

setDavSessionProvider

public void setDavSessionProvider(DavSessionProvider sessionProvider)
Sets the DavSessionProvider.

Specified by:
setDavSessionProvider in class AbstractWebdavServlet
Parameters:
sessionProvider - The DavSessionProvider to use.
See Also:
AbstractWebdavServlet.setDavSessionProvider(org.apache.jackrabbit.webdav.DavSessionProvider)

getAuthenticateHeaderValue

public String getAuthenticateHeaderValue()
Returns the header value retrieved from the INIT_PARAM_AUTHENTICATE_HEADER init parameter. If the parameter is missing, the value defaults to AbstractWebdavServlet.DEFAULT_AUTHENTICATE_HEADER.

Specified by:
getAuthenticateHeaderValue in class AbstractWebdavServlet
Returns:
the header value retrieved from the corresponding init parameter or AbstractWebdavServlet.DEFAULT_AUTHENTICATE_HEADER.
See Also:
AbstractWebdavServlet.getAuthenticateHeaderValue()

getResourceConfig

public ResourceConfig getResourceConfig()
Returns the resource configuration to be applied

Returns:
the resource configuration.

setResourceConfig

public void setResourceConfig(ResourceConfig config)
Set the resource configuration

Parameters:
config - The resource configuration.

getRepository

public abstract Repository getRepository()
Returns the Repository. If no repository has been set or created the repository initialized by RepositoryAccessServlet is returned.

Returns:
repository


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.