wjhk.jupload2.policies
Class DefaultUploadPolicy

java.lang.Object
  extended by wjhk.jupload2.policies.DefaultUploadPolicy
All Implemented Interfaces:
UploadPolicy
Direct Known Subclasses:
CustomizedNbFilesPerRequestUploadPolicy, FileByFileUploadPolicy, FilesTogetherUploadPolicy, PictureUploadPolicy

public class DefaultUploadPolicy
extends Object
implements UploadPolicy

This class implements all UploadPolicy methods. Its way of working is he same as the JUpload version 1.
The simplest way to use this policy is given in the presentation of UploadPolicy. The DefaultUploadPolicy is used when no uploadPolicy parameter is given to the juploadContext, or this parameter has 'DefaultUploadPolicy' as a value.

The default behavior is representated below. It can be overridden by adding parameters to the juploadContext. All available parameters are shown in the presentation of UploadPolicy.

Version:
$Revision: 963 $
Author:
etienne_sf

Field Summary
protected  File debugFile
          The actual file, used for the debug log.
protected  boolean debugOk
          This flag prevents endless repeats of opening the debug log, if that failed for some reason.
protected  PrintStream debugOut
          This stream is used to store all information that could be useful, in case a problem occurs.
protected  Pattern patternError
          Same as patternSuccess, but for the error message.
protected  Pattern patternSuccess
          The regexp pattern that is used to find the success string in the HTTP response.
protected  Pattern patternWarning
          Same as patternSuccess, but for the warning message.
 
Fields inherited from interface wjhk.jupload2.policies.UploadPolicy
DEFAULT_AFTER_UPLOAD_TARGET, DEFAULT_AFTER_UPLOAD_URL, DEFAULT_ALBUM_ID, DEFAULT_ALLOW_HTTP_PERSISTENT, DEFAULT_ALLOWED_FILE_EXTENSIONS, DEFAULT_BROWSING_DIRECTORY, DEFAULT_DATE_FORMAT, DEFAULT_DEBUG_LEVEL, DEFAULT_FILE_CHOOSER_ICON_FROM_FILE_CONTENT, DEFAULT_FILE_CHOOSER_ICON_SIZE, DEFAULT_FILE_CHOOSER_IMAGE_PREVIEW, DEFAULT_FILENAME_ENCODING, DEFAULT_FORMDATA, DEFAULT_FTP_CREATE_DIRECTORY_STRUCTURE, DEFAULT_FTP_TRANSFERT_BINARY, DEFAULT_FTP_TRANSFERT_PASSIVE, DEFAULT_HIGH_QUALITY_PREVIEW, DEFAULT_HTTP_UPLOAD_PARAMETER_NAME, DEFAULT_HTTP_UPLOAD_PARAMETER_TYPE, DEFAULT_KEEP_ORIG_EXTENSION, DEFAULT_LANG, DEFAULT_LOOK_AND_FEEL, DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_HEIGHT, DEFAULT_MAX_WIDTH, DEFAULT_NB_FILES_PER_REQUEST, DEFAULT_PICTURE_COMPRESSION_QUALITY, DEFAULT_PICTURE_TRANSMIT_METADATA, DEFAULT_POST_URL, DEFAULT_READ_COOKIE_FROM_NAVIGATOR, DEFAULT_READ_USER_AGENT_FROM_NAVIGATOR, DEFAULT_REAL_MAX_HEIGHT, DEFAULT_REAL_MAX_WIDTH, DEFAULT_SERVER_PROTOCOL, DEFAULT_SHOW_LOGWINDOW, DEFAULT_SHOW_STATUSBAR, DEFAULT_SPECIFIC_HEADERS, DEFAULT_SSL_VERIFY_CERT, DEFAULT_STORE_BUFFERED_IMAGE, DEFAULT_STRING_UPLOAD_ERROR, DEFAULT_STRING_UPLOAD_SUCCESS, DEFAULT_STRING_UPLOAD_WARNING, DEFAULT_TARGET_PICTURE_FORMAT, DEFAULT_UPLOAD_POLICY, DEFAULT_URL_TO_SEND_ERROR_TO, HTTPUPLOADPARAMETERTYPE_ARRAY, HTTPUPLOADPARAMETERTYPE_ITERATION, HTTPUPLOADPARAMETERTYPE_ONE_FILE, PROP_AFTER_UPLOAD_TARGET, PROP_AFTER_UPLOAD_URL, PROP_ALBUM_ID, PROP_ALLOW_HTTP_PERSISTENT, PROP_ALLOWED_FILE_EXTENSIONS, PROP_BROWSING_DIRECTORY, PROP_DEBUG_LEVEL, PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT, PROP_FILE_CHOOSER_ICON_SIZE, PROP_FILE_CHOOSER_IMAGE_PREVIEW, PROP_FILENAME_ENCODING, PROP_FORMDATA, PROP_FTP_CREATE_DIRECTORY_STRUCTURE, PROP_FTP_TRANSFERT_BINARY, PROP_FTP_TRANSFERT_PASSIVE, PROP_HIGH_QUALITY_PREVIEW, PROP_HTTP_UPLOAD_PARAMETER_NAME, PROP_HTTP_UPLOAD_PARAMETER_TYPE, PROP_KEEP_ORIG_EXTENSION, PROP_LANG, PROP_LOOK_AND_FEEL, PROP_MAX_CHUNK_SIZE, PROP_MAX_FILE_SIZE, PROP_MAX_HEIGHT, PROP_MAX_WIDTH, PROP_NB_FILES_PER_REQUEST, PROP_PICTURE_COMPRESSION_QUALITY, PROP_PICTURE_TRANSMIT_METADATA, PROP_POST_URL, PROP_READ_COOKIE_FROM_NAVIGATOR, PROP_READ_USER_AGENT_FROM_NAVIGATOR, PROP_REAL_MAX_HEIGHT, PROP_REAL_MAX_WIDTH, PROP_SERVER_PROTOCOL, PROP_SHOW_LOGWINDOW, PROP_SHOW_STATUSBAR, PROP_SPECIFIC_HEADERS, PROP_SSL_VERIFY_CERT, PROP_STORE_BUFFERED_IMAGE, PROP_STRING_UPLOAD_ERROR, PROP_STRING_UPLOAD_SUCCESS, PROP_STRING_UPLOAD_WARNING, PROP_TARGET_PICTURE_FORMAT, PROP_UPLOAD_POLICY, PROP_URL_TO_SEND_ERROR_TO, SHOWLOGWINDOW_FALSE, SHOWLOGWINDOW_ONERROR, SHOWLOGWINDOW_TRUE
 
Constructor Summary
DefaultUploadPolicy(wjhk.jupload2.context.JUploadContext juploadContext)
          The main constructor : use default values, and the given postURL.
 
Method Summary
 void addComponentsToJUploadPanel(JUploadPanel jUploadPanel)
          This methods allow the upload policy to override the default disposition of the components on the applet.
 void addHeader(String header)
          Add an header to the list of headers that will be added to each HTTP upload request.
