jbackup/src/main/java/org/jbundle/jbackup/destination/HttpDestination.java
public long addNextFile(SourceFile source)
	{
		String strPath = source.getFilePath();
		long lStreamLength = source.getStreamLength();
		
		HttpClient client = new HttpClient();

		File fileIn = source.makeInFile();

		String furl = m_strBaseURL + this.encodeURL(strPath);
		PutMethod put = new PutMethod(furl);

		try	{
			RequestEntity entity = new InputStreamRequestEntity(new FileInputStream(fileIn));
			put.setRequestEntity(entity);

			int response = client.executeMethod(put);
			
			if (response != 201)
				System.out.println("Error Response: " + response);
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (FileNotFoundException ex)	{
			ex.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return lStreamLength;
	}
public long addNextFile(SourceFile source)
	{
		String strPath = source.getFilePath();
		long lStreamLength = source.getStreamLength();
		
		HttpClient client = new HttpClient();

		File fileIn = source.makeInFile();

		String furl = m_strBaseURL + this.encodeURL(strPath);
		PutMethod put = new PutMethod(furl);

		try	{
			RequestEntity entity = new InputStreamRequestEntity(new FileInputStream(fileIn));
			put.setRequestEntity(entity);

			int response = client.executeMethod(put);
			
			if (response != 201)
				System.out.println("Error Response: " + response);
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (FileNotFoundException ex)	{
			ex.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return lStreamLength;
	}
public long addNextFile ( SourceFile source ) { String strPath = source . getFilePath ( ) ; long lStreamLength = source . getStreamLength ( ) ; HttpClient client = new HttpClient ( ) ; File fileIn = source . makeInFile ( ) ; String furl = m_strBaseURL + this . encodeURL ( strPath ) ; PutMethod put = new PutMethod ( furl ) ; try { RequestEntity entity = new InputStreamRequestEntity ( new FileInputStream ( fileIn ) ) ; put . setRequestEntity ( entity ) ; int response = client . executeMethod ( put ) ; if ( response != 201 ) System . out . println ( "Error Response: " + response ) ; } catch ( HttpException e ) { e . printStackTrace ( ) ; } catch ( FileNotFoundException ex ) { ex . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return lStreamLength ; }
/*
Add this file to the destination.
Note: Only supply the file or the stream, not both. Supply the object that is easier, given
the source. This dual option is given to allow destinations that require File objects from
(such as FTP or HTTP) Having to write the inStream to a physical file before processing it.
@param file Source file.
@param inStream Source stream.
@param strpath Full path of the source file (including the filename).
@param strFilename Filename.
@param lStreamLength Length of the stream (-1 if unknown).
/ * Add this file to the destination . Note : Only supply the file or the stream not both . Supply the object that is easier given the source . This dual option is given to allow destinations that require File objects from ( such as FTP or HTTP ) Having to write the inStream to a physical file before processing it .