org.apache.maven.wagon.providers.webdav
Class CorrectedWebdavResource

java.lang.Object
  extended byorg.apache.webdav.lib.WebdavSession
      extended byorg.apache.webdav.lib.WebdavResource
          extended byorg.apache.maven.wagon.providers.webdav.CorrectedWebdavResource

public class CorrectedWebdavResource
extends org.apache.webdav.lib.WebdavResource

Corrected Webdav Resource. This extension to the WebdavResource object corrects a Content-Length bug in the WebdavLib.

Author:
Joakim Erdfelt

Field Summary
private  java.util.Map headers
          Map of additional headers
 
Fields inherited from class org.apache.webdav.lib.WebdavResource
ALL, allowedMethods, BASIC, childResources, creationDate, CREATIONDATE, davCapabilities, DEFAULT, defaultAction, defaultDepth, defaultOwner, displayName, DISPLAYNAME, exists, FALSE, followRedirects, formats, GETCONTENTLANGUAGE, getContentLength, GETCONTENTLENGTH, getContentType, GETCONTENTTYPE, getEtag, GETETAG, getLastModified, GETLASTMODIFIED, gmtZone, httpURL, isCollection, ISCOLLECTION, isHidden, ISHIDDEN, LABEL_ADD, LABEL_REMOVE, LABEL_SET, latestStatusCode, latestStatusMessage, lockDiscovery, LOCKDISCOVERY, NAME, NOACTION, OPTIONS_VERSION_HISTORY, OPTIONS_WORKSPACE, overwrite, owner, resourceType, RESOURCETYPE, SOURCE, supportedLock, SUPPORTEDLOCK, tempDirForGet, thisResource, TRUE, useDiskForGet
 
Fields inherited from class org.apache.webdav.lib.WebdavSession
client, debug, hostCredentials, proxyCredentials, proxyHost, proxyPort
 
Constructor Summary
CorrectedWebdavResource(org.apache.commons.httpclient.HttpURL url)
           
 
Method Summary
 void addRequestHeader(java.lang.String header, java.lang.String value)
          Add a header in the request sent to the webdav server
protected  void generateAdditionalHeaders(org.apache.commons.httpclient.HttpMethod method)
          Add all additionals headers that have been previously registered with addRequestHeader to the method
 java.util.Map getHeaders()
           
 java.io.InputStream getMethodData(java.lang.String path)
          Get InputStream for the GET method for the given path.
private  boolean isHttpSuccess(int statusCode)
          Check if the http status code passed as argument is a success
 boolean putMethod(java.lang.String path, java.io.InputStream inputStream, int contentLength)
          Execute the PUT method for the given path.
 void setHeaders(java.util.Map headers)
           
 