protected  void addMsgToDebugLog(String msg)
          This methods allows the applet to store all messages (debug, warning, info, errors...) into a StringBuffer.
 void afterFileDropped(DropTargetDropEvent dropEvent)
          Default reaction after a successful drop operation: no action.
 void afterUpload(Exception e, String serverOutput)
          This method is called after an upload, whether it is successful or not.
 void alert(String key)
          Displays a MessageBox with a unique 'Ok' button, by calling the JOptionPane.showMessageDialog(java.awt.Component, Object) method.
 void alertStr(String str)
          Displays a MessageBox with a unique 'Ok' button, by calling the JOptionPane.showMessageDialog(java.awt.Component, Object) method.
 boolean beforeUpload()
          Execute any action, that must be done before upload.
 boolean checkUploadSuccess(int status, String msg, String body)
          The default behavior (see DefaultUploadPolicy) is to check that the stringUploadSuccess applet parameter is present in the response from the server.
 int confirmDialogStr(String str, int optionTypes)
          Displays a MessageBox with a unique 'Ok' button, by calling the JOptionPane.showConfirmDialog(java.awt.Component, Object, String, int) method.
 JUploadFileChooser createFileChooser()
          Default implementation for UploadPolicy.createFileChooser(): just a creation of a JUploadFileChooser.
 FileData createFileData(File file, File root)
          The DefaultUpload accepts all file types: we just return an instance of FileData, without any test.
 JPanel createProgressPanel(JProgressBar preparationProgressBar, JProgressBar uploadProgressBar, JButton uploadButton, JButton stopButton, JPanel mainPanel)
          This method is called to create the progress panel.
 JPanel createStatusBar(JLabel content, JPanel mainPanel)
          This method is used to create a new status bar.
 JPanel createTopPanel(JButton browse, JButton remove, JButton removeAll, JUploadPanel jUploadPanel)
          Default implementation of UploadPolicy.createTopPanel(JButton, JButton, JButton, JUploadPanel) .
 void deleteLog()
          Delete the current log.
 void displayDebug(String debug, int minDebugLevel)
          log a debug message.
 void displayErr(Exception e)
          log an error message, based on an exception.
 void displayErr(String err)
          log an error message.
 void displayErr(String errorText, Exception exception)
          If debug is off, the log window may not be visible.
 int displayErr(String errorText, Exception exception, int optionTypes)
          If debug is off, the log window may not be visible.
 void displayInfo(String info)
          log an info message.
 void displayParameterStatus()
          This method displays the applet parameter list, according to the current debugLevel.
 void displayWarn(String warn)
          log a warning message.
 boolean fileFilterAccept(File file)
          This method returns the response for the JUploadFileFilter.accept(File) which just calls this method.
 String fileFilterGetDescription()
          Return a description for the FileFilter, according to the current upload policy.
 Icon fileViewGetIcon(File file)
          Returns null: the default icon is used.
 String getAfterUploadTarget()
          Return the target, specified as applet parameter "afterUploadTarget"
 String getAfterUploadURL()
          Retrieves the current value for the afterUploadURL applet parameter.
 String getAllowedFileExtensions()
          Retrieves the current value for allowedFileExtensions *
 boolean getAllowHttpPersistent()
          Retrieves the current value for allowHttpPersistent
 wjhk.jupload2.context.JUploadContext getContext()
          A useful function, that has nothing to do with an upload policy.
 File getCurrentBrowsingDirectory()
          Returns the current browsing directory, that is: the directory that will be current the next time the file chooser is opened.
 String getDateFormat()
          Returns the currently choosen format for date.
 int getDebugLevel()
          This method returns the current debug level.
protected  String getEncodedFilename(String filename)
          returns the filename and encodes it, if necessary
 int getFileChooserIconFromFileContent()
          Getter for fileChooserIconFromFileContent.
 int getFileChooserIconSize()
          Getter for fileChooserIconSize.
 String getFilenameEncoding()
          Returns the encoding that should be used for the filename.
 String getFormdata()
          Retrieve the applet's "formdata" parameter.
 boolean getFtpCreateDirectoryStructure()
          Returns the current value for the ftpCreateDirectoryStructure applet parameter.
 boolean getFtpTransfertBinary()
          Returns the current value for the ftpTransfertBinary applet parameter.
 boolean getFtpTransfertPassive()
          Returns the current value for the ftpTransfertPassive applet parameter.
 String getHttpUploadParameterName()
          Retrieve the applet's "httpUploadParameterName" parameter.
 String getHttpUploadParameterType()
          Retrieve the applet's "httpUploadParameterType" parameter.
 JUploadException getLastException()
          Indicates that an error occurs.
 String getLastResponseBody()
          Retrieve the body of the last server response.
 String getLastResponseMessage()
          Retrieve the status/error message of the last server response.
 String getLocalizedString(String key, Object... args)
          Retrieve a lang string, based on the file cointained in the wjhk.jupload2.lang package.
protected  String getLookAndFeel()
           
 long getMaxChunkSize()
          Returns the value of the applet parameter maxChunkSize (see above for a description of all applet parameters)
 long getMaxFileSize()
          Returns the value of the applet parameter maxFileSize (see above for a description of all applet parameters)
 int getNbFilesPerRequest()
          This function returns the number of files should be uploaded during one access to the server.
 String getPostURL()
          Get the target URL for upload.
 boolean getReadCookieFromNavigator()
          Return the current value of readCookieFromNavigator
 boolean getReadUserAgentFromNavigator()
          Return the current value of readUserAgentFromNavigator
 String getServerProtocol()
          HTTP protocol that should be used to send the HTTP request.
 String getShowLogWindow()
          Indicate whether the log window should be shown.
 String getSpecificHeaders()
          Returns the list of specific headers, that will be added to all HTTP request to the server.
 int getSslVerifyCert()
          Retrieves SSL verification mode.
 String getStringUploadError()
          Retrieve the regular expression that will be tested against each line of the server answer.
 String getStringUploadSuccess()
          Get the regular expression that will be tested against each line of the server answer.
 String getStringUploadWarning()
          Retrieve the regular expression that will be tested against each line of the server answer.
 String getUploadFilename(FileData fileData, int index)
          Get the original name of the file on the disk.
 String getUploadName(FileData fileData, int index)
          Get an upload filename, that is to be send in the HTTP upload request.
 String getUrlToSendErrorTo()
          Returns the current URL where error log must be posted.
 wjhk.jupload2.upload.helper.ByteArrayEncoder onAppendHeader(wjhk.jupload2.upload.helper.ByteArrayEncoder bae)
          Append specific headers for this upload (session cookies, for instance).
 void onFileDoubleClicked(FileData fileData)
          Default implementation of the UploadPolicy.onFileDoubleClicked(FileData) .
 void onFileSelected(FileData fileData)
          Default implementation of the UploadPolicy.onFileSelected(wjhk.jupload2.filedata.FileData) .
 void sendDebugInformation(String description, Exception exception)
          This method allows the applet to post debug information to the website (see UploadPolicy.getUrlToSendErrorTo()).
protected  void setAfterUploadURL(String afterUploadURL)
          Set the afterUploadURL
protected  void setAllowedFileExtensions(String allowedFileExtensions)
           
protected  void setAllowHttpPersistent(boolean value)
           
 void setCurrentBrowsingDirectory(File currentBrowsingDirectoryParam)
          Set the current directory.
 void setCurrentBrowsingDirectory(String currentBrowsingDirectoryParam)
          Set the current directory.
 Cursor setCursor(Cursor cursor)
          Changes the current mouse cursor.
 void setDebugLevel(int debugLevel)
          This method indicate whether or not the debug messages must be displayed.
 void setDebugLevel(int debugLevel, boolean displayAppletParameterList)
          Set the debug level.
 void setFileChooserIconFromFileContent(int fileChooserIconFromFileContent)
          Setter for fileChooserIconFromFileContent.
 void setFileChooserIconSize(int fileChooserIconSize)
          Setter for fileChooserIconSize.
