com.smartwerkz.jupload.classic.net.http
Class HttpUploader

java.lang.Object
  extended by com.smartwerkz.jupload.classic.net.http.HttpUploader
All Implemented Interfaces:
FileUploader, ThumbnailUploader, Uploader

public class HttpUploader
extends java.lang.Object
implements ThumbnailUploader, FileUploader

An UploadClient which uses HTTP protocol. A new HttpUploader will automatically created by the UploadManager for any http(s) and (web)dav - URLs.

Since:
Jan 21, 2006, 7:26:33 PM
Author:
Dominik Seifert

Constructor Summary
HttpUploader()
           
 
Method Summary
 void addAuthentication(UploadManager manager)
          User login is required and information needs to be provided using the given provider.
 void close()
          Is implemented to dispose all resources that have been acquired for an Upload.
After calling this method, the Uploader.closed() method should return true until resources are allocated that require another call of the close method.
 boolean closed()
          Returns wether the close method already has been called.
protected  boolean createPostMethod(boolean thumbnails)
           
protected  boolean createPutMethod(boolean thumbs)
           
 java.lang.Class getAuthInfoClass()
           
protected  org.apache.commons.httpclient.HttpClient getClient(boolean thumbs)
           
 void init(UploadClient uploadClient)
          Is called right after creation to initialize this Uploader.
static boolean isWebdav(java.net.URL url)
           
 boolean performFileUpload(NOKMap params)
          Tries to upload the files of the current queue, using this Uploader's protocol.
 boolean performThumbnailUpload(NOKMap params)
          Tries to upload the thumbnails of the current queue, using this Uploader's protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpUploader

public HttpUploader()
Method Detail

init

public void init(UploadClient uploadClient)
Description copied from interface: Uploader
Is called right after creation to initialize this Uploader.

Specified by:
init in interface Uploader

performFileUpload

public boolean performFileUpload(NOKMap params)
                          throws java.lang.Exception
Description copied from interface: FileUploader
Tries to upload the files of the current queue, using this Uploader's protocol. Every UploadClient implementation must ensure that this method only returns in case that the Upload was successfull else it must throw an Exception.
This method should upload all files or thumbnails that are currently enqueued unless it fails to do so at some point in which case it should throw an Exception.

Specified by:
performFileUpload in interface FileUploader
Throws:
java.lang.Exception - If the upload failed.

performThumbnailUpload

public boolean performThumbnailUpload(NOKMap params)
                               throws java.lang.Exception
Description copied from interface: ThumbnailUploader
Tries to upload the thumbnails of the current queue, using this Uploader's protocol. Every UploadClient implementation must ensure that this method only returns in case that the Upload was successfull else it must throw an Exception.
This method should upload all files or thumbnails that are currently enqueued unless it fails to do so at some point in which case it should throw an Exception.

Specified by:
performThumbnailUpload in interface ThumbnailUploader
Throws:
java.lang.Exception - If the upload failed.

isWebdav

public static boolean isWebdav(java.net.URL url)

createPutMethod

protected boolean createPutMethod(boolean thumbs)
                           throws java.lang.Exception
Throws:
java.lang.Exception

createPostMethod

protected boolean createPostMethod(boolean thumbnails)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getClient

protected org.apache.commons.httpclient.HttpClient getClient(boolean thumbs)

close

public void close()
Description copied from interface: Uploader
Is implemented to dispose all resources that have been acquired for an Upload.
After calling this method, the Uploader.closed() method should return true until resources are allocated that require another call of the close method.

Specified by:
close in interface Uploader

closed

public boolean closed()
Description copied from interface: Uploader
Returns wether the close method already has been called. If the upload method returns and the uploadClient has not been closed, the UploadClient's close method will be called automatically.

Calling this method can only ensure to return true after close() has returned. Therefore it is only save to call this when synchronizing against the UploadClient's closeLock. Correspondingly it is recommended to call the UploadClient.cancel() method instead of this to check if this upload has been closed or not.

Specified by:
closed in interface Uploader

addAuthentication

public void addAuthentication(UploadManager manager)
Description copied from interface: Uploader
User login is required and information needs to be provided using the given provider.

Specified by:
addAuthentication in interface Uploader

getAuthInfoClass

public java.lang.Class getAuthInfoClass()
Specified by:
getAuthInfoClass in interface Uploader
Returns:
The class of the needed authentication information


Copyright © 2007 smartwerkz.com. All Rights Reserved.