org.w3c.jwput
Class JWPut

java.lang.Object
  |
  +--org.w3c.jwput.JW
        |
        +--org.w3c.jwput.JWPut
All Implemented Interfaces:
JWOptions, org.w3c.www.protocol.http.RequestObserver

public class JWPut
extends JW

Put files on the web


Fields inherited from class org.w3c.jwput.JW
aborted, BANNER, DEFAULT_MIME, done, etagsDB, in, jwprops, listeners, manager, password, ppassword, prompt, puser, quiet, request, ui, uriInfos, user, USER_AGENT, verbose, VERSION, WINIE_DOC_URL, WINIE_LATEST_ZIP, WINIE_URL
 
Fields inherited from interface org.w3c.jwput.JWOptions
ACCEPT_LANGUAGE_P, BACKUP_P, DEF_TRIES, ETAGS_DB, FALSE_P, HEADER_PREFIX, HIDE_POPUPS_P, HOMEDIR_P, LOAD_DIR_P, MIME_PREFIX, MIMEDEF_P, OVERWRITE_P, PASSWORD_P, PROGRESS_BAR_P, PROMPT_P, PROXY_HOST_P, PROXY_PORT_P, PROXY_SET_P, PUT_CVS_P, QUIET_P, REC_P, SAVE_DIR_P, SOCKS_HOST_P, SOCKS_PORT_P, TRIES_P, TRUE_P, USER_AGENT_P, USER_P, VERBOSE_P, WPUTDIR, WPUTRC
 
Constructor Summary
JWPut(JWUI ui)
          Constructor
JWPut(JWUI ui, java.util.Properties props)
          Constructor
JWPut(JWUI ui, java.util.Properties props, boolean loadpref)
          Constructor
JWPut(java.lang.String mime, JWUI ui, java.util.Properties userprops)
          Constructor.
JWPut(java.lang.String mime, JWUI ui, java.util.Properties userprops, boolean loadpref)
          Constructor.
JWPut(java.lang.String mime, java.util.Properties userprops)
          Constructor.
 
Method Summary
 void abort()
           
static void badArgs(java.lang.String msg)
          Display the message for bad command line error.
 org.w3c.www.protocol.http.Request createRequest()
          Create a HTTP/1.1 request
 void delete(java.lang.String url)
          Perform a DELETE
 java.lang.String getMimeType(java.lang.String name)
          Guess a mime type for the given file.
 java.lang.String getMimeType(java.lang.String name, boolean prompt)
          Guess a mime type for the given file.
protected  void initialize(java.util.Properties props)
           
static void main(java.lang.String[] args)
          Main.
 void perform(java.lang.String file, java.lang.String url)
          Perform the put(s)
 org.w3c.www.protocol.http.Reply put(java.io.File toput, java.lang.String puturl, java.lang.String etag)
          Perform a HTTP/1.1 PUT
 org.w3c.www.protocol.http.Reply put(java.io.File toput, java.lang.String puturl, java.lang.String etag, java.util.Hashtable headers)
          Perform a HTTP/1.1 PUT
protected  void putAbortableDir(java.io.File dir, java.lang.String durl, java.util.Hashtable headers, boolean rec)
          Put (recursively) the files to the location URL.
 void putDir(java.io.File dir, java.lang.String durl)
          Put (recursively) the files to the location URL.
 void putDir(java.io.File dir, java.lang.String durl, java.util.Hashtable headers, boolean rec)
          Put (recursively) the files to the location URL.
 void putFile(java.io.File toput, java.lang.String furl)
          Put the givent file at the given location URL
 void putFile(java.io.File toput, java.lang.String desturl, java.util.Hashtable headers)
          Put the givent file at the given location URL
 java.util.Properties registerMimeTypeForFile(java.lang.String file, java.lang.String mime)
           
 void updateProperties(java.util.Properties props)
          Update the user properties
static void usage()
          Display the "Usage" message.
 
Methods inherited from class org.w3c.jwput.JW
addJWListener, check, createRequest, displayErrorMessage, displayErrorMessage, displayMessage, fireDownloadEvent, fireUploadEvent, getETag, getETagsDatabase, getFileName, getManager, getPathConfig, getPort, getPreferences, getPreferencesFile, getProperties, getUserProperties, isAborted, isAbortedOrDone, isDone, notifyProgress, performRequest, performRequest, performRequest, performRequest, removeEtag, removeJWListener, saveEtag, savePreferences, setAborted, setDone, skipBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JWPut

public JWPut(JWUI ui)
Constructor
Parameters:
ui - the User Interface

JWPut

public JWPut(JWUI ui,
             java.util.Properties props)
Constructor
Parameters:
ui - the User Interface
props - the User properties

JWPut

public JWPut(JWUI ui,
             java.util.Properties props,
             boolean loadpref)
