com.ithit.webdav.server
Class Engine

java.lang.Object
  extended by com.ithit.webdav.server.Engine

public abstract class Engine
extends java.lang.Object

Serves as the abstract base class for WebDAV engine.


Constructor Summary
Engine()
           
 
Method Summary
 boolean getAutoPutUnderVersionControl()
          Determines if placing file under version control is automatic.
 boolean getCalculateContentLength()
          Indicates if response content length calculation will occur.
static java.util.List<java.lang.String> getClientLockTokens(javax.servlet.http.HttpServletRequest request)
          Gets the array of lock tokens submitted by client.
abstract  HierarchyItem getHierarchyItem(java.lang.String contextPath)
          Implementation of this abstract method is used by WebDAV engine to find hierarchy item objects by path.
abstract  java.lang.String getLicense()
          Returns license string.
abstract  Logger getLogger()
          Returns logger that will be used by engine.
 MethodHandler registerMethodHandler(java.lang.String method, MethodHandler handler)
          Registers custom method handler.
 void service(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
          Handles request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Engine

public Engine()
Method Detail

getHierarchyItem

public abstract HierarchyItem getHierarchyItem(java.lang.String contextPath)
                                        throws ServerException
Implementation of this abstract method is used by WebDAV engine to find hierarchy item objects by path.

When you inherit from the Engine class, you must override this abstract method. For WebDAV Class 1 or Class 2 server in this method implementation you will search for file or folder in your storage by path provided and return it to WebDAV engine. For DeltaV server in addition to folder and file you will return version and history items.

Parameters:
contextPath - Path of the hierarchy item object. It is always the full path from the root of the WebDAV repository.
Returns:
Hierarchy item object referenced by the specified path or null if hierarchy item not found.
Throws:
ServerException - Something unexpected occurred.

getLogger

public abstract Logger getLogger()
Returns logger that will be used by engine.

Returns:
Instance of Logger.

getLicense

public abstract java.lang.String getLicense()
Returns license string.

Returns:
license string.

registerMethodHandler

public MethodHandler registerMethodHandler(java.lang.String method,
                                           MethodHandler handler)
Registers custom method handler.

Using this method you can register custom method handler to be caller by the engine. If the handler for the specified method was already defined it is returned from this method. The original handler can be saved and called later from your custom handler.

Parameters:
method - HTTP verb.
handler - Custom handled implementing MethodHandler interface.
Returns:
Original handler if any.

getClientLockTokens

public static java.util.List<java.lang.String> getClientLockTokens(javax.servlet.http.HttpServletRequest request)
Gets the array of lock tokens submitted by client.

Gets array of lock tokens submitted by client. You must generate the lock tokens during the call to your Lock.lock(boolean, boolean, long, java.lang.String) method implementation. During this call you associate generated token with an item in the repository and return it to the Engine. Engine than sends the new token to the WebDAV client. When WebDAV client is modifying any server item it sends back to server the list of lock tokens. In your WebDAV server Class 2 implementation before modifying any locked items you must check if WebDAV client provided necessary lock token.

Parameters:
request - Instance of HttpServletRequest
Returns:
list of lock tokens submitted by client.

getAutoPutUnderVersionControl

public boolean getAutoPutUnderVersionControl()
Determines if placing file under version control is automatic.

Determines whether files will be placed under version control automatically or explicit request from client shall be made to put a file under version control.

If this property is true prior any item content or properties update VersionableItem.putUnderVersionControl(boolean) will be called.

Returns:
Boolean value indicating if items must be put under version control before content or properties update. Default is true

getCalculateContentLength

public boolean getCalculateContentLength()
Indicates if response content length calculation will occur.

If this method returns true engine will calculate output content length and set ServletResponse.setContentLength(int) property before returning from service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method. If you would like to send chunked responses you must set this property to false.

Returns:
Boolean value indicating if content length will be calculated in service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method. Default is true.

service

public void service(javax.servlet.http.HttpServletRequest servletRequest,
                    javax.servlet.http.HttpServletResponse servletResponse)
             throws DavException,
                    java.io.IOException
Handles request.

Parameters:
servletRequest - request.
servletResponse - response.
Throws:
DavException - If an error occurrs in user or engine implementation.
java.io.IOException - If i/o exception occurs.


Copyright © 2009 ITHit. All Rights Reserved.