Methods inherited from class org.apache.webdav.lib.WebdavResource
abortTransaction, aclfindMethod, aclfindMethod, aclMethod, aclReportMethod, bindMethod, bindMethod, checkinMethod, checkinMethod, checkoutMethod, checkoutMethod, close, commitTransaction, compareTo, compareToWebdavResource, copyMethod, copyMethod, createWebdavResource, deleteMethod, deleteMethod, discoverLock, discoverOwnLocks, discoverOwnLocks, endTransaction, equals, executeHttpRequestMethod, exists, generateIfHeader, generateTransactionHeader, getActiveLockOwners, getAllowedMethods, getChildResources, getCreationDate, getDavCapabilities, getDefaultAction, getDefaultDepth, getDisplayName, getExistence, getFollowRedirects, getGetContentLength, getGetContentType, getGetEtag, getGetLastModified, getGetTempDir, getGetUseDisk, getHost, getHttpURL, getHttpURLExceptForUserInfo, getIsCollection, getIsHidden, getLockDiscovery, getMethod, getMethod, getMethodData, getMethodDataAsString, getMethodDataAsString, getName, getOverwrite, getOwner, getPath, getResourceType, getStatusCode, getStatusMessage, getSupportedLock, getTransactionHandle, headMethod, headMethod, isCollection, isLocked, isTheClient, labelMethod, labelMethod, list, listBasic, listWebdavResources, lockDiscoveryPropertyFindMethod, lockDiscoveryPropertyFindMethod, lockMethod, lockMethod, lockMethod, lockMethod, lockMethod, lockMethod, lockMethod, lockMethod, mkcolMethod, mkcolMethod, mkWorkspaceMethod, mkWorkspaceMethod, moveMethod, moveMethod, optionsMethod, optionsMethod, optionsMethod, optionsMethod, optionsMethod, optionsMethod, parseDate, pollMethod, pollMethod, principalCollectionSetFindMethod, principalCollectionSetFindMethod, processProperty, propfindMethod, propfindMethod, propfindMethod, propfindMethod, propfindMethod, propfindMethod, propfindMethod, propfindMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, proppatchMethod, putMethod, putMethod, putMethod, putMethod, putMethod, putMethod, putMethod, putMethod, putMethod, putMethod, rebindMethod, rebindMethod, refresh, reportMethod, reportMethod, reportMethod, reportMethod, reportMethod, retrieveSessionInstance, setAllProp, setBasicProperties, setClient, setClient, setContentType, setCreationDate, setCreationDate, setDefaultAction, setDefaultDepth, setDefaultProperties, setDisplayName, setEncodeURLs, setExistence, setFollowRedirects, setGetContentLength, setGetContentLength, setGetContentType, setGetEtag, setGetLastModified, setGetLastModified, setGetTempDir, setGetUseDisk, setHttpURL, setHttpURL, setHttpURL, setHttpURL, setHttpURL, setHttpURL, setHttpURL, setIsCollection, setIsCollection, setIsHidden, setIsHidden, setLockDiscovery, setNamedProp, setNameProperties, setOverwrite, setPath, setProperties, setProperties, setResourceType, setStatusCode, setStatusCode, setSupportedLock, setUserInfo, setWebdavProperties, startTransaction, subscribeMethod, subscribeMethod, subscribeMethod, toString, unbindMethod, unbindMethod, uncheckoutMethod, uncheckoutMethod, unlockMethod, unlockMethod, unlockMethod, unsubscribeMethod, unsubscribeMethod, updateMethod, updateMethod, versionControlMethod, versionControlMethod
 
Methods inherited from class org.apache.webdav.lib.WebdavSession
closeSession, closeSession, getSessionInstance, getSessionInstance, setCredentials, setDebug, setProxy, setProxyCredentials
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

headers

private java.util.Map headers
Map of additional headers

Constructor Detail

CorrectedWebdavResource

public CorrectedWebdavResource(org.apache.commons.httpclient.HttpURL url)
                        throws java.io.IOException
Method Detail

setHeaders

public void setHeaders(java.util.Map headers)

getHeaders

public java.util.Map getHeaders()

generateAdditionalHeaders

protected void generateAdditionalHeaders(org.apache.commons.httpclient.HttpMethod method)
Add all additionals headers that have been previously registered with addRequestHeader to the method


getMethodData

public java.io.InputStream getMethodData(java.lang.String path)
                                  throws java.io.IOException
Get InputStream for the GET method for the given path.

Parameters:
path - the server relative path of the resource to get
Returns:
InputStream
Throws:
java.io.IOException

addRequestHeader

public void addRequestHeader(java.lang.String header,
                             java.lang.String value)
Add a header in the request sent to the webdav server

Parameters:
header - Header name
value - Value

putMethod

public boolean putMethod(java.lang.String path,
                         java.io.InputStream inputStream,
                         int contentLength)
                  throws java.io.IOException
Execute the PUT method for the given path.

Parameters:
path - the server relative path to put the data
inputStream - The input stream.
Returns:
true if the method is succeeded.
Throws:
java.io.IOException

isHttpSuccess

private boolean isHttpSuccess(int statusCode)
Check if the http status code passed as argument is a success

Parameters:
statusCode -
Returns:
true if code represents a HTTP success