Constructor
Parameters:
ui - the User Interface
props - the User properties
loadpref - do we need to load preferences from disk?

JWPut

public JWPut(java.lang.String mime,
             java.util.Properties userprops)
Constructor.
Parameters:
file - The file (or directory) to put
mime - The mime type
url - The destination URL
ui - The User Interface
userprops - User properties

JWPut

public JWPut(java.lang.String mime,
             JWUI ui,
             java.util.Properties userprops)
Constructor.
Parameters:
file - The file (or directory) to put
mime - The mime type
url - The destination URL
userprops - User properties

JWPut

public JWPut(java.lang.String mime,
             JWUI ui,
             java.util.Properties userprops,
             boolean loadpref)
Constructor.
Parameters:
file - The file (or directory) to put
mime - The mime type
url - The destination URL
userprops - User properties
loadpref - do we need to load preferences from disk?
Method Detail

createRequest

public org.w3c.www.protocol.http.Request createRequest()
Create a HTTP/1.1 request
Returns:
a Request instance

registerMimeTypeForFile

public java.util.Properties registerMimeTypeForFile(java.lang.String file,
                                                    java.lang.String mime)

getMimeType

public java.lang.String getMimeType(java.lang.String name)
                             throws PutAbortedException
Guess a mime type for the given file.
Parameters:
name - the file name
Returns:
a String instance

getMimeType

public java.lang.String getMimeType(java.lang.String name,
                                    boolean prompt)
                             throws PutAbortedException
Guess a mime type for the given file.
Parameters:
name - the file name
prompt - should we prompt the user for a mime type if we can't guess it?
Returns:
a String instance

put

public org.w3c.www.protocol.http.Reply put(java.io.File toput,
                                           java.lang.String puturl,
                                           java.lang.String etag)
                                    throws java.io.FileNotFoundException,
                                           PutAbortedException
Perform a HTTP/1.1 PUT
Parameters:
toput - The file to upload
puturl - the location url
user - auth: username
password - auth: password
Returns:
a Reply instance
Throws:
java.io.FileNotFoundException - if toput is not found

put

public org.w3c.www.protocol.http.Reply put(java.io.File toput,
                                           java.lang.String puturl,
                                           java.lang.String etag,
                                           java.util.Hashtable headers)
                                    throws java.io.FileNotFoundException,
                                           PutAbortedException
Perform a HTTP/1.1 PUT
Parameters:
toput - The file to upload
puturl - the location url
user - auth: username
password - auth: password
Returns:
a Reply instance
Throws:
java.io.FileNotFoundException - if toput is not found

perform

public void perform(java.lang.String file,
                    java.lang.String url)
             throws java.io.FileNotFoundException
Perform the put(s)
Throws:
java.io.FileNotFoundException - if a file is not found

delete

public void delete(java.lang.String url)
Perform a DELETE

putDir

public void putDir(java.io.File dir,
                   java.lang.String durl)
            throws java.io.FileNotFoundException
Put (recursively) the files to the location URL.
Parameters:
dir - the directory
durl - the location URL

putDir

public void putDir(java.io.File dir,
                   java.lang.String durl,
                   java.util.Hashtable headers,
                   boolean rec)
            throws java.io.FileNotFoundException
Put (recursively) the files to the location URL.
Parameters:
dir - the directory
durl - the location URL
headers - User headers

putAbortableDir

protected void putAbortableDir(java.io.File dir,
                               java.lang.String durl,
                               java.util.Hashtable headers,
                               boolean rec)
                        throws java.io.FileNotFoundException,
                               PutAbortedException
Put (recursively) the files to the location URL.
Parameters:
dir - the directory
durl - the location URL
headers - User headers

putFile

public void putFile(java.io.File toput,
                    java.lang.String furl)
             throws java.io.FileNotFoundException
Put the givent file at the given location URL
Parameters:
toput - the file to upload
furl - the url

putFile

public void putFile(java.io.File toput,
                    java.lang.String desturl,
                    java.util.Hashtable headers)
             throws java.io.FileNotFoundException
Put the givent file at the given location URL
Parameters:
toput - the file to upload
furl - the url
headers - User headers

abort

public void abort()
Overrides:
abort in class JW

updateProperties

public void updateProperties(java.util.Properties props)
Description copied from class: JW
Update the user properties
Overrides:
updateProperties in class JW
Following copied from class: org.w3c.jwput.JW
Parameters:
props - the new properties

initialize

protected void initialize(java.util.Properties props)
Overrides:
initialize in class JW

usage

public static void usage()
Display the "Usage" message.

badArgs

public static void badArgs(java.lang.String msg)
Display the message for bad command line error.
Parameters:
msg - a message.

main

public static void main(java.lang.String[] args)
Main. read the command line.