protected  void setFilenameEncoding(String filenameEncoding)
           
protected  void setFtpCreateDirectoryStructure(boolean ftpCreateDirectoryStructure)
           
protected  void setFtpTransfertBinary(boolean ftpTransfertBinary)
           
protected  void setFtpTransfertPassive(boolean ftpTransfertPassive)
           
 void setLang(String lang)
          This method sets the current language to take into account.
 void setLastException(JUploadException exception)
          Set the last exception.
protected  void setLookAndFeel(String lookAndFeel)
           
protected  void setMaxChunkSize(long maxChunkSize)
           
protected  void setMaxFileSize(long maxFileSize)
           
protected  void setNbFilesPerRequest(int nbFilesPerRequest)
           
 void setPostURL(String postURL)
          The URL can change during the life of our policy ...
 void setProperty(String prop, String value)
          This method manages all applet parameters.
 void setServerProtocol(String serverProtocol)
           
 void setShowLogWindow(String showLogWindow)
          
protected  void setShowStatusbar(boolean show)
           
protected  void setSpecificHeaders(String specificHeaders)
          Set all specific headers defined in the specificHeaders applet parameter.
protected  void setSslVerifyCert(String mode)
           
protected  void setStringUploadError(String stringUploadError)
           
protected  void setStringUploadSuccess(String stringUploadSuccess)
           
protected  void setStringUploadWarning(String stringUploadWarning)
           
 void setUrlToSendErrorTo(String urlToSendErrorTo)
          
 Cursor setWaitCursor()
          This method changes the current mouse cursor to the wait one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugOut

protected PrintStream debugOut
This stream is used to store all information that could be useful, in case a problem occurs. Is content can then be sent to the webmaster.


debugFile

protected File debugFile
The actual file, used for the debug log.

See Also:
debugGenerateFile

debugOk

protected boolean debugOk
This flag prevents endless repeats of opening the debug log, if that failed for some reason.


patternError

protected Pattern patternError
Same as patternSuccess, but for the error message. If found, then the upload was accepted by the remote HTTP server, but rejected by the remote application. This pattern should also find the error message in the first matching string.


patternSuccess

protected Pattern patternSuccess
The regexp pattern that is used to find the success string in the HTTP response. If found, the upload is considered to be a success: it has been accepted by the remote server and the remote application.


patternWarning

protected Pattern patternWarning
Same as patternSuccess, but for the warning message. Each time it is found, a message is displayed to the user.

Constructor Detail

DefaultUploadPolicy

public DefaultUploadPolicy(wjhk.jupload2.context.JUploadContext juploadContext)
                    throws JUploadException
The main constructor : use default values, and the given postURL.

Parameters:
juploadContext - The current juploadContext. As the reference to the current upload policy exists almost everywhere, this parameter allows any access to anyone on the juploadContext... including reading the applet parameters.
Throws:
JUploadException - If an applet parameter is invalid
Method Detail

addHeader

public void addHeader(String header)
Description copied from interface: UploadPolicy
Add an header to the list of headers that will be added to each HTTP upload request. This method is called from specific uploadPolicies, which would need headers to be added to all uploads. These headers are used in DefaultUploadPolicy.

Specified by:
addHeader in interface UploadPolicy
See Also:
UploadPolicy.addHeader(java.lang.String)

checkUploadSuccess

public boolean checkUploadSuccess(int status,
                                  String msg,
                                  String body)
                           throws JUploadException
The default behavior (see DefaultUploadPolicy) is to check that the stringUploadSuccess applet parameter is present in the response from the server. The return is tested, in the order below:
  • False, if the stringUploadError is found. An error message is then displayed.
  • True, if the stringUploadSuccess is null or empty (no test at all).
  • True, if the stringUploadSuccess string is present in the serverOutputBody.
  • True, If previous condition is not filled, but the HTTP header "HTTP(.*)200OK$" is present: the test is currently non blocking, because I can not test all possible HTTP configurations.
  • False if the previous conditions are not fullfilled.

  • This method also looks for the stringUploadWarning regular expression. Each time it is matched, the found message is displayed to the user.

    Specified by:
    checkUploadSuccess in interface UploadPolicy
    Parameters:
    status - The HTTP response code
    msg - The status message from the first line of the response (e.g. "200 OK").
    body - The body of the HTTP answer.
    Returns:
    True or False, indicating if the upload is a success or not.
    Throws:
    JUploadException - Thrown if the success conditions are not met.
    See Also:
    UploadPolicy.checkUploadSuccess(int, String, String)

    afterUpload

    public void afterUpload(Exception e,
                            String serverOutput)
                     throws JUploadException
    Description copied from interface: UploadPolicy
    This method is called after an upload, whether it is successful or not. This method is called once for each click of the user on the 'upload' button. That is: if the nbFilesPerRequest is 2, and the user selected 5 files before clicking on the 'upload' button. Then the afterUpload is called once the 5 files were uploaded to the server.

    Specified by:
    afterUpload in interface UploadPolicy
    Parameters:
    e - null if success, or the exception indicating the problem.
    serverOutput - The full server output, including the HTTP headers.
    Throws:
    JUploadException
    See Also:
    UploadPolicy.afterUpload(Exception, String)

    alertStr

    public void alertStr(String str)
    Description copied from interface: UploadPolicy
    Displays a MessageBox with a unique 'Ok' button, by calling the JOptionPane.showMessageDialog(java.awt.Component, Object) method.

    Specified by:
    alertStr in interface UploadPolicy
    Parameters:
    str - The full String that must be displayed to the user.
    See Also:
    UploadPolicy.alertStr(String)

    confirmDialogStr

    public int confirmDialogStr(String str,
                                int optionTypes)
    Description copied from interface: UploadPolicy
    Displays a MessageBox with a unique 'Ok' button, by calling the JOptionPane.showConfirmDialog(java.awt.Component, Object, String, int) method.

    Specified by:
    confirmDialogStr in interface UploadPolicy
    Parameters:
    str - The full String that must be displayed to the user.
    optionTypes - The options indicating the button to display. Valid options are the options valid for the JOptionPane.showConfirmDialog(java.awt.Component, Object, String, int) method.
    Returns:
    The JOptionConstant that indicates the button the user cliecked on (for instance OK_OPTION)
    See Also:
    UploadPolicy.confirmDialogStr(String, int)

    alert

    public void alert(String key)
    Description copied from interface: UploadPolicy
    Displays a MessageBox with a unique 'Ok' button, by calling the JOptionPane.showMessageDialog(java.awt.Component, Object) method.

    Specified by:
    alert in interface UploadPolicy
    Parameters:
    key - The string identifying the text to display, depending on the current language.
    See Also:
    UploadPolicy.alert(String)

    createFileData

    public FileData createFileData(File file,
                                   File root)
                            throws JUploadExceptionStopAddingFiles
    The DefaultUpload accepts all file types: we just return an instance of FileData, without any test.

    Specified by:
    createFileData in interface UploadPolicy
    Parameters:
    file - The file used to create the FileData instance. This method is called once for each file selected by the user, even if the user added several files in one 'shot'.
    root - An optional toplevel directory of a hierarchy (can be null).
    Returns:
    A FileData instance. The exact class depends on the currentUploadPolicy. Can be null, if the policy performs checks, and the given file is not Ok for these controls. See PictureUploadPolicy.createFileData(File,File) for an example. It's up to the upload policy to display a message to inform the user that this file won't be added to the file list.
    Throws:
    JUploadExceptionStopAddingFiles - The exception is not really an error. It allows an easy way to indicates that the applet should stop adding files when the user clicked on the 'Cancel' button.
    See Also:
    UploadPolicy.createFileData(File, File)

    createTopPanel

    public JPanel createTopPanel(JButton browse,
                                 JButton remove,
                                 JButton removeAll,
                                 JUploadPanel jUploadPanel)
    Default implementation of UploadPolicy.createTopPanel(JButton, JButton, JButton, JUploadPanel) . IT creates a JPanel, containing the three given JButton. It creates the same panel as the original JUpload.

    Specified by:
    createTopPanel in interface UploadPolicy
    Parameters:
    browse - The default browse button.
    remove - The default removeSelected button.
    removeAll - The default removeAll button.
    jUploadPanel - The panel that contains all objects.
    Returns:
    the topPanel, that will be displayed on the top of the Applet.
    See Also:
    UploadPolicy.createTopPanel(JButton, JButton, JButton, JUploadPanel)

    createProgressPanel

    public JPanel createProgressPanel(JProgressBar preparationProgressBar,
                                      JProgressBar uploadProgressBar,
                                      JButton uploadButton,
                                      JButton stopButton,
                                      JPanel mainPanel)
    Description copied from interface: UploadPolicy
    This method is called to create the progress panel. The default implementation is defined in createProgressPanel(JProgressBar, JProgressBar, JButton, JButton, JPanel) .

    Specified by:
    createProgressPanel in interface UploadPolicy
    Parameters:
    preparationProgressBar - The default preparation progress bar.
    uploadProgressBar - The default upload progress bar.
    uploadButton - The default upload button.
    stopButton - The default stop button.
    mainPanel - The panel that contains all objects.
    Returns:
    the topPanel, that will be displayed on the top of the Applet.
    See Also:
    UploadPolicy.createProgressPanel(JProgressBar, JProgressBar, JButton, JButton, JPanel)

    createStatusBar

    public JPanel createStatusBar(JLabel content,
                                  JPanel mainPanel)
    Description copied from interface: UploadPolicy
    This method is used to create a new status bar. The default implementation is defined in createStatusBar(JLabel, JPanel) .

    Specified by:
    createStatusBar in interface UploadPolicy
    Parameters:
    content - The status bar content
    mainPanel - The panel that contains all objects.
    Returns:
    the topPanel, that will be displayed on the top of the Applet.
    See Also:
    UploadPolicy.createStatusBar(javax.swing.JLabel, javax.swing.JPanel)

    addComponentsToJUploadPanel

    public void addComponentsToJUploadPanel(JUploadPanel jUploadPanel)
    This methods allow the upload policy to override the default disposition of the components on the applet.

    Specified by:
    addComponentsToJUploadPanel in interface UploadPolicy
    Parameters:
    jUploadPanel - The main applet panel.
    See Also:
    UploadPolicy.addComponentsToJUploadPanel(JUploadPanel)

    displayErr

    public void displayErr(Exception e)
    Description copied from interface: UploadPolicy
    log an error message, based on an exception. Will be logged in the log window, if defined.
    The dialog box will only contain an Ok button. Same as caling: displayErr(e, JOptionPane.OK_OPTION);

    Specified by:
    displayErr in interface UploadPolicy
    Parameters:
    e - The exception to report
    See Also:
    UploadPolicy.displayErr(Exception)

    displayErr

    public void displayErr(String err)
    Description copied from interface: UploadPolicy
    log an error message. Will be logged in the log window, if defined.
    The dialog box will only contain an Ok button.

    Specified by:
    displayErr in interface UploadPolicy
    Parameters:
    err - The erreur message to be displayed.
    See Also:
    UploadPolicy.displayErr(String)

    displayErr

    public int displayErr(String errorText,
                          Exception exception,
                          int optionTypes)
    If debug is off, the log window may not be visible. We switch the debug to on, to be sure that some information will be displayed to the user.
    If debug is -1, the log window remains hidden.

    Specified by:
    displayErr in interface UploadPolicy
    Parameters:
    errorText - The erreur message to be displayed. If null the exception (or it's cause if any) message is displayed.
    exception - The exception to report
    optionTypes - One of the valid JOptionPane option types for the JOptionPane.showConfirmDialog(java.awt.Component, Object, String, int) method: OK_CANCEL_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION... -1 is also accepted, to only have the Ok button. OK_OPTION is prohibited, as it has the same value as YES_NO_OPTION.
    Returns:
    The XXX_OPTION, corresponding to the button clicked by the user.
    See Also:
    UploadPolicy.displayErr(java.lang.String, java.lang.Exception, int)

    displayErr

    public void displayErr(String errorText,
                           Exception exception)
    If debug is off, the log window may not be visible. We switch the debug to on, to be sure that some information will be displayed to the user.
    If debug is -1, the log window remains hidden.

    Specified by:
    displayErr in interface UploadPolicy
    Parameters:
    errorText - The error message to be displayed.
    exception - An exception. It's stacktrace is logged.
    See Also:
    UploadPolicy.displayErr(java.lang.String, java.lang.Exception)

    displayInfo

    public void displayInfo(String info)
    Description copied from interface: UploadPolicy
    log an info message. Will be logged in the log window, if defined.

    Specified by:
    displayInfo in interface UploadPolicy
    Parameters:
    info - The information message that will be displayed.
    See Also:
    UploadPolicy.displayInfo(String)

    displayWarn

    public void displayWarn(String warn)
    Description copied from interface: UploadPolicy
    log a warning message. Will be logged in the log window, if defined.

    Specified by:
    displayWarn in interface UploadPolicy
    Parameters:
    warn - The warning message that will be displayed.
    See Also:
    UploadPolicy.displayWarn(String)

    displayDebug

    public void displayDebug(String debug,
                             int minDebugLevel)
    Description copied from interface: UploadPolicy
    log a debug message. Will be logged in the log window, if defined.

    Specified by:
    displayDebug in interface UploadPolicy
    Parameters:
    debug - The message to display.
    minDebugLevel - If the current debug level is superior or equals to minDebugLevel, the message will be displayed. Otherwise, it will be ignored.
    See Also:
    UploadPolicy.displayDebug(String, int)

    getLocalizedString

    public String getLocalizedString(String key,
                                     Object... args)
    Description copied from interface: UploadPolicy
    Retrieve a lang string, based on the file cointained in the wjhk.jupload2.lang package. This allows localization.

    Specified by:
    getLocalizedString in interface UploadPolicy
    Parameters:
    key - The key, whose associated text is to retrieve. This text must respect the constraints of the String.format(String, Object...) method, that is called in the getLocalizedString(String, Object...) implementation of this method.
    args - The optional parameters, that will replace the placeholders in the localized text identified by 'key'.
    Returns:
    The associated text.
    See Also:
    UploadPolicy.getLocalizedString(String, Object...)

    getUploadFilename

    public String getUploadFilename(FileData fileData,
                                    int index)
                             throws JUploadException
    Description copied from interface: UploadPolicy
    Get the original name of the file on the disk. This function can encode the filename (see the filenameEncoding parameter). By default, the original filename is returned.

    Specified by:
    getUploadFilename in interface UploadPolicy
    Parameters:
    fileData - The file data whose upload file name must be calculated.
    index - index of the file in the current request to the server (from 0 to n)
    Returns:
    The filename the is given in the filename part of the Content-Disposition header.
    Throws:
    JUploadException
    See Also:
    UploadPolicy.getUploadFilename(FileData, int)

    getEncodedFilename

    protected final String getEncodedFilename(String filename)
                                       throws JUploadException
    returns the filename and encodes it, if necessary

    Parameters:
    filename - the original filename
    Returns:
    filename (encoded, if necessary)
    Throws:
    JUploadException

    getUploadName

    public String getUploadName(FileData fileData,
                                int index)
                         throws JUploadException
    Description copied from interface: UploadPolicy
    Get an upload filename, that is to be send in the HTTP upload request. This is the name part of the Content-Disposition header. That is: this is the name under which you can manage the file (for instance in the _FILES[$name] in PHP) and not the filename of the original file.
    If you're using one of the core JUpload UploadPolicy, the value for this parameter is controled by the applet parameters: targetPictureFormat and keepOriginalFileExtensionForConvertedImages.

    Specified by:
    getUploadName in interface UploadPolicy
    Parameters:
    fileData - The file data whose upload name must be calculated.
    index - index of the file in the current request to the server (from 0 to n)
    Returns:
    The name part of the Content-Disposition header.
    Throws:
    JUploadException
    See Also:
    UploadPolicy.getUploadName(FileData, int)

    getHttpUploadParameterName

    public String getHttpUploadParameterName()
    Description copied from interface: UploadPolicy
    Retrieve the applet's "httpUploadParameterName" parameter.

    Specified by:
    getHttpUploadParameterName in interface UploadPolicy
    Returns:
    The applet's httpUploadParameterName parameter.
    See Also:
    UploadPolicy.getHttpUploadParameterName()

    getHttpUploadParameterType

    public String getHttpUploadParameterType()
    Description copied from interface: UploadPolicy
    Retrieve the applet's "httpUploadParameterType" parameter.

    Specified by:
    getHttpUploadParameterType in interface UploadPolicy
    Returns:
    The applet's httpUploadParameterType parameter.
    See Also:
    UploadPolicy.getHttpUploadParameterType()

    beforeUpload

    public boolean beforeUpload()
    Description copied from interface: UploadPolicy
    Execute any action, that must be done before upload. For instance, PictureUploadPolicy disable the rotation buttons during buttons. The beforeUpload() method just returns true.

    Specified by:
    beforeUpload in interface UploadPolicy
    Returns:
    indicate if everything is ready for upload.
    See Also:
    UploadPolicy.beforeUpload()

    onAppendHeader

    public wjhk.jupload2.upload.helper.ByteArrayEncoder onAppendHeader(wjhk.jupload2.upload.helper.ByteArrayEncoder bae)
                                                                throws JUploadIOException
    Description copied from interface: UploadPolicy
    Append specific headers for this upload (session cookies, for instance). This method is called while building each upload HTTP request.

    Specified by:
    onAppendHeader in interface UploadPolicy
    Parameters:
    bae - The header ByteArrayEncoder where specific headers should be appended.
    Returns:
    The ByteArrayEncoder given in parameters. This is allows to work like with StringBuffer.append method: sb.append(s1).append(s2);
    Throws:
    JUploadIOException
    See Also:
    UploadPolicy.onAppendHeader(ByteArrayEncoder)

    onFileSelected

    public void onFileSelected(FileData fileData)
    Default implementation of the UploadPolicy.onFileSelected(wjhk.jupload2.filedata.FileData) . Nothing's done.

    Specified by:
    onFileSelected in interface UploadPolicy

    onFileDoubleClicked

    public void onFileDoubleClicked(FileData fileData)
    Default implementation of the UploadPolicy.onFileDoubleClicked(FileData) . Nothing's done.

    Specified by:
    onFileDoubleClicked in interface UploadPolicy

    sendDebugInformation

    public void sendDebugInformation(String description,
                                     Exception exception)
    Description copied from interface: UploadPolicy
    This method allows the applet to post debug information to the website (see UploadPolicy.getUrlToSendErrorTo()). Then, it is possible to log the error, to send a mail...

    Specified by:
    sendDebugInformation in interface UploadPolicy
    Parameters:
    description - A string describing briefly the problem. The mail subject will be something like: Jupload Error (reason)
    exception - The java exception that was raised, or null if no exception.
    See Also:
    UploadPolicy.sendDebugInformation(String, Exception)

    setProperty

    public void setProperty(String prop,
                            String value)
                     throws JUploadException
    This method manages all applet parameters. It allows javascript to update their value, for instance after the user chooses a value in a list ...

    Specified by:
    setProperty in interface UploadPolicy
    Parameters:
    prop - The applet parameter name.
    value - The new value for this parameter. If the value is not valid (for instance aaa for a number), a warning is displayed in the log window, and the existing value is not changed.
    Throws:
    JUploadException
    JUploadExceptionStopAddingFiles - indicates that the applet should stop strying adding the current file selection. Useful for instance, when a user drop a directory, full of unallowed file: it's annoying for the user to click 'Ok' for each file in the alert box.
    See Also:
    UploadPolicy.setProperty(java.lang.String, java.lang.String)

    displayParameterStatus

    public void displayParameterStatus()
    This method displays the applet parameter list, according to the current debugLevel. It is called by the setDebugLevel(int) method. It should be override by any subclasses, that should display its own parameters, then call super.displayParameterStatus().

    Specified by:
    displayParameterStatus in interface UploadPolicy
    See Also:
    UploadPolicy.displayParameterStatus()

    getAfterUploadURL

    public String getAfterUploadURL()
    Description copied from interface: UploadPolicy
    Retrieves the current value for the afterUploadURL applet parameter.

    Specified by:
    getAfterUploadURL in interface UploadPolicy
    Returns:
    The current value for he afterUploadURL applet parameter.
    See Also:
    UploadPolicy.getAfterUploadURL()

    setAfterUploadURL

    protected void setAfterUploadURL(String afterUploadURL)
                              throws JUploadException
    Set the afterUploadURL

    Parameters:
    afterUploadURL - The URL to use.
    Throws:
    JUploadException

    getAllowHttpPersistent

    public boolean getAllowHttpPersistent()
    Description copied from interface: UploadPolicy
    Retrieves the current value for allowHttpPersistent

    Specified by:
    getAllowHttpPersistent in interface UploadPolicy
    Returns:
    Current value for allowHttpPersistent
    See Also:
    UploadPolicy.getAllowHttpPersistent()

    getAllowedFileExtensions

    public String getAllowedFileExtensions()
    Description copied from interface: UploadPolicy
    Retrieves the current value for allowedFileExtensions *

    Specified by:
    getAllowedFileExtensions in interface UploadPolicy
    Returns:
    Current value for allowedFileExtensions
    See Also:
    UploadPolicy.getAllowedFileExtensions()

    setAllowedFileExtensions

    protected void setAllowedFileExtensions(String allowedFileExtensions)
    Parameters:
    allowedFileExtensions - the allowedFileExtensions to set

    setAllowHttpPersistent

    protected void setAllowHttpPersistent(boolean value)

    getContext

    public wjhk.jupload2.context.JUploadContext getContext()
    Description copied from interface: UploadPolicy
    A useful function, that has nothing to do with an upload policy. But it is useful to have it here, as the uploadPolicy is known everywhere in the applet.

    Specified by:
    getContext in interface UploadPolicy
    Returns:
    Reference to the current JUpload context.
    See Also:
    UploadPolicy.getContext()

    setCurrentBrowsingDirectory

    public void setCurrentBrowsingDirectory(File currentBrowsingDirectoryParam)
    Set the current directory.

    Specified by:
    setCurrentBrowsingDirectory in interface UploadPolicy
    Parameters:
    currentBrowsingDirectoryParam - The directory that will be the current one, the next time the file chooser is opened.
    See Also:
    UploadPolicy.getCurrentBrowsingDirectory()

    setCurrentBrowsingDirectory

    public void setCurrentBrowsingDirectory(String currentBrowsingDirectoryParam)
    Description copied from interface: UploadPolicy
    Set the current directory.

    Specified by:
    setCurrentBrowsingDirectory in interface UploadPolicy
    Parameters:
    currentBrowsingDirectoryParam - The name of the directory that should be the current one.
    See Also:
    UploadPolicy.setCurrentBrowsingDirectory(String)

    getCurrentBrowsingDirectory

    public File getCurrentBrowsingDirectory()
    Description copied from interface: UploadPolicy
    Returns the current browsing directory, that is: the directory that will be current the next time the file chooser is opened. It is initialized with the browsingDirectory applet parameter. Then, it contains the last directory used in the file chooser.

    Specified by:
    getCurrentBrowsingDirectory in interface UploadPolicy
    Returns:
    The directory that will be the current one, the next time the file chooser is opened.
    See Also:
    UploadPolicy.getCurrentBrowsingDirectory()

    getDateFormat

    public String getDateFormat()
    Description copied from interface: UploadPolicy
    Returns the currently choosen format for date. It must be compatible with the SimpleDateFormat standard Java class.

    Specified by:
    getDateFormat in interface UploadPolicy
    Returns:
    The date format.
    See Also:
    UploadPolicy.getDateFormat()

    getDebugLevel

    public int getDebugLevel()
    Description copied from interface: UploadPolicy
    This method returns the current debug level.

    Specified by:
    getDebugLevel in interface UploadPolicy
    Returns:
    The current debug level
    See Also:
    UploadPolicy.getDebugLevel()

    setDebugLevel

    public void setDebugLevel(int debugLevel)
    Description copied from interface: UploadPolicy
    This method indicate whether or not the debug messages must be displayed. Default is no debug (0).
    To activate the debug, add a 'debugLevel' parameter to the applet (with 1 to n value), or call this method. Currently, level used in the code are between 0 (no debug) and 100 (max debug).
    With a 0 value, no debug messages will be displayed. The DefaultUploadPolicy.addMsgToDebugBufferString method stores all debug output in a BufferString.

    Specified by:
    setDebugLevel in interface UploadPolicy
    Parameters:
    debugLevel - The new debugLevel.
    See Also:
    UploadPolicy.setDebugLevel(int)

    setDebugLevel

    public void setDebugLevel(int debugLevel,
                              boolean displayAppletParameterList)
    Set the debug level.

    Parameters:
    debugLevel - The new debuglevel.
    displayAppletParameterList - Flag. If set to true, the applet's parameters are shown.

    getFileChooserIconFromFileContent

    public int getFileChooserIconFromFileContent()
    Getter for fileChooserIconFromFileContent.

    Specified by:
    getFileChooserIconFromFileContent in interface UploadPolicy
    Returns:
    Current value for fileChooserIconFromFileContent
    See Also:
    UploadPolicy.PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT

    setFileChooserIconFromFileContent

    public void setFileChooserIconFromFileContent(int fileChooserIconFromFileContent)
    Setter for fileChooserIconFromFileContent. Current allowed values are: -1, 0, 1. Default value is 0.

    Parameters:
    fileChooserIconFromFileContent - Value to be set. If the value is not allowed (not -1, 0 or 1), the current value is unchangeed.
    See Also:
    UploadPolicy.PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT

    getFileChooserIconSize

    public int getFileChooserIconSize()
    Getter for fileChooserIconSize.

    Specified by:
    getFileChooserIconSize in interface UploadPolicy
    Returns:
    Current value for fileChooserIconSize
    See Also:
    UploadPolicy.PROP_FILE_CHOOSER_ICON_SIZE

    setFileChooserIconSize

    public void setFileChooserIconSize(int fileChooserIconSize)
    Setter for fileChooserIconSize.

    Parameters:
    fileChooserIconSize - Value to be set.
    See Also:
    UploadPolicy.PROP_FILE_CHOOSER_ICON_SIZE

    setLang

    public void setLang(String lang)
    Description copied from interface: UploadPolicy
    This method sets the current language to take into account. It loads the lang resourceBundle, which will allow the applet to display the texts in the correct language.

    Specified by:
    setLang in interface UploadPolicy
    Parameters:
    lang - The new language to take into account. See the java.util.Locale(String) constructor for a list of valid values.
    See Also:
    UploadPolicy.setLang(String)

    getLookAndFeel

    protected String getLookAndFeel()

    setLookAndFeel

    protected void setLookAndFeel(String lookAndFeel)
    Parameters:
    lookAndFeel - the lookAndFeel to set

    getMaxChunkSize

    public long getMaxChunkSize()
    Description copied from interface: UploadPolicy
    Returns the value of the applet parameter maxChunkSize (see above for a description of all applet parameters)

    Specified by:
    getMaxChunkSize in interface UploadPolicy
    Returns:
    the current value of maxChunkSize.
    See Also:
    UploadPolicy.getMaxChunkSize()

    setMaxChunkSize

    protected void setMaxChunkSize(long maxChunkSize)
    Parameters:
    maxChunkSize - the maxChunkSize to set

    getMaxFileSize

    public long getMaxFileSize()
    Description copied from interface: UploadPolicy
    Returns the value of the applet parameter maxFileSize (see above for a description of all applet parameters)

    Specified by:
    getMaxFileSize in interface UploadPolicy
    Returns:
    the current value of maxFileSize.
    See Also:
    UploadPolicy.getMaxFileSize()

    setMaxFileSize

    protected void setMaxFileSize(long maxFileSize)
    Parameters:
    maxFileSize - the maxFileSize to set

    getNbFilesPerRequest

    public int getNbFilesPerRequest()
    Description copied from interface: UploadPolicy
    This function returns the number of files should be uploaded during one access to the server. If negative or 0, all files are to be uploaded in one HTTP request. If positive, each HTTP upload contains this number of files. The last upload request may contain less files.
    Examples :

    Specified by:
    getNbFilesPerRequest in interface UploadPolicy
    Returns:
    Returns the maximum number of files, to download in one HTTP request.
    See Also:
    UploadPolicy.getNbFilesPerRequest()

    setNbFilesPerRequest

    protected void setNbFilesPerRequest(int nbFilesPerRequest)
                                 throws JUploadException
    Parameters:
    nbFilesPerRequest - the nbFilesPerRequest to set
    Throws:
    JUploadException

    getFilenameEncoding

    public String getFilenameEncoding()
    Description copied from interface: UploadPolicy
    Returns the encoding that should be used for the filename. This encoding has no impact on the content of the file that will be uploaded.

    Specified by:
    getFilenameEncoding in interface UploadPolicy
    Returns:
    The encoding name, like UTF-8 (see the Charset JDK documentation).
    See Also:
    UploadPolicy.getFilenameEncoding()

    setFilenameEncoding

    protected void setFilenameEncoding(String filenameEncoding)
    Parameters:
    filenameEncoding - the filenameEncoding to set

    getFtpCreateDirectoryStructure

    public boolean getFtpCreateDirectoryStructure()
    Description copied from interface: UploadPolicy
    Returns the current value for the ftpCreateDirectoryStructure applet parameter.

    Specified by:
    getFtpCreateDirectoryStructure in interface UploadPolicy
    Returns:
    The current value of ftpCreateDirectoryStructure
    See Also:
    UploadPolicy.getFtpCreateDirectoryStructure()

    setFtpCreateDirectoryStructure

    protected void setFtpCreateDirectoryStructure(boolean ftpCreateDirectoryStructure)
    Parameters:
    ftpCreateDirectoryStructure - the ftpCreateDirectoryStructure to set

    getFtpTransfertBinary

    public boolean getFtpTransfertBinary()
    Description copied from interface: UploadPolicy
    Returns the current value for the ftpTransfertBinary applet parameter.

    Specified by:
    getFtpTransfertBinary in interface UploadPolicy
    Returns:
    The current value of ftpTransfertBinary
    See Also:
    UploadPolicy.getFtpTransfertBinary()

    setFtpTransfertBinary

    protected void setFtpTransfertBinary(boolean ftpTransfertBinary)
    Parameters:
    ftpTransfertBinary - the ftpTransfertBinary to set

    getFtpTransfertPassive

    public boolean getFtpTransfertPassive()
    Description copied from interface: UploadPolicy
    Returns the current value for the ftpTransfertPassive applet parameter.

    Specified by:
    getFtpTransfertPassive in interface UploadPolicy
    Returns:
    The current value of ftpTransfertPassive
    See Also:
    UploadPolicy.getFtpTransfertPassive()

    setFtpTransfertPassive

    protected void setFtpTransfertPassive(boolean ftpTransfertPassive)
    Parameters:
    ftpTransfertPassive - the ftpTransfertPassive to set

    getPostURL

    public String getPostURL()
    Description copied from interface: UploadPolicy
    Get the target URL for upload.

    Specified by:
    getPostURL in interface UploadPolicy
    Returns:
    Should be valid URL...
    See Also:
    UploadPolicy.getPostURL()

    setPostURL

    public void setPostURL(String postURL)
                    throws JUploadException
    Description copied from interface: UploadPolicy
    The URL can change during the life of our policy ...

    Specified by:
    setPostURL in interface UploadPolicy
    Throws:
    JUploadException
    See Also:
    UploadPolicy.setPostURL(String)

    getReadCookieFromNavigator

    public boolean getReadCookieFromNavigator()
    Description copied from interface: UploadPolicy
    Return the current value of readCookieFromNavigator

    Specified by:
    getReadCookieFromNavigator in interface UploadPolicy
    Returns:
    Current value of readCookieFromNavigator
    See Also:
    UploadPolicy.getReadCookieFromNavigator()

    getReadUserAgentFromNavigator

    public boolean getReadUserAgentFromNavigator()
    Description copied from interface: UploadPolicy
    Return the current value of readUserAgentFromNavigator

    Specified by:
    getReadUserAgentFromNavigator in interface UploadPolicy
    Returns:
    Current value of readUserAgentFromNavigator
    See Also:
    UploadPolicy.getReadUserAgentFromNavigator()

    getServerProtocol

    public String getServerProtocol()
    Description copied from interface: UploadPolicy
    HTTP protocol that should be used to send the HTTP request. Currently, this is mainly used by CoppermineUploadPolicy, as the coppermine control that the protocol used for each HTTP request is the same as the one used during the session creation. It is used in the default policy, as it could be used elsewhere.
    Default is : HTTP/1.1

    Specified by:
    getServerProtocol in interface UploadPolicy
    Returns:
    The selected server protocol.
    See Also:
    UploadPolicy.getServerProtocol()

    setServerProtocol

    public void setServerProtocol(String serverProtocol)
    Specified by:
    setServerProtocol in interface UploadPolicy
    Parameters:
    serverProtocol - The protocol is set from the postURL. For HTTP URL, a HEAD request is done toward the server, to check if any temporary redirection is occuring.
    See Also:
    UploadPolicy.setServerProtocol(String)

    getShowLogWindow

    public String getShowLogWindow()
    Description copied from interface: UploadPolicy
    Indicate whether the log window should be shown. It may be convenient to hide it, as it contains mostly debug information. But it still is the only place where possible errors and warnings are shown.
    Default is : true

    Specified by:
    getShowLogWindow in interface UploadPolicy
    Returns:
    The current value for the showStatusBar applet parameter.
    See Also:
    UploadPolicy.getShowLogWindow()

    setShowLogWindow

    public void setShowLogWindow(String showLogWindow)

    Specified by:
    setShowLogWindow in interface UploadPolicy
    Parameters:
    showLogWindow - The show window status to set.
    See Also:
    UploadPolicy.getShowLogWindow()

    getSpecificHeaders

    public String getSpecificHeaders()
    Description copied from interface: UploadPolicy
    Returns the list of specific headers, that will be added to all HTTP request to the server.

    Specified by:
    getSpecificHeaders in interface UploadPolicy
    Returns:
    List of specific headers, with a \r\n at the end of each header.
    See Also:
    UploadPolicy.getSpecificHeaders()

    setSpecificHeaders

    protected void setSpecificHeaders(String specificHeaders)
    Set all specific headers defined in the specificHeaders applet parameter. This string is splitted, so that each header is added to the headers Vector. These headers are added to the headers list during applet initialization. There is currently no automatic way to remove the headers coming from specificHeaders, after initialization.

    Parameters:
    specificHeaders -

    getSslVerifyCert

    public int getSslVerifyCert()
    Description copied from interface: UploadPolicy
    Retrieves SSL verification mode.

    Specified by:
    getSslVerifyCert in interface UploadPolicy
    Returns:
    The current SSL verification mode.
    See Also:
    UploadPolicy.getSslVerifyCert()

    setSslVerifyCert

    protected void setSslVerifyCert(String mode)
                             throws JUploadException
    Throws:
    JUploadException

    setShowStatusbar

    protected void setShowStatusbar(boolean show)
    Parameters:
    show - the new showStatusbar value

    getStringUploadError

    public String getStringUploadError()
    Description copied from interface: UploadPolicy
    Retrieve the regular expression that will be tested against each line of the server answer. If one line matches this expression, that upload is marked as failed.

    Specified by:
    getStringUploadError in interface UploadPolicy
    Returns:
    The regular expression that must be run again each line of the http answer.
    See Also:
    UploadPolicy.getStringUploadError()

    getStringUploadSuccess

    public String getStringUploadSuccess()
    Description copied from interface: UploadPolicy
    Get the regular expression that will be tested against each line of the server answer. If one line matches this expression, that upload is marked as successful.
    The upload works this way:
    1. Upload the selected file(s) to the server
    2. Get all the server HTTP response.
    3. The stringUploadSuccess regular expression is tested against each line from the server.
    4. If the above test gives a match, the upload is marked as successful. Else, the upload is marked as unsuccessful, and a JUploadExceptionUploadFailure is thrown.

    Specified by:
    getStringUploadSuccess in interface UploadPolicy
    Returns:
    The regular expression that must be run again each line of the http answer.
    See Also:
    UploadPolicy.getStringUploadSuccess()

    getStringUploadWarning

    public String getStringUploadWarning()
    Description copied from interface: UploadPolicy
    Retrieve the regular expression that will be tested against each line of the server answer. If one line matches this expression, a warning message is displayed to the user.

    Specified by:
    getStringUploadWarning in interface UploadPolicy
    Returns:
    The regular expression that must be run again each line of the http answer.
    See Also:
    UploadPolicy.getStringUploadWarning()

    setStringUploadError

    protected void setStringUploadError(String stringUploadError)
                                 throws JUploadException
    Parameters:
    stringUploadError - the stringUploadError to set
    Throws:
    JUploadException

    setStringUploadSuccess

    protected void setStringUploadSuccess(String stringUploadSuccess)
                                   throws JUploadException
    Parameters:
    stringUploadSuccess - the stringUploadSuccess to set
    Throws:
    JUploadException

    setStringUploadWarning

    protected void setStringUploadWarning(String stringUploadWarning)
                                   throws JUploadException
    Parameters:
    stringUploadWarning - the stringUploadWarning to set
    Throws:
    JUploadException

    getUrlToSendErrorTo

    public String getUrlToSendErrorTo()
    Description copied from interface: UploadPolicy
    Returns the current URL where error log must be posted. See Parameters

    Specified by:
    getUrlToSendErrorTo in interface UploadPolicy
    Returns:
    the urlToSendErrorTo
    See Also:
    UploadPolicy.getUrlToSendErrorTo()

    setUrlToSendErrorTo

    public void setUrlToSendErrorTo(String urlToSendErrorTo)
                             throws JUploadException

    Specified by:
    setUrlToSendErrorTo in interface UploadPolicy
    Parameters:
    urlToSendErrorTo - the urlToSendErrorTo to set
    Throws:
    JUploadException

    getFormdata

    public String getFormdata()
    Description copied from interface: UploadPolicy
    Retrieve the applet's "formdata" parameter.

    Specified by:
    getFormdata in interface UploadPolicy
    Returns:
    The applet's formdata parameter.
    See Also:
    UploadPolicy.getFormdata()

    getAfterUploadTarget

    public String getAfterUploadTarget()
    Description copied from interface: UploadPolicy
    Return the target, specified as applet parameter "afterUploadTarget"

    Specified by:
    getAfterUploadTarget in interface UploadPolicy
    Returns:
    the specified target.
    See Also:
    UploadPolicy.getAfterUploadTarget()

    deleteLog

    public void deleteLog()
    Delete the current log. (called upon applet termination)


    addMsgToDebugLog

    protected void addMsgToDebugLog(String msg)
    This methods allows the applet to store all messages (debug, warning, info, errors...) into a StringBuffer. If any problem occurs, the whole output (displayed or not by the displayDebug, for instance) can be stored in a file, or sent to the webmaster. This can help to identify and correct problems that can occurs on the various computer configurations.

    Parameters:
    msg -

    afterFileDropped

    public void afterFileDropped(DropTargetDropEvent dropEvent)
    Default reaction after a successful drop operation: no action.

    Specified by:
    afterFileDropped in interface UploadPolicy
    Parameters:
    dropEvent - The event containing the dropped file
    See Also:
    UploadPolicy.afterFileDropped(DropTargetDropEvent)

    createFileChooser

    public JUploadFileChooser createFileChooser()
    Default implementation for UploadPolicy.createFileChooser(): just a creation of a JUploadFileChooser.

    Specified by:
    createFileChooser in interface UploadPolicy
    Returns:
    Return the specific file choose, according to this upload policy.
    See Also:
    UploadPolicy.createFileChooser()

    fileFilterAccept

    public boolean fileFilterAccept(File file)
    This method returns the response for the JUploadFileFilter.accept(File) which just calls this method. This method checks that the file extension corresponds to the allowedFileExtensions applet parameter.

    Specified by:
    fileFilterAccept in interface UploadPolicy
    Parameters:
    file - Allows the applet to filter files from the file chooser.
    Returns:
    true or false, whether the file is accepted or not.
    See Also:
    UploadPolicy.fileFilterAccept(File)

    fileFilterGetDescription

    public String fileFilterGetDescription()
    Description copied from interface: UploadPolicy
    Return a description for the FileFilter, according to the current upload policy.

    Specified by:
    fileFilterGetDescription in interface UploadPolicy
    Returns:
    A description for the current filter
    See Also:
    UploadPolicy.fileFilterGetDescription()

    fileViewGetIcon

    public Icon fileViewGetIcon(File file)
    Returns null: the default icon is used.

    Specified by:
    fileViewGetIcon in interface UploadPolicy
    Parameters:
    file - The file from which the icon should represent.
    Returns:
    The resulting icon.
    See Also:
    UploadPolicy.fileViewGetIcon(File)

    getLastException

    public JUploadException getLastException()
    Description copied from interface: UploadPolicy
    Indicates that an error occurs.

    Specified by:
    getLastException in interface UploadPolicy
    Returns:
    The last Exception that occurs in the applet. null if no exception occurs.
    See Also:
    UploadPolicy.getLastException()

    setLastException

    public void setLastException(JUploadException exception)
    Set the last exception.

    Parameters:
    exception - The last exception that occurs into the applet.

    getLastResponseBody

    public String getLastResponseBody()
    Description copied from interface: UploadPolicy
    Retrieve the body of the last server response.

    Specified by:
    getLastResponseBody in interface UploadPolicy
    Returns:
    The string containing the last server response (body);
    See Also:
    UploadPolicy.getLastResponseBody()

    getLastResponseMessage

    public String getLastResponseMessage()
    Description copied from interface: UploadPolicy
    Retrieve the status/error message of the last server response.

    Specified by:
    getLastResponseMessage in interface UploadPolicy
    Returns:
    The string containing either the last server status or (if the error regex matches, the parsed error message.
    See Also:
    UploadPolicy.getLastResponseMessage()

    setCursor

    public Cursor setCursor(Cursor cursor)
    Description copied from interface: UploadPolicy
    Changes the current mouse cursor. This method can be called at the end of a big treatement, to restore the cursor returned by the UploadPolicy.setWaitCursor().

    Specified by:
    setCursor in interface UploadPolicy
    Parameters:
    cursor - The cursor that must be set.
    Returns:
    The cursor that was active before setting the new one. Can be used to restore its previous state.
    See Also:
    UploadPolicy.setCursor(Cursor)

    setWaitCursor

    public Cursor setWaitCursor()
    Description copied from interface: UploadPolicy
    This method changes the current mouse cursor to the wait one. It returns the old one so that, it can be restored, once the work is done.

    Specified by:
    setWaitCursor in interface UploadPolicy
    Returns:
    The cursor that was active before setting the new one. Can be used to restore its previous state.
    See Also:
    UploadPolicy.setWaitCursor()