Coverage Report - wjhk.jupload2.policies.UploadPolicy
 
Classes in this File Line Coverage Branch Coverage Complexity
UploadPolicy
N/A
N/A
1
 
 1  
 //
 2  
 // $Id: UploadPolicy.java 287 2007-06-17 09:07:04 +0000 (dim., 17 juin 2007)
 3  
 // felfert $
 4  
 //
 5  
 // jupload - A file upload applet.
 6  
 // Copyright 2007 The JUpload Team
 7  
 //
 8  
 // Created: 2006-05-04
 9  
 // Creator: etienne_sf
 10  
 // Last modified: $Date: 2015-03-15 14:50:53 +0100 (dim., 15 mars 2015) $
 11  
 //
 12  
 // This program is free software; you can redistribute it and/or modify it under
 13  
 // the terms of the GNU General Public License as published by the Free Software
 14  
 // Foundation; either version 2 of the License, or (at your option) any later
 15  
 // version. This program is distributed in the hope that it will be useful, but
 16  
 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 17  
 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 18  
 // details. You should have received a copy of the GNU General Public License
 19  
 // along with this program; if not, write to the Free Software Foundation, Inc.,
 20  
 // 675 Mass Ave, Cambridge, MA 02139, USA.
 21  
 
 22  
 package wjhk.jupload2.policies;
 23  
 
 24  
 import java.awt.Cursor;
 25  
 import java.awt.dnd.DropTargetDropEvent;
 26  
 import java.io.File;
 27  
 import java.util.Locale;
 28  
 
 29  
 import javax.swing.Icon;
 30  
 import javax.swing.JButton;
 31  
 import javax.swing.JLabel;
 32  
 import javax.swing.JOptionPane;
 33  
 import javax.swing.JPanel;
 34  
 import javax.swing.JProgressBar;
 35  
 import javax.swing.filechooser.FileFilter;
 36  
 
 37  
 import wjhk.jupload2.context.JUploadContext;
 38  
 import wjhk.jupload2.exception.JUploadException;
 39  
 import wjhk.jupload2.exception.JUploadExceptionStopAddingFiles;
 40  
 import wjhk.jupload2.exception.JUploadIOException;
 41  
 import wjhk.jupload2.filedata.FileData;
 42  
 import wjhk.jupload2.gui.JUploadFileChooser;
 43  
 import wjhk.jupload2.gui.JUploadFileFilter;
 44  
 import wjhk.jupload2.gui.JUploadFileView;
 45  
 import wjhk.jupload2.gui.JUploadPanel;
 46  
 import wjhk.jupload2.gui.filepanel.FilePanel;
 47  
 import wjhk.jupload2.gui.image.PictureDialog;
 48  
 import wjhk.jupload2.upload.helper.ByteArrayEncoder;
 49  
 
 50  
 /**
 51  
  * This package contains upload policies, which allow easy configuration of the applet behavior. <br>
 52  
  * <br>
 53  
  * The class {@link DefaultUploadPolicy} contains a default implementation for all UploadPolicy methods. <br>
 54  
  * <br>
 55  
  * <h4><a name="parameters">Parameters</a></h4> <!-- ATTENTION: The following comment is used by Ant build. DO NOT
 56  
  * CHANGE!! --> <!-- ANT_COPYDOC_START -->
 57  
  * <p>
 58  
  * Here is the list of all parameters available in the current package, that is: available in available upload policies.
 59  
  * These are applet parameters that can be 'given' to the applet, with <PARAM> tags, as explained below in the <a
 60  
  * href="#example">example</a>.
 61  
  * </p>
 62  
  * <P>
 63  
  * Let's start with some hints: <DIR>
 64  
  * <LI><A href="debugLevel">debugLevel</A> and <A href="showLogWindow">showLogWindow</A>: I recommend putting debugLevel
 65  
  * to 99 and showLogWindow to onError.
 66  
  * <LI><A href="maxFileSize">maxFileSize</A>: this prevents the user to upload too big files. The value depends on your
 67  
  * needs.
 68  
  * <LI><A href="#maxChunkSize">maxChunkSize</A>: allows you to override the server's maximum upload file size. The
 69  
  * uploaded file will be split in pieces of maxChunkSize bytes. Then, it's up to you to concatenate the file pieces,
 70  
  * into a server script. There are sample in this doc, and in the JUpload wiki. Please add your samples also...</DIR>
 71  
  * </P>
 72  
  * <table border="1">
 73  
  * <tr>
 74  
  * <th>Parameter name</th>
 75  
  * <th>Default value / <br>
 76  
  * Implemented in</th>
 77  
  * <th>Description</th>
 78  
  * </tr>
 79  
  * <tr>
 80  
  * <td>afterUploadTarget<br>
 81  
  * Since 2.9.2rc4</td>
 82  
  * <td>_self<br>
 83  
  * <br>
 84  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 85  
  * <td>This parameter allows to select a specific target frame when redirecting to <code>afterUploadURL</code>. The
 86  
  * following values are possible:<br>
 87  
  * <ul>
 88  
  * <li><code>_self</code> - Show in the window and frame that contain the applet.</li>
 89  
  * <li><code>_parent</code> - Show in the applet's parent frame. If the applet's frame has no parent frame, acts the
 90  
  * same as <i>_self</i>.</li>
 91  
  * <li><code>_top</code> - Show in the top-level frame of the applet's window. If the applet's frame is the top-level
 92  
  * frame, acts the same as <i>_self</i>.</li>
 93  
  * <li><code>_blank</code> - Show in a new, unnamed top-level window.
 94  
  * <li><i>name</i> - Show in the frame or window named <i>name</i>. If a target named <i>name</i> does not already
 95  
  * exist, a new top-level window with the specified name is created, and the document is shown there.</li>
 96  
  * </ul>
 97  
  * See also: {@link java.applet.AppletContext#showDocument(java.net.URL, java.lang.String)}</td>
 98  
  * </tr>
 99  
  * <tr>
 100  
  * <td>afterUploadURL</td>
 101  
  * <td><i>null</i><br>
 102  
  * since 2.9.0<br>
 103  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 104  
  * <td>This parameter is used by all policies. It allows the applet to change the current page to another one after a
 105  
  * successful upload. <br>
 106  
  * This allows, for instance, to display a page containing the file description of the newly uploaded page. Since
 107  
  * version 3.0.2b2, you can specify a JavaScript expression instead of a plain URL. So afterUploadURL can now contain:<br>
 108  
  * <UL>
 109  
  * <LI><B>A javascript expression</B>: The URL must start by <I>javascript:</I>. See below for details.</LI>
 110  
  * <LI><B>A http URL</B>: the navigator will open this URL, in the current page or another, according to the
 111  
  * <I>afterUploadTarget</I> parameter. Any URL that doesn't start by <I>javascript:</I> is handled as an http URL.</LI>
 112  
  * </UL>
 113  
  * If the value of afterUploadURL starts with the string "javascript:", the remainder of the string is evaluated as
 114  
  * JavaScript expression in the current document context. For example: If afterUloadURL is<br>
 115  
  * <code>"javascript:alert('Thanks for the upload');"</code>,</br> then after a successful upload, a messagebox would
 116  
  * pop up. Since 3.0.2b3 there are now three place holders available which can be used as parameters in function calls:
 117  
  * <ul>
 118  
  * <li><code>%success%</code> is replaced by <b>true</b> or <b>false</b> depending on upload success.
 119  
  * <li><code>%msg%</code> is replaced by an unquoted string, containing the error message received from the server (if
 120  
  * any). Inside that string, all occurrences of the single-quote character (hex 27) are quoted by backslashes.
 121  
  * <li><code>%body%</code> is replaced by an unquoted string, containing the complete response body. Inside that string,
 122  
  * all occurrences of the single-quote character (hex 27) are quoted by backslashes.
 123  
  * </ul>
 124  
  * So if you set afterUloadURL to <code>"javascript:alert('%body%');"</code>, then the resulting message box will show
 125  
  * the body content of the last server response.</td>
 126  
  * </tr>
 127  
  * <tr>
 128  
  * <td>albumId</td>
 129  
  * <td>-1 <br>
 130  
  * <br>
 131  
  * {@link wjhk.jupload2.policies.CoppermineUploadPolicy}</td>
 132  
  * <td>This parameter is only used by CoppermineUploadPolicy. So it is to be used to upload into a <a
 133  
  * href="http://coppermine.sourceforge.net/">coppermine picture gallery</a>. This parameter contains the identifier of
 134  
  * the album, where pictures should be used. See CoppermineUploadPolicy for an example. <br>
 135  
  * Before upload, CoppermineUploadPolicy. {@link wjhk.jupload2.policies.CoppermineUploadPolicy#beforeUpload()} checks
 136  
  * that the albumId is correct, that is: >=1.</td>
 137  
  * </tr>
 138  
  * <tr>
 139  
  * <td>allowedFileExtensions</td>
 140  
  * <td><i>empty string</i><br>
 141  
  * since 2.9.0<br>
 142  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 143  
  * <td>This parameter allows the caller to specify a list of file extension. If this parameter is specified, only file
 144  
  * with this extension can be selected in the applet.<br>
 145  
  * This parameter must contains a list of extensions, in lower case, separated by slashes. eg: jpg/jpeg/gif</td>
 146  
  * </tr>
 147  
  * <tr>
 148  
  * <td>allowHttpPersistent</td>
 149  
  * <td><i>false</i><br>
 150  
  * since 3.0.0rc1<br>
 151  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 152  
  * <td>This parameter allows to switch off persistent HTTP connections which are enabled by default (and the protocol
 153  
  * version allows it). Currently, we encountered problems with persistent connections when testing on a windows box
 154  
  * using a loopback interface only. <BR>
 155  
  * Note: default value changed to false in 4.0 version.</td>
 156  
  * </tr>
 157  
  * <tr>
 158  
  * <td>browsingDirectory</td>
 159  
  * <td><i>null</i><br>
 160  
  * since 4.0.0b2<br>
 161  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 162  
  * <td>This parameter allows to control the starting browsing directory, that is, the directory the is the current one
 163  
  * when the file chooser is open.<BR>
 164  
  * <U>Notes:</U> <DIR>
 165  
  * <UL>
 166  
  * If the directory doesn't exist, or can not be read, a warning is written on the local log window (visible only in
 167  
  * debug mode), and this parameter is ignored.
 168  
  * <UL>
 169  
  * This directory may begin with ~/ or ~\, to have a path set relative to the current user's home.</DIR></td>
 170  
  * </tr>
 171  
  * <tr>
 172  
  * <td>debugLevel</td>
 173  
  * <td>0 <br>
 174  
  * <br>
 175  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 176  
  * <td>With 0, you get the normal production output. The higher the number is, the more information is displayed in the
 177  
  * log window. Here are some hints about debug level values (please note that this is indicative ... including for me,
 178  
  * as I'me writing this during 3.3.2 release: <DIR>
 179  
  * <LI>0: No debug output. Only INFO and ERROR
 180  
  * <LI>10: Structural debug output (entering method, exception info...)
 181  
  * <LI>30: Details about method parameters
 182  
  * <LI>50: Details about internal method variables.
 183  
  * <LI>70: Details about encoding toward the server
 184  
  * <LI>80: Details about server's response
 185  
  * <LI>90: Details about query and server response when sending debug output to urlToSendErrorTo
 186  
  * <LI>100: Maximum output information level. The redirection toward afterUploadURL is blocked
 187  
  * <LI>>100: Additional things for internal debug, like some wait in the code to check what messages the applet
 188  
  * displays, while uploading small files on localhost.</DIR> <br>
 189  
  * Note: All debug messages are stored in a temporary log file. This can be used to display more information, if needed.
 190  
  * See also the <I>urlToSendErrorTo</I> applet parameter.</td>
 191  
  * </tr>
 192  
  * <tr>
 193  
  * <td>fileChooserIconFromFileContent</td>
 194  
  * <td><i>0</i><br>
 195  
  * since 3.1.0b<br>
 196  
  * {@link wjhk.jupload2.policies.UploadPolicy}</td>
 197  
  * <td>This parameter allows to control whether the file icons in the file chooser are calculated from the file content.
 198  
  * This is currently only available for pictures.<BR>
 199  
  * If activated, the file chooser will open each pictures, and calculate the icon by resizing the picture. This is done
 200  
  * in by using thread of minimam priority, to minimize performances impact on the navigator. Available values are: <DIR>
 201  
  * <LI>-1: disabled. The default system are used.
 202  
  * <LI>0 (default): available only in picture mode. That is: the current upload policy is an instance of or a class
 203  
  * inheriting from {@link PictureUploadPolicy}
 204  
  * <LI>1: available for all upload policies. </DIR></td>
 205  
  * </tr>
 206  
  * <tr>
 207  
  * <td>fileChooserIconSize</td>
 208  
  * <td><i>20</i><br>
 209  
  * since 3.1.0b<br>
 210  
  * {@link wjhk.jupload2.policies.UploadPolicy}</td>
 211  
  * <td>This parameter allows to control the size of icons, in pixels, in the file chooser. Used only when
 212  
  * fileChooserIconFromFileContent is activated.<BR>
 213  
  * Note: The standard icon size is a value of 20. With 50, you'll get a better view of the picture.</td>
 214  
  * </tr>
 215  
  * <tr>
 216  
  * <td>fileChooserImagePreview</td>
 217  
  * <td><i>true</i><br>
 218  
  * since 3.1.0b<br>
 219  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}</td>
 220  
  * <td>This parameter allows to control whether an preview is available for picture in the file chooser. If activated,
 221  
  * the file chooser will open the preview in a separate thread, of high priority. This avoid blocking the applet while
 222  
  * calculating the preview picture, when the user just double-clicked a picture file. This parameter is ignored for
 223  
  * DefaultUploadPolicy.
 224  
  * </tr>
 225  
  * <tr>
 226  
  * <tr>
 227  
  * <td>fileFilterName</td>
 228  
  * <td><i>null</i><br>
 229  
  * since 5.0.0</td> Contains the name of the file filter, as it will be displayed in the drop down list of filters, in
 230  
  * the file chooser. If this name is given to the applet, it will be returned by the {@link FileFilter#getDescription()}
 231  
  * method. <BR>
 232  
  * Default value for applet parameter "fileFilterName". This default value let the {@link DefaultUploadPolicy} return a
 233  
  * calculated name, which contains the list of allowed file extensions.<BR>
 234  
  * Note: this parameter is ignored, if there is no file filter, that is, if the allowedFileExtensions applet parameter
 235  
  * is not used.
 236  
  * <td>
 237  
  * </tr>
 238  
  * <tr>
 239  
  * <td>fileListViewMode</td>
 240  
  * <td><i>flat mode</i><br/>
 241  
  * Since 6.0.0 <br/>
 242  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 243  
  * <td>This parameter can take these values:
 244  
  * <UL>
 245  
  * <LI><B>flat</B>: (all files are listed in a standard table)</LI>
 246  
  * <LI><B>tree_view</B>: in this mode (new in 6.0.0), the file hierarchy is displayed as it will be uploaded. The data
 247  
  * structure maps to File System mode. That is: the shown hierarchy is a part of the local file system. The root of the
 248  
  * hierarchy (visible root) is the common root to to all files and folder. It is actually a <B>hierarchical view of the
 249  
  * FLAT view</B>, using the same data structure. Only the display changes.<BR/>
 250  
  * For instance, if /tmp/f1/f2/file.txt and /tmp/f1/f11/file.txt have been added, /tmp/f1 is the common root. So this
 251  
  * mode displays: f2 and f11 as the first visible hierarchy level. f2 contains file.txt, and f11 also contains a
 252  
  * file.txt file.</LI>
 253  
  * <LI><B>independent_tree_view</B>: In independent tree view mode, each added file/folder is added to the root. This
 254  
  * root is the root that will be sent to the server, during the upload.<BR/>
 255  
  * For instance, if /tmp/f1/f2/file.txt and /tmp/f1/f11/file.txt have been both added, then, two file.txt (coming from
 256  
  * different folders, so they are actually different files with the same name) are attached to the hierarchical view.<BR/>
 257  
  * If if /tmp/f1 is added, then: f1 is attached to the root. And the hierarchy will contain: f1, f2 as a subfolder of
 258  
  * f1, file.txt as a file in f2.</LI>
 259  
  * </UL>
 260  
  * </td>
 261  
  * </tr>
 262  
  * <tr>
 263  
  * <td><s>filenameEncoding</s></td>
 264  
  * <td><S><i>null</i></S><br>
 265  
  * <br>
 266  
  * <S>{@link wjhk.jupload2.policies.DefaultUploadPolicy}</S></td>
 267  
  * <td>Since 3.3.0, this parameter is no more used. The full applet upload HTTP request to the server is now correctly
 268  
  * encoded.<BR>
 269  
  * <S>With null, the filename in the <i>Content-Disposition</i> header is not encoded. If not null, the applet tries to
 270  
  * encode this filename with the given encoding. It's up to the receiver (the web site) to decode this encoding (see
 271  
  * {@link #getUploadFilename(FileData, int)}. <br>
 272  
  * Example: if the "UTF8" encoding is chosen, the PHP function urldecode can be used to decode the filename. </S></td>
 273  
  * </tr>
 274  
  * <tr>
 275  
  * <tr>
 276  
  * <td>formdata</td>
 277  
  * <td><i>null</i><br>
 278  
  * <br>
 279  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}<br>
 280  
  * <i>Since 2.9.2rc4</i></td>
 281  
  * <td>With this parameter, the name of a HTML form can be specified. If the specified form exists in the same document
 282  
  * like the applet, all all form-variables are added as POST parameters to the applet's POST request.<BR>
 283  
  * <B>Note:</B> Whatever value is in the <U>httpUploadParameterType</U> applet parameter, these parameters with the name
 284  
  * of the given input in the form. That is: if you have an input text named 'myText', there will be one myText parameter
 285  
  * in the HTTP upload request, with the text/plain mime type, and whose value is the content of this field, in the form.
 286  
  * </td>
 287  
  * </tr>
 288  
  * <tr>
 289  
  * <td>ftpCreateDirectoryStructure</td>
 290  
  * <td><i>false</i><br>
 291  
  * since 4.2.0<br>
 292  
  * {@link wjhk.jupload2.policies.UploadPolicy}</td>
 293  
  * <td>This parameter allows to control whether the directory structure on the client side must be created on the server
 294  
  * side.<BR>
 295  
  * Example: if the user upload the test/ directory, which contains the readme.txt file. With
 296  
  * <I>ftpCreateDirectoryStructure</I> to false (or default value), the readme.txt is uploaded in the postURL directory.
 297  
  * If set to true, the test/ folder is created as a subfolder of the path given in the postURL directory, and the
 298  
  * readme.txt is uploaded in this subfolder.<BR>
 299  
  * Note: in HTTP upload, the pathinfo and relpathinfo allows the server side script to manage this directory structure.</td>
 300  
  * </tr>
 301  
  * <tr>
 302  
  * <td>ftpTransfertBinary</td>
 303  
  * <td><i>true</i><br>
 304  
  * since 4.1.0<br>
 305  
  * {@link wjhk.jupload2.policies.UploadPolicy}</td>
 306  
  * <td>This parameter allows to control whether the upload should be done in binary or ascii mode. Default is to upload
 307  
  * in binary mode.</td>
 308  
  * </tr>
 309  
  * <tr>
 310  
  * <td>ftpTransfertPassive</td>
 311  
  * <td><i>true</i><br>
 312  
  * since 4.1.0<br>
 313  
  * {@link wjhk.jupload2.policies.UploadPolicy}</td>
 314  
  * <td>This parameter allows to control whether the upload should be done in FTP passive mode, or in active mode (where
 315  
  * the FTP server opens a connection to the client, to do the upload). Default passive mode.</td>
 316  
  * </tr>
 317  
  * <tr>
 318  
  * <td>highQualityPreview</td>
 319  
  * <td>false<br>
 320  
  * <br>
 321  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 322  
  * <td>If this parameter is set to <i>true</i>, the applet will call the BufferedImage.getScaledInstance(), instead of
 323  
  * doing a basic scale transformation. This consume more CPU: on a PII 500MHz, the full screen go from around 5 seconds
 324  
  * to between 12 and 20 seconds, for a picture created by my EOS20D (8,5M pixels). The standard preview (above the file
 325  
  * list) seem to be displayed at the same speed, whatever is the value of this parameter. <br>
 326  
  * Note: when resizing is done before upload, the BufferedImage.getScaledInstance() is always called, so that the
 327  
  * uploaded picture is of the best available quality.</td>
 328  
  * </tr>
 329  
  * <tr>
 330  
  * <td>httpUploadParameterName</td>
 331  
  * <td>File<br>
 332  
  * <br>
 333  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}<BR>
 334  
  * since 4.5.0</td>
 335  
  * <td>Contains the parameter name, that will be used to send the file in the HTTP upload request. The default value
 336  
  * (File), associated with the default value for httpUploadParameterType (see below), makes all file be uploaded with
 337  
  * name from File0 to FileN (when there are N+1 file to upload).<BR>
 338  
  * Put another value, of your server part script need a particular parameter name to work properly.<BR>
 339  
  * Note: valid characters for this parameter are: first letter (letter or number), next letters (letter, number or
 340  
  * underscore)</td>
 341  
  * </tr>
 342  
  * <tr>
 343  
  * <td>httpUploadParameterType</td>
 344  
  * <td>iteration<br>
 345  
  * <br>
 346  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}<BR>
 347  
  * since 4.5.0</td>
 348  
  * <td>Allowed values are: <DIR>
 349  
  * <LI><B>iteration</B>: Used to have the attribute property that actually contains the file be named File0 to FileN (if
 350  
  * you have N+1 uploaded files). This is the default behavior. In this case, your server script should look for POST
 351  
  * properties, named 'File0' to 'FileN'</LI>
 352  
  * <LI><B>array</B>: Used if your server script want to receive one array, that will contain all uploaded files.</LI>
 353  
  * <LI><B>oneFile</B>: Indicates that, in the HTTP upload request, there will be only one file. This value is only valid
 354  
  * when nbFilesPerRequest is 1. The parameters in the HTTP upload request are let untransformed. For instance, if
 355  
  * httpUploadParameterName is the default value (File), the file content will be loaded under the HTTP parameter 'File'
 356  
  * (not File0 or File[]).</LI></DIR><BR>
 357  
  * <B>Note:</B> All parameters common to all pictures are sent directly. For instance, if toto is given on the URL, the
 358  
  * toto parameter is sent as is (no toto0 for iteration or toto[] for array). Also, if you use the <U>formdata</U>
 359  
  * applet parameter, these parameters are sent as is (no 0 or [] added to the parameter name).</td>
 360  
  * </tr>
 361  
  * <tr>
 362  
  * <td>keepOriginalFileExtensionForConvertedImages</td>
 363  
  * <td><i>false</i></td>
 364  
  * <td>is only relevant, if targetPictureFormat is specified.<br />
 365  
  * <ul>
 366  
  * <li>false (default): <br />
 367  
  * If you upload the file 'test.png' and it is converted to 'jpg', the fileextension will be changed, so that the server
 368  
  * will receive this filename: 'test.jpg'</li>
 369  
  * <li>true: <br />
 370  
  * If you upload the file 'test.png' and it is converted to 'jpg', the fileextension will NOT be changed, so that the
 371  
  * server will receive the original filename: 'test.png'</li>
 372  
  * </ul>
 373  
  * </td>
 374  
  * </tr>
 375  
  * <tr>
 376  
  * <td>lang</td>
 377  
  * <td>Navigator language <br>
 378  
  * <br>
 379  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 380  
  * <td>Should be something like <i>en</i>, <i>fr</i>... Currently only French and English are known from the applet. If
 381  
  * anyone want to add another language ... Please translate the wjhk.jupload2.lang.lang_en, and send it back to
 382  
  * <mailto:etienne_sf@sourceforge.net">.</td>
 383  
  * </tr>
 384  
  * <tr>
 385  
  * <td>lookAndFeel <br>
 386  
  * since 2.5</td>
 387  
  * <td><i>empty</i><br>
 388  
  * <br>
 389  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 390  
  * <td>This allows to control the look &amp; feel of the applet. The authorized values are:
 391  
  * <ul>
 392  
  * <li><i>empty</i>: uses the default look &amp; feel. This is the same as java.
 393  
  * <li>java: uses the java default look &amp; feel. Same as <i>empty</i>.
 394  
  * <li>system: uses the current system look and feel. The call will be : <br>
 395  
  * UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
 396  
  * <li>Any valid String argument for UIManager.setLookAndFeel(String).
 397  
  * </ul>
 398  
  * </td>
 399  
  * </tr>
 400  
  * <tr>
 401  
  * <td>maxChunkSize<br>
 402  
  * Since 2.7.1</td>
 403  
  * <td>0<br>
 404  
  * <i>Long.MAX_VALUE</i><br>
 405  
  * <br>
 406  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 407  
  * <td>This parameters defines the maximum size of an upload.
 408  
  * <ul>
 409  
  * <li>If not set, or set to a value of 0 or less, the chunk mode is disabled. That is: each file will be uploaded
 410  
  * within being split in pieces.
 411  
  * <li>If set to a value of 1 or more, the upload size will be never be more than maxChunkSize. A file bigger will be
 412  
  * split in several part of <i>maxChunkSize</i> size, then the last part will contain the remaining, and will probably
 413  
  * be smaller than <i>maxChunkSize</i>.
 414  
  * </ul>
 415  
  * <br>
 416  
  * <b>How to build the server part:</b> the server will have to 'guess' that the file is split, and then it will have to
 417  
  * reconstruct the uploaded file. Here are the necessary informations:
 418  
  * <ul>
 419  
  * <li>When a file is chunked, the <i>jupart</i> and <i>jufinal</i> parameter are given in the URL (get parameters).
 420  
  * This identify a chunk upload. If these parameters are not given, the file(s) is(are) uploaded in one piece.
 421  
  * <li><i>jupart</i> identify the part number: from 1 to N for a file being split in N pieces. The N-1 chunks should be
 422  
  * <i>maxChunkSize</i> bytes long. The last one contains the remaining of the file.
 423  
  * <li><i>jufinal</i> is set to 0 for chunks from 1 to N-1. It is is set to 1 only for the last chunk (N, in this
 424  
  * 'example').
 425  
  * <li>The uploaded filename is not modified when the upload is chunked. Example: upload of the file
 426  
  * <i>bigPicture.jpeg</i>, of 4,5 Mb, with chunk of 2Mb. The upload is split in three chunk. Chunk 1 and 2 are 2Mb long.
 427  
  * The third one is 0,5Mb long. The uploaded filename for these three uploads is <i>bigPicture.jpeg</i>. It's up to the
 428  
  * server part to read the <i>jupart</i> and <i>jufinal</i> get parameters, to understand that the upload is chunked.
 429  
  * <li><b>Important:</b> The server script <u>must</u> check the resulting filesize. If not, the client can send a file
 430  
  * of any size, and fill the server hard drive.
 431  
  * <li>The site:samples.java/parseRequest.jsp is a java example of a server page that can receive chunk upload. It
 432  
  * stores each chunk is <i>filename.partN</i> (where N is the chunk number), then construct the final file, by
 433  
  * concatenating all parts together.
 434  
  * </ul>
 435  
  * <b>Note: </b> If nbFilesPerRequest is different than 1, the applet will try to upload the files until the sum of
 436  
  * their content length is less than maxChunkSize. The upload is triggered just before the sum of their content length
 437  
  * is bigger then maxChunkSize.<br>
 438  
  * If one file is bigger than <i>maxChunkSize</i>, all previous files are uploaded (at once or not, depending on
 439  
  * nbFilesPerRequest). Then the 'big' file is uploaded alone, split in chunk. Then upload goes on, file by file or not,
 440  
  * depending on <i>nbFilesPerRequest</i>.</td>
 441  
  * </tr>
 442  
  * <tr>
 443  
  * <td>maxFileSize<br>
 444  
  * Since 2.7.1</td>
 445  
  * <td>0<br>
 446  
  * <i>Long.MAX_VALUE</i><br>
 447  
  * <br>
 448  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 449  
  * <td>This parameter identify the maximum size that an uploaded file may have. It prevent the user to upload too big
 450  
  * files. It is especially important when chunk upload is activated (see below <i>maxChunkSize</i>).
 451  
  * <ul>
 452  
  * <li>If <i>maxChunkSize</i> is not set, negative or 0, <i>maxFileSize</i> should be the maximum upload size of the
 453  
  * server. In this case, it is useful only to display a message when the user select a file that will be refused by the
 454  
  * server.
 455  
  * <li>If chunk upload is activated, this parameter becomes really important: in this case the maximum file size of an
 456  
  * uploaded file is ... the available space on the server hard drive! (see below, <i>maxChunkSize</i>).
 457  
  * </ul>
 458  
  * </td>
 459  
  * </tr>
 460  
  * <tr>
 461  
  * <td>maxPicHeight</td>
 462  
  * <td>Since 3.3.0: Integer.MAX_VALUE<BR>
 463  
  * (was -1)<br>
 464  
  * <br>
 465  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}</td>
 466  
  * <td>This parameters allows the HTML page to control the maximum height for pictures. If a picture is to be download,
 467  
  * and its height is bigger, the picture will be resized. The proportion between width and height of the resized picture
 468  
  * are the same as those of the original picture. If both maxPicHeight and maxPicWidth are given, it can happen that the
 469  
  * resized picture has a height lesser than maxPicHeight, so that width is no more than maxPicWidth. <br>
 470  
  * <b>Precisions:</b> <br>
 471  
  * If this parameter value is negative or 0, then no control is done on the picture height. <br>
 472  
  * If the original picture is smaller than the maximum size, the picture is not enlarged. <br>
 473  
  * If the picture is resized, its other characteristics are kept (number of colors, ColorModel...). The picture format
 474  
  * is kept, if targetPictureFormat is empty. If the picture format is a destructive (like jpeg), the maximum available
 475  
  * quality is chosen. <br>
 476  
  * <i>See also maxPicWidth, realMaxPicHeight</i></td>
 477  
  * </tr>
 478  
  * <tr>
 479  
  * <td>maxPicWidth</td>
 480  
  * <td>Since 3.3.0: Integer.MAX_VALUE<BR>
 481  
  * (was -1)<br>
 482  
  * <br>
 483  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}</td>
 484  
  * <td>Same as maxPicHeight, but for the maximum width of the uploaded picture. <br>
 485  
  * <i>See also maxPicHeight, realMaxPicWidth</i></td>
 486  
  * </tr>
 487  
  * <tr>
 488  
  * <td>nbFilesPerRequest</td>
 489  
  * <td>1 since 4.3.0 <BR>
 490  
  * (was -1) <br>
 491  
  * <br>
 492  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 493  
  * <td>This allows the control of the maximal number of files that are uploaded in one HTTP upload to the server. <br>
 494  
  * If set to less than 1 (0 or negative), there is no maximum. This means that all files are uploaded in the same HTTP
 495  
  * request. <br>
 496  
  * If set to 5, for instance, and there are 6 files to upload, there will be two HTTP upload request to the server : 5
 497  
  * files in the first one, and that last file in a second HTTP request.</td>
 498  
  * </tr>
 499  
  * <tr>
 500  
  * <td>pictureCompressionQuality</td>
 501  
  * <td><i>0.8</i><br>
 502  
  * since 3.1.0<br>
 503  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}</td>
 504  
  * <td>This parameter controls the picture compression quality, when writing the picture file. 1 means high quality
 505  
  * picture, but big files. 0 means poor quality pictures, but small files. 0.8 is a good compromise for the web.<br>
 506  
  * It is different from the highQualityPreview, which controls the way picture are resized in memory.<br>
 507  
  * This parameter is currently applied only to jpg (and jpeg) pictures.</td>
 508  
  * </tr>
 509  
  * <tr>
 510  
  * <td>pictureTransmitMetadata</td>
 511  
  * <td><i>false since 3.3.0<br>
 512  
  * (was true before)</i><br>
 513  
  * since 3.2.0<br>
 514  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}</td>
 515  
  * <td>This parameter controls whether the applet transmit metadata of the original picture. This may prevent personal
 516  
  * information to be thrown on the net.<br>
 517  
  * Note 1: This parameter is especially important for picture coming from the Canon EOS 20D, 30D and 40D: pictures
 518  
  * shooted in portrait mode contain metadata that are incompatible with Java 1.6.0_3! The colors of transformed pictures
 519  
  * become strange... <B>Since 3.3.0: default to false</B>, to avoid this annonying (and currently not explained)
 520  
  * problem.<br>
 521  
  * Note 2: <Caution> As of 3.2.0, this parameter blocks metadata only for pictures that are updated by the applet.
 522  
  * Metadata from picture transmitted 'as is' are not removed. This is corrected in 3.3.0.</td>
 523  
  * </tr>
 524  
  * <tr>
 525  
  * <td>postURL</td>
 526  
  * <td>null since 1.9.2rc4, (was <i>Mandatory</i> before)<br>
 527  
  * <br>
 528  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 529  
  * <td>This parameter specifies the target URL toward which the files should be uploaded. Since version 1.9.2rc4 this
 530  
  * parameter is not mandatory anymore. Instead, if omitted or a <i>relative</i> URL is given, the resulting URL is
 531  
  * constructed from the applet's DocumentBaseURL. This means, that if the applet tag is dynamically constructed from a
 532  
  * PHP script without specifying <code>postURL</code>, the <i>same</i> same script receives the subsequent POST
 533  
  * request(s). If this URL may change during the applet execution time, you can call the setProperty applet method from
 534  
  * javascript, or create a new UploadPolicy class and either :
 535  
  * <ul>
 536  
  * <li>Override the {@link wjhk.jupload2.policies.UploadPolicy#getPostURL()} method, to make the postURL totaly dynamic.
 537  
  * <li>Override the {@link wjhk.jupload2.policies.UploadPolicy#setPostURL(String)} method, to modify the postURL on the
 538  
  * fly, when it is changed.
 539  
  * <li>Override the {@link wjhk.jupload2.policies.UploadPolicy#setProperty(String, String)} method. The
 540  
  * {@link wjhk.jupload2.policies.CoppermineUploadPolicy} changes the postURL when the albumID property changes.
 541  
  * <li>Find another solution ...
 542  
  * </ul>
 543  
  * <u>Note 1:</u> in HTTP, the upload is done in the same user session, as the applet uses the cookies from the
 544  
  * navigator. This allows right management during upload, on the server side.<br>
 545  
  * <u>Note 2:</u> in FTP, you can't use path that contain spaces. Filename may contain spaces. <u>Note 5:</u> in HTTP,
 546  
  * the applet use the current Java parameter to connect to the host. By default, this configuration is to use the
 547  
  * navigator configuration. So, if a proxy is configured in the navigator network configuration, the applet should use
 548  
  * it automatically.<br>
 549  
  * <u>Note 3:</u> FTP URL should looks like: ftp://username:password@myhost.com:21/directory<br>
 550  
  * <u>Note 4:</u> in FTP, you'll have to add the jakarta-commons-oro.jar and jakarta-commons-net.jar jar files in the
 551  
  * applet ARCHIVE tag attribute. See the 'advanced_js_demo.html page for a sample. You'll have to put the two files
 552  
  * coming from the JUpload distribution in the same directory as the wjhk.jupload.jar. <br>
 553  
  * <u>Note 5:</u> in FTP, you can use the user default folder by putting no folder. The URL can be: ftp://user:mdp@host</td>
 554  
  * <u>Note 6 (security):</u> take care that the full URL is visible, if the user take a look at the page source. So, you
 555  
  * should take care when putting login and password there. </td>
 556  
  * </tr>
 557  
  * <tr>
 558  
  * <td>readCookieFromNavigator</td>
 559  
  * <td>Since 4.3.0: Boolean<BR>
 560  
  * (true)<br>
 561  
  * <br>
 562  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}<br>
 563  
  * <i>Since v2.8.1</i></td>
 564  
  * <td>If true (default), the applet read cookies from the navigator, with the javascript document.cookie value. If
 565  
  * false, the caller should put the relevant 'Cookie' header in the specificHeaders applet parameter. This allows to
 566  
  * override any javascript cookie access restriction.</td>
 567  
  * </tr>
 568  
  * <td>readUserAgentFromNavigator</td>
 569  
  * <td>Since 4.6.1rc2: Boolean<BR>
 570  
  * (true)<br>
 571  
  * <br>
 572  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}<br>
 573  
  * </td>
 574  
  * <td>If true (default), the applet read the userAgent from the navigator, with the javascript document.userAgent
 575  
  * value. If false, the caller can put the relevant userAgent header in the specificHeaders applet parameter.</td> </tr>
 576  
  * <tr>
 577  
  * <td>realMaxPicHeight</td>
 578  
  * <td>Since 3.3.0: Integer.MAX_VALUE<BR>
 579  
  * (was -1)<br>
 580  
  * <br>
 581  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}<br>
 582  
  * <i>Since v2.8.1</i></td>
 583  
  * <td>This parameters is about the same as maxPicHeight. It overrides it for pictures that must be transformed
 584  
  * (currentlty only when the picture is rotated). <br>
 585  
  * The aim of this parameter, is to prevent the applet to resize picture, and let the server do it: it will be much
 586  
  * quicker. <br>
 587  
  * This allows you to:
 588  
  * <ul>
 589  
  * <li>Put a 'big' <i>maxPicHeight</i> (or don't provide the parameter in the APPLET tag), and let the server resize the
 590  
  * picture according to the real maxPicHeight. The <i>maxPicHeight</i> will be used when the picture is not tranformed
 591  
  * by the user.
 592  
  * <li>Put this realMaxHeight to the real configured maxPicHeight. The applet will then directly produce the final file,
 593  
  * when it has to tranform the picture (picture rotation, for instance).
 594  
  * </ul>
 595  
  * <br>
 596  
  * <i>See also maxPicHeight, realMaxPicWidth, maxChunkSize (to override any server upload size limitation).</i></td>
 597  
  * </tr>
 598  
  * <tr>
 599  
  * <td>realMaxPicWidth</td>
 600  
  * <td>Since 3.3.0: Integer.MAX_VALUE<BR>
 601  
  * (was -1)<br>
 602  
  * <br>
 603  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}<br>
 604  
  * <i>Since v2.8.1</i></td>
 605  
  * <td>Same as realMaxPicHeight, but for the maximum width of uploaded picture that must be transformed. <br>
 606  
  * <i>See also maxPicWidth, realMaxPicHeight</i></td>
 607  
  * </tr>
 608  
  * <tr>
 609  
  * <td>retryMaxNumberOf</td>
 610  
  * <td>1<BR>
 611  
  * <i>Since 5.0.0</i></td>
 612  
  * <td>Maximum number of retries, that the applet will do, for upload resumable error. A 'upload resumable error', is
 613  
  * typically a network error. The default value is 0, to maintain the same behaviour as before.<BR>
 614  
  * This maximum of allowed retries is for each packet, that is: if one packet fails two times, and succeed in the third
 615  
  * attempt, the next packet will still have up to retryMaxNumberOf retries. For instance, the default value (1), means
 616  
  * that the applet will do a one new attempt after a first upload error, for each packet.</td>
 617  
  * </tr>
 618  
  * <tr>
 619  
  * <td>retryNbSecondsBetween</td>
 620  
  * <td>30<BR>
 621  
  * <i>Since 5.0.0</i></td>
 622  
  * <td>The number of seconds, to wait, before trying a new upload of a packet whose upload was in error. This is used if
 623  
  * <I>retryMaxNumberOf</I> is 1 or more, and if 'resumable upload error' occurs.</td>
 624  
  * </tr>
 625  
  * <tr>
 626  
  * <td>serverProtocol</td>
 627  
  * <td>null since 2.9.2rc4<br>
 628  
  * (before: "HTTP/1.1")<br>
 629  
  * <br>
 630  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 631  
  * <td>This parameter allows the control of the protocol toward the server. It can be HTTP/0.9 (not tested), HTTP/1.0,
 632  
  * HTTP/1.1 and FTP. HTTP supports https. Since version 2.9.2rc4, the default is <i>null</i>, introducing a new facility
 633  
  * of automatically adjusting the protocol according to the server response.<br>
 634  
  * This parameter is really useful only in {@link wjhk.jupload2.policies.CoppermineUploadPolicy}, as the coppermine
 635  
  * application also controls that the requests send within an HTTP session uses the same HTTP protocol (as a protection
 636  
  * to limit the 'steal' of session cookies).</td>
 637  
  * </tr>
 638  
  * <tr>
 639  
  * <td>sendMD5Sum</td>
 640  
  * <td>false<BR>
 641  
  * since 5.0.0<br>
 642  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 643  
  * <td>This parameter indicates whether the applet will send the MD5Sum for uploaded files, or not. If set to true, the
 644  
  * MD5Sum is sent in the <I>md5sum</I> HTTP POST argument.</td>
 645  
  * </tr>
 646  
  * <tr>
 647  
  * <td>showLogWindow<br>
 648  
  * Since 3.0.2<br>
 649  
  * Changed in 3.5.0</td>
 650  
  * <td>true<br>
 651  
  * <br>
 652  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 653  
  * <td>This parameter was formerly known as <i>showStatusBar</i> which now has a different purpose. <BR>
 654  
  * <U>Since 3.5.0:</U> Available values are (case sensitive):<DIR>
 655  
  * <LI>true: always visible.
 656  
  * <LI>false: always hiden.
 657  
  * <LI>onError: the log window is hidden. It will be displayed when an error occurs. If you put 99 into the debugLevel,
 658  
  * then the full debugOutput become visible if and only if an error occurs</DIR> <BR>
 659  
  * <U>Until 3.4.2</U>, it works this way: If given with the <i>False</i> value, the log window will be hidden. The
 660  
  * applet will still store all debug information in it. But the user won't see it any more. If a problem occurs, the
 661  
  * <i>urlToSendErrorTo</i> can still be used to log all available information.</td>
 662  
  * </tr>
 663  
  * <tr>
 664  
  * <td>showStatusBar</td>
 665  
  * <td>True<br>
 666  
  * <br>
 667  
  * New meaning since 3.0.2<br>
 668  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 669  
  * <td>This parameter controls if the status bar is shown in the applet. If shown, the stausbar provides information
 670  
  * about the current transfer speed and estimated time of completion. Before version 3.0.2, this parameter was used to
 671  
  * control visibility of the log window. This is now controlled by <i>showLogWindow</i>.</td>
 672  
  * </tr>
 673  
  * <tr>
 674  
  * <td>specificHeaders</td>
 675  
  * <td><I>null</I><br>
 676  
  * <br>
 677  
  * Since 3.0.2<br>
 678  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 679  
  * <td>Allows the caller to add any header(s) to the applet. These headers will be sent with each HTTP request to the
 680  
  * server. If you put several lines in this parameter, these parameter should be separated by the "&#92;n" string (not
 681  
  * the LineFeed character, but the antislash character followed by the n character, like msg="&#92;&#92;n";). No
 682  
  * "&#92;n" at the end: it will be added by the applet. In PHP, put '&#92;n', and not "&#92;n" (See PHP doc, on strings)
 683  
  * <BR>
 684  
  * This allows an easy management of <B>Basic HTTP authentication</B>. Just add a header like this one:<BR>
 685  
  * Authorization: Basic Base64EncodedString Where Base64EncodedString is the string "login:passord" encoded in Base 64.</td>
 686  
  * </tr>
 687  
  * <tr>
 688  
  * <td>sslVerifyCert<br>
 689  
  * Since 3.0.2b1</td>
 690  
  * <td>none<br>
 691  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 692  
  * <td>With this parameter, the handling of certificates when using SSL can be configured. There are 4 possible
 693  
  * settings:<br>
 694  
  * <ul>
 695  
  * <li><i>none</i> (default): Any server cert is accepted, no cert-based client authentication is performed.</li>
 696  
  * <li><i>server</i>: The server cert is verified against the local truststore and if that fails, a dialog pops up which
 697  
  * asks the user if the certificate shall be accepted permanently, just for the current session or not at all (Just like
 698  
  * any browser would do).</li>
 699  
  * <li><i>client</i>: A user-certificate (which must be available in the local keystore) is used to perform client
 700  
  * authentication.</li>
 701  
  * <li><i>strict</i>: The combination of <i>client</i> and <i>server</i>.</li>
 702  
  * </ul>
 703  
  * <p>
 704  
  * The location of the local truststore and keystore uses the normal JRE conventions. This means, that the system
 705  
  * truststore is used for verifying server certs (usually in $JAVA_HOME/lib/security/cacerts) unless either the system
 706  
  * property <i>javax.net.ssl.trusStore</i> specifies another location or a file <b>.truststore</b> exists in the user's
 707  
  * home directory. If the user decides to permanently accept an untrusted certificate, the file <b>.truststore</b> in
 708  
  * the user's home directory is written. The default keystore (for client certificates) is the file <b>.keystore</b> in
 709  
  * the user's home directory. This can be overridden by setting the system property <i>javax.net.ssl.keyStore</i>. If
 710  
  * the name of the keystore ends in <b>.p12</b>, it is assumed that the keystore is in <b>PKCS12</b> format, otherwise
 711  
  * the default format as specified in the JRE security-configuration is used.
 712  
  * <p>
 713  
  * <b>Important Note about client authentication:</b>
 714  
  * <p>
 715  
  * At the time of this writing, a <i>serious</i> bug exists in apache 2.0.x which prevents POST requests when SSL
 716  
  * renegotiation is about to happen. Renegotiation is triggered by a location-based (or directory-based) change of the
 717  
  * SSLVerifyClient directive in apache. Therefore you <b>can not</b> protect a sub-area of an otherwise unprotected SSL
 718  
  * server. You can circumvent that by setting up a virtualhost which is configured to perform SSL client verification
 719  
  * <b>for the complete virtualhost</b>. Attached to the bug report at <a
 720  
  * href="http://issues.apache.org/bugzilla/show_bug.cgi?id=12355">ASF Bugzilla</a>, there are several patches which
 721  
  * claim to fix the problem. However in that same report, other users complain about those patches to be ineffective.
 722  
  * Therefore, the author recommends avoiding re-negotiation alltogether by using the virtualhost aproach described
 723  
  * above. It is the understanding of the author, that this bug has been fixed for apache 2.2, however the author did not
 724  
  * verify that. Test-Reports from users running apache 2.2 are welcome.</td>
 725  
  * </tr>
 726  
  * <tr>
 727  
  * <td>storeBufferedImage</td>
 728  
  * <td>false <br>
 729  
  * <I>Deprecated</I> <br>
 730  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}</td>
 731  
  * <td>This parameter indicates that the preview image on the applet is kept in memory. It works really nice under
 732  
  * eclise. But, once in the navigator, the applet runs very quickly out of memory. So I add a lot of calls to
 733  
  * {@link wjhk.jupload2.filedata.PictureFileData#freeMemory(String, UploadPolicy)} , but it doesn't change anything. Be
 734  
  * careful to this parameter, and let it to the default value, unless you've well tested it under all your target client
 735  
  * configurations. <BR>
 736  
  * <I>This parameter will probably never be correctly implemented.</I></td>
 737  
  * </tr>
 738  
  * <tr>
 739  
  * <td>stringUploadError</td>
 740  
  * <td>Since 3.2.0: "^ERROR: (.*)$" for all upload policies<br>
 741  
  * Empty string ("") [if using DefaultUploadPolicy]<br>
 742  
  * "ERROR: (.*)" [if using CopperminUploadPolicy]<br>
 743  
  * <br>
 744  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}<br>
 745  
  * Since 2.9.2rc4</td>
 746  
  * <td>This string is a regular expression. It allows the applet to test that the server has detected an error in the
 747  
  * upload. If this parameter is given to the applet, the upload thread will try to match this regular expression against
 748  
  * each line of the server response <b>body</b>. If a group is found, it is considered as the error message, and will be
 749  
  * displayed to the user.<br>
 750  
  * If the match is successfull once, the upload is considered to have failed. and
 751  
  * {@link wjhk.jupload2.exception.JUploadExceptionUploadFailed} is thrown. If the expression contains a hunt-group, the
 752  
  * matching contents of that group is reported to the user. For example: If let the default value "^ERROR: (.*)$" here,
 753  
  * the applet will find an error if at least one line returned in the server response begins with "ERROR: ". Then, all
 754  
  * characters that follow are extracted as the error message. So, if the server response contains the line
 755  
  * "ERROR: md5sum check failed", the string "md5sum check failed" is used for the exception message. But if it returns a
 756  
  * line "maybe ERROR: is it an error?", then the applet won't find any error in the server response. <BR>
 757  
  * <B>Note:</B> you can put line breaks in the error message. The message must be in one line in the HTTP response. To
 758  
  * display a line break to the user, just put the two characters \n in the http response (would be a "\\n" in java or
 759  
  * PHP).</td>
 760  
  * </tr>
 761  
  * <tr>
 762  
  * <td>stringUploadSuccess</td>
 763  
  * <td>"^SUCCESS$"<br>
 764  
  * empty string ("") since 2.9.0<br>
 765  
  * (was ".* 200 OK$" before) <br>
 766  
  * <br>
 767  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 768  
  * <td>This string is a regular expression. It allows the applet to test that the server has accepted the upload. If
 769  
  * this parameter is given to the applet, the upload thread will try to match this regular expression against each lines
 770  
  * returned from the server.<br>
 771  
  * If the match is successfull once, the upload is considered to be a success. If not, a
 772  
  * {@link wjhk.jupload2.exception.JUploadExceptionUploadFailed} is thrown. <br>
 773  
  * The default test expression testes that the web server returns no HTTP error: 200 is the return code for a
 774  
  * successfull HTTP request. It actually means that postURL is a valid URL, and that the applet was able to send a
 775  
  * request to this URL: there should be no problem with the network configuration, like proxy, password proxy...). <br>
 776  
  * <b>But</b> it doesn't mean that the uploaded files have correctly be managed by the server. For instance, the URL can
 777  
  * be http://sourceforge.net, which, of course, would not take your files into account. <br>
 778  
  * So, as soon as you know a regular expression that test the return from the target application (and not just a
 779  
  * techical HTTP response code), change the stringUploadSuccess to this value. For instance, the default value will be
 780  
  * matched if the HTTP body content of the server response contains one line that is exactly 'SUCCESS', without any
 781  
  * other character. This 'success' means that the pictures have correctly uploaded to the server, and that he
 782  
  * successfully managed the uploaded files.</td>
 783  
  * </tr>
 784  
  * <tr>
 785  
  * <td>stringUploadWarning</td>
 786  
  * <td>"^WARNING: (.*)$" <br>
 787  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}<br>
 788  
  * Since 3.4.2</td>
 789  
  * <td>This string is a regular expression. It allows the applet to test that the server has detected a warning was
 790  
  * generated by the server. This warning is just a warning, that will be displayed to the user, as is. There may be
 791  
  * several warnings in the server return. If one or more warning is/are received, the message(s) will be displayed to
 792  
  * the user.<BR>
 793  
  * If the expression contains a hunt-group, the matching contents of that group is reported to the user. For example: If
 794  
  * you let the default value "^WARNING: (.*)$" here, the applet will find an error if at least one line returned in the
 795  
  * server response begins with "WARNING: ". Then, all characters that follow are extracted as the error message. So, if
 796  
  * the server response contains the line "WARNING: Bad encoding", the string "Bad encoding" is displayed as warning
 797  
  * message to the user. But if it returns a line "maybe WARNING: is it an error?", then the applet won't find any
 798  
  * warning in the server response.<BR>
 799  
  * <B>Notes:</B> <DIR>
 800  
  * <LI>There is no link between these warning and the fact the upload is considered to be a success or not. Upload
 801  
  * success is only based on the success and error string. See the <B>stringUploadSuccess</B> and
 802  
  * <B>stringUploadError</B> applet parameters, here above.
 803  
  * <LI>You can put line breaks in the error message. The message must be in one line in the HTTP response. To display a
 804  
  * line break to the user, just put the two characters \n in the http response (would be a "\\n" in java or PHP). </DIR>
 805  
  * </td>
 806  
  * </tr>
 807  
  * <tr>
 808  
  * <td>targetPictureFormat</td>
 809  
  * <td><i>Empty String</i><br />
 810  
  * {@link wjhk.jupload2.policies.PictureUploadPolicy}</td>
 811  
  * <td>This parameter can contain a list to convert image formats
 812  
  * <p>
 813  
  * Example 1:{@code "png,bmp:jpg;gif:png;"}
 814  
  * <ul>
 815  
  * <li>both png and bmp files will be converted to jpg,</li>
 816  
  * <li>gif files will be converted to png</li>
 817  
  * </ul>
 818  
  * Example 2:{@code "jpeg,jpg:png;"}
 819  
  * <ul>
 820  
  * <li>both jpeg and jpg files will be converted to png,</li>
 821  
  * </ul>
 822  
  * </p>
 823  
  * the value is expected to be a semi-colon separated list of relations from source-format(s) to a target format.<br />
 824  
  * format: <code>{SOURCEFORMAT{,SOURCEFORMAT*}:TARGETFORMAT;}*</code>
 825  
  * <ul>
 826  
  * <li>formats can contain any picture writer known by the JVM. For instance: jpeg, png, gif. All standard formats
 827  
  * should be available. More information can be found on the <a
 828  
  * href="http://java.sun.com/j2se/1.4.2/docs/guide/imageio/spec/title.fm.html" >java.sun.com</a> web site.
 829  
  * <li>SOURCEFORMAT: the source format that should be converted to the TARGETFORMAT<br />
 830  
  * e.g. png, jpg, jpeg, ..</li>
 831  
  * <li>TARGETFORMAT: the target format that all given SOURCEFORMAT should be converted to <br />
 832  
  * e.g. png, jpg, jpeg, ..</li>
 833  
  * <li>all format strings are case insensitive, so all following strings are the same:
 834  
  * <ul>
 835  
  * <li><code>"jpeg,jpg:png;"</code></li>
 836  
  * <li><code>"JPEG,JPG:PNG;"</code></li>
 837  
  * <li><code>"jPeG,JpG:pNg;"</code></li>
 838  
  * </ul>
 839  
  * </li>
 840  
  * </ul>
 841  
  * notes:
 842  
  * <ul>
 843  
  * <li>animated gifs will not be converted</li>
 844  
  * <li>jpg and jpeg are distinct types.</li>
 845  
  * <li>gifs can only be converted if the user has installed JRE >= 1.6</li>
 846  
  * <li>the trailing semi-colon is optional</li>
 847  
  * <li>when a file needs to be transformed, the content type will reflect the new picture format. the file extension
 848  
  * will be changed dependant on the parameter <code>keepOriginalFileExtensionForConvertedImages</code>
 849  
  * <ul>
 850  
  * <li>example1:
 851  
  * <ul>
 852  
  * <li><code>targetPictureFormat="bmp:png;"</code></li>
 853  
  * <li><code>keepOriginalFileExtensionForConvertedImages=false</code> (default)</li>
 854  
  * </ul>
 855  
  * When you upload: <code>C:\myBitmap.bmp</code>, the filename will be changed to <code>C:\myBitmap.png</code> and
 856  
  * transferred to the server, and the content-type will be changed to "image/png"</li>
 857  
  * <li>
 858  
  * <li>example2:
 859  
  * <ul>
 860  
  * <li><code>targetPictureFormat="bmp:png;"</code></li>
 861  
  * <li><code>keepOriginalFileExtensionForConvertedImages=true</code></li>
 862  
  * </ul>
 863  
  * When you upload: <code>C:\myBitmap.bmp</code>, the filename will NOT be changed and transferred to the server, but
 864  
  * the content-type will be changed to "image/png"</li>
 865  
  * </ul>
 866  
  * </li>
 867  
  * </ul>
 868  
  * see {@link wjhk.jupload2.filedata.helper.ImageFileConversionInfo}<br />
 869  
  * see keepOriginalFileExtensionForConvertedImages</td>
 870  
  * </tr>
 871  
  * <tr>
 872  
  * <td><b>uploadPolicy</b></td>
 873  
  * <td>DefaultUploadPolicy <br>
 874  
  * <br>
 875  
  * see {@link wjhk.jupload2.policies.UploadPolicyFactory}</td>
 876  
  * <td>This parameter contains the class name for the UploadPolicy that should be used. If it is not set, or if its
 877  
  * value is unknown from {@link wjhk.jupload2.policies.UploadPolicyFactory#getUploadPolicy(JUploadContext)} , the
 878  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy} is used.</td>
 879  
  * </tr>
 880  
  * <tr>
 881  
  * <td>urlToSendErrorTo</td>
 882  
  * <td><i>null</i> <br>
 883  
  * <br>
 884  
  * {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
 885  
  * <td>If this url is given, and an upload error occurs, the applet posts all debug output to this address. It's up to
 886  
  * this URL to handle this message. It is possible to just store the file, or to log the error in a database, or to send
 887  
  * a mail (like the mail.php script given with the coppermine pack). <br>
 888  
  * <u>Notes:</u> <DIR>
 889  
  * <LI>Only http and https URL schemes are supported.</LI>
 890  
  * <LI>The error information is sent in a POST request sent to the given URL. These post parameters are used:
 891  
  * description (a quick description of the error), javaError (the java output for the error, or null if no java error
 892  
  * were caught) and debugOutput (the full debug generated by the applet).</LI> </DIR></td>
 893  
  * </tr>
 894  
  * </table>
 895  
  * <h3><a name="example">HTML call example</a></h3>
 896  
  * <p>
 897  
  * Below, an example of how to put the applet into a PHP page is shown:
 898  
  * </p>
 899  
  * <code><pre>
 900  
  *                                     &lt;applet name=&quot;JUpload&quot; code=&quot;wjhk.jupload2.JUploadApplet&quot;
 901  
  *                                       archive=&quot;plugins/jupload/wjhk.jupload.jar&quot;
 902  
  *                                       &lt;!-- Applet display size, on the navigator page --&gt;
 903  
  *                                       width=&quot;500&quot; height=&quot;700&quot;
 904  
  *                                       &lt;!-- The applet uses some javascript functions, so we must allow that : --&gt;
 905  
  *                                       mayscript="true"&gt;
 906  
  *                                       &lt;!-- No parameter is mandatory. We don't precise the UploadPolicy, so
 907  
  *                                            DefaultUploadPolicy is used. The applet behaves like the original
 908  
  *                                            JUpload. (jupload v1) --&gt;
 909  
  *                                       &lt;param name=&quot;postURL&quot; value=&quot;http://some.host.com/youruploadpage.php&quot;&gt;
 910  
  *                                       Java 1.5 or higher plugin required.
 911  
  *                                     &lt;/applet&gt;
 912  
  * </pre></code> <BR>
 913  
  * <!-- ANT_COPYDOC_END --> <!-- ATTENTION: The previous comment is used by Ant build. DO NOT CHANGE!! -->
 914  
  * 
 915  
  * @author etienne_sf
 916  
  * @version $Revision: 1719 $
 917  
  * @see wjhk.jupload2.policies.DefaultUploadPolicy
 918  
  */
 919  
 
 920  
 public interface UploadPolicy {
 921  
 
 922  
     /*
 923  
      * Available parameters for the applet. New parameters (for instance for new policies) should all be added here, in
 924  
      * alphabetic order. This ensures that all tags are unique
 925  
      */
 926  
 
 927  
     /***************************************************************************
 928  
      * ************************************************************************ ************************* LIST OF
 929  
      * PROPERTIES ************************** ************************************************************************
 930  
      **************************************************************************/
 931  
     /**
 932  
      * Parameter/Property name for URL to be loaded after an successful upload.
 933  
      */
 934  
     public final static String PROP_AFTER_UPLOAD_URL = "afterUploadURL";
 935  
 
 936  
     /**
 937  
      * Parameter/Property name for allowing persistent HTTP connections.
 938  
      */
 939  
     public final static String PROP_ALLOW_HTTP_PERSISTENT = "allowHttpPersistent";
 940  
 
 941  
     /**
 942  
      * Parameter/Property name for specifying the allowed file extensions
 943  
      */
 944  
     public final static String PROP_ALLOWED_FILE_EXTENSIONS = "allowedFileExtensions";
 945  
 
 946  
     /**
 947  
      * Parameter/Property name for specifying the album id
 948  
      */
 949  
     public final static String PROP_ALBUM_ID = "albumId";
 950  
 
 951  
     /**
 952  
      * Indicates the directory, from which the applet should open the browsing window (file chooser) first.
 953  
      */
 954  
     public final static String PROP_BROWSING_DIRECTORY = "browsingDirectory";
 955  
 
 956  
     /**
 957  
      * Parameter/Property name for specifying if images should be cached in memory. Be careful: if set to true, you'll
 958  
      * probably have memory problems while in a navigator.
 959  
      */
 960  
     public final static String PROP_STORE_BUFFERED_IMAGE = "storeBufferedImage";
 961  
 
 962  
     /**
 963  
      * Parameter/Property name for specifying the debug level
 964  
      */
 965  
     public final static String PROP_DEBUG_LEVEL = "debugLevel";
 966  
 
 967  
     /**
 968  
      * This parameter allows to control whether the file icons in the file chooser are calculated from the file content.
 969  
      * This is currently only available for pictures.<BR>
 970  
      * If activated, the file chooser will open each pictures, and calculate the icon by resizing the picture. This is
 971  
      * done in by using thread of minimam priority, to minimize performances impact on the navigator. Available values
 972  
      * are: <DIR> <LI>-1: disabled. The default system are used. <LI>0 (default): available only in picture mode. That
 973  
      * is: the current upload policy is an instance of or a class inheriting from {@link PictureUploadPolicy} <LI>1:
 974  
      * available for all upload policies. </DIR>
 975  
      */
 976  
     public final static String PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT = "fileChooserIconFromFileContent";
 977  
 
 978  
     /**
 979  
      * This parameter allows to control the size of icons, in pixels, in the file chooser. Used only when
 980  
      * fileChooserIconFromFileContent is activated.
 981  
      */
 982  
     public final static String PROP_FILE_CHOOSER_ICON_SIZE = "fileChooserIconSize";
 983  
 
 984  
     /**
 985  
      * Allows control on the preview on the file chooser. Only for {@link PictureUploadPolicy} and its inheritants.
 986  
      */
 987  
     public final static String PROP_FILE_CHOOSER_IMAGE_PREVIEW = "fileChooserImagePreview";
 988  
 
 989  
     /**
 990  
      * Contains the name of the file filter, as it will be displayed in the drop down list of filters, in the file
 991  
      * chooser. If this name is given to the applet, it will be returned by the {@link FileFilter#getDescription()}
 992  
      * method.
 993  
      */
 994  
     public final static String PROP_FILE_FILTER_NAME = "fileFilterName";
 995  
 
 996  
     /** Parameter/Property name for specifying the way the file list is displayed. */
 997  
     public final static String PROP_FILE_LIST_VIEW_MODE = "fileListViewMode";
 998  
 
 999  
     /** Parameter/Property name for specifying the encoding of file names. */
 1000  
     public final static String PROP_FILENAME_ENCODING = "filenameEncoding";
 1001  
 
 1002  
     /**
 1003  
      * Parameter/Property name for specifying additional form data.
 1004  
      */
 1005  
     public final static String PROP_FORMDATA = "formdata";
 1006  
 
 1007  
     /**
 1008  
      * Parameter/Property name to specify, when in FTP mode, if subfolders must be created, or if all files must be
 1009  
      * uploaded on the root of postURL.
 1010  
      */
 1011  
     public final static String PROP_FTP_CREATE_DIRECTORY_STRUCTURE = "ftpCreateDirectoryStructure";
 1012  
 
 1013  
     /** FTP: binary or ascii mode */
 1014  
     public final static String PROP_FTP_TRANSFERT_BINARY = "ftpTransfertBinary";
 1015  
 
 1016  
     /** FTP: passive or active mode */
 1017  
     public final static String PROP_FTP_TRANSFERT_PASSIVE = "ftpTransfertPassive";
 1018  
 
 1019  
     /**
 1020  
      * Parameter/Property name for specifying high quality previews.
 1021  
      */
 1022  
     public final static String PROP_HIGH_QUALITY_PREVIEW = "highQualityPreview";
 1023  
 
 1024  
     /**
 1025  
      * Parameter/Property name for specifying high quality previews.
 1026  
      */
 1027  
     public final static String PROP_HTTP_UPLOAD_PARAMETER_NAME = "httpUploadParameterName";
 1028  
 
 1029  
     /**
 1030  
      * Parameter/Property name for specifying high quality previews.
 1031  
      */
 1032  
     public final static String PROP_HTTP_UPLOAD_PARAMETER_TYPE = "httpUploadParameterType";
 1033  
 
 1034  
     /**
 1035  
      * Parameter/Property name for specifying the UI language
 1036  
      */
 1037  
     public final static String PROP_LANG = "lang";
 1038  
 
 1039  
     /**
 1040  
      * Parameter/Property name for specifying a list of specific headers, that will be added to all HTTP request to the
 1041  
      * server. The parameter can be used for Basic Authentication, by adding this header: Authorization: Basic [Bae64
 1042  
      * encoding of the string "user:password"]
 1043  
      */
 1044  
     public final static String PROP_SPECIFIC_HEADERS = "specificHeaders";
 1045  
 
 1046  
     /**
 1047  
      * Parameter/Property name for specifying a PLAF class to load.
 1048  
      */
 1049  
     public final static String PROP_LOOK_AND_FEEL = "lookAndFeel";
 1050  
 
 1051  
     /**
 1052  
      * Parameter/Property name for specifying the maximum size of a chunk of uploaded data.
 1053  
      */
 1054  
     public final static String PROP_MAX_CHUNK_SIZE = "maxChunkSize";
 1055  
 
 1056  
     /**
 1057  
      * Parameter/Property name for specifying the maximum size of a single file.
 1058  
      */
 1059  
     public final static String PROP_MAX_FILE_SIZE = "maxFileSize";
 1060  
 
 1061  
     /**
 1062  
      * Parameter/Property name for specifying the maximum height of a picture.
 1063  
      */
 1064  
     public final static String PROP_MAX_HEIGHT = "maxPicHeight";
 1065  
 
 1066  
     /**
 1067  
      * Parameter/Property name for specifying the maximum width of a picture.
 1068  
      */
 1069  
     public final static String PROP_MAX_WIDTH = "maxPicWidth";
 1070  
 
 1071  
     /**
 1072  
      * Parameter/Property name for specifying the maximum number of file to be uploaded in a single request.
 1073  
      */
 1074  
     public final static String PROP_NB_FILES_PER_REQUEST = "nbFilesPerRequest";
 1075  
 
 1076  
     /**
 1077  
      * Parameter/Property name for specifying compression of the written picture file, if any.
 1078  
      */
 1079  
     public final static String PROP_PICTURE_COMPRESSION_QUALITY = "pictureCompressionQuality";
 1080  
 
 1081  
     /**
 1082  
      * Parameter/Property name for specifying whether picture metadata (EXIF coming from the camera for instance.
 1083  
      */
 1084  
     public final static String PROP_PICTURE_TRANSMIT_METADATA = "pictureTransmitMetadata";
 1085  
 
 1086  
     /**
 1087  
      * Parameter/Property name for specifying URL of the upload post request.
 1088  
      */
 1089  
     public final static String PROP_POST_URL = "postURL";
 1090  
 
 1091  
     /**
 1092  
      * Parameter/Property name for specifying URL of the upload post request.
 1093  
      */
 1094  
     public final static String PROP_AFTER_UPLOAD_TARGET = "afterUploadTarget";
 1095  
 
 1096  
     /**
 1097  
      * Read cookies from javascript command: document.cookie (or not)
 1098  
      */
 1099  
     public final static String PROP_READ_COOKIE_FROM_NAVIGATOR = "readCookieFromNavigator";
 1100  
 
 1101  
     /**
 1102  
      * Read userAgent from javascript command: document.userAgent (or not)
 1103  
      */
 1104  
     public final static String PROP_READ_USER_AGENT_FROM_NAVIGATOR = "readUserAgentFromNavigator";
 1105  
 
 1106  
     /**
 1107  
      * Parameter/Property name for specifying the real (server-side-desired) picture height.
 1108  
      */
 1109  
     public final static String PROP_REAL_MAX_HEIGHT = "realMaxPicHeight";
 1110  
 
 1111  
     /**
 1112  
      * Parameter/Property name for specifying the real (server-side-desired) picture width.
 1113  
      */
 1114  
     public final static String PROP_REAL_MAX_WIDTH = "realMaxPicWidth";
 1115  
 
 1116  
     /**
 1117  
      * Maximum number of retries, that the applet will do, for upload resumable error. A 'upload resumable error', is
 1118  
      * typically a network error. The default value is 0, to maintain the same behaviour as before.
 1119  
      */
 1120  
     public final static String PROP_RETRY_MAX_NUMBER_OF = "retryMaxNumberOf";
 1121  
 
 1122  
     /**
 1123  
      * The number of seconds, to wait, before trying a new upload. This is used if <I>retryMaxNumberOf</I> is 1 or more,
 1124  
      * and if 'resumable upload error' occurs.
 1125  
      */
 1126  
     public final static String PROP_RETRY_NB_SECONDS_BETWEEN = "retryNbSecondsBetween";
 1127  
 
 1128  
     /**
 1129  
      * Parameter/Property name for specifying the server protocol version.
 1130  
      */
 1131  
     public final static String PROP_SERVER_PROTOCOL = "serverProtocol";
 1132  
 
 1133  
     /**
 1134  
      * Parameter/Property name to spceify whether the md5sum for uploaded file should be sent.
 1135  
      */
 1136  
     public final static String PROP_SEND_MD5_SUM = "sendMD5Sum";
 1137  
 
 1138  
     /**
 1139  
      * Parameter/Property name for specifying if the log window should be visible.
 1140  
      */
 1141  
     public final static String PROP_SHOW_LOGWINDOW = "showLogWindow";
 1142  
 
 1143  
     /**
 1144  
      * Parameter/Property name for specifying if the status bar should be visible.
 1145  
      */
 1146  
     public final static String PROP_SHOW_STATUSBAR = "showStatusbar";
 1147  
 
 1148  
     /**
 1149  
      * Parameter/Property name for specifying how certificates are handled when uploading via SSL.
 1150  
      */
 1151  
     public final static String PROP_SSL_VERIFY_CERT = "sslVerifyCert";
 1152  
 
 1153  
     /**
 1154  
      * Parameter/Property name for specifying if the pattern that indicates an error in the server's response-body.
 1155  
      */
 1156  
     public final static String PROP_STRING_UPLOAD_ERROR = "stringUploadError";
 1157  
 
 1158  
     /**
 1159  
      * Parameter/Property name for specifying if the pattern that indicates success in the server's response-body.
 1160  
      */
 1161  
     public final static String PROP_STRING_UPLOAD_SUCCESS = "stringUploadSuccess";
 1162  
 
 1163  
     /**
 1164  
      * Parameter/Property name for specifying if the pattern that indicates a warning in the server's response-body.
 1165  
      */
 1166  
     public final static String PROP_STRING_UPLOAD_WARNING = "stringUploadWarning";
 1167  
 
 1168  
     /**
 1169  
      * Parameter/Property name for specifying the target picture format conversions
 1170  
      */
 1171  
     public final static String PROP_TARGET_PICTURE_FORMAT = "targetPictureFormat";
 1172  
 
 1173  
     /**
 1174  
      * Parameter/Property name for specifying if the original file extension should be changed if an image is converted
 1175  
      * to another format
 1176  
      */
 1177  
     public final static String PROP_KEEP_ORIG_EXTENSION = "keepOriginalFileExtensionForConvertedImages";
 1178  
 
 1179  
     /**
 1180  
      * Parameter/Property name for specifying the upload policy class.
 1181  
      */
 1182  
     public final static String PROP_UPLOAD_POLICY = "uploadPolicy";
 1183  
 
 1184  
     /**
 1185  
      * Parameter/Property name for specifying the URL for delivering error reports.
 1186  
      */
 1187  
     public final static String PROP_URL_TO_SEND_ERROR_TO = "urlToSendErrorTo";
 1188  
 
 1189  
     /***************************************************************************
 1190  
      * ************************************************************************ ************************* LIST OF
 1191  
      * ALLOWED VALUES ********************* ************************************************************************
 1192  
      **************************************************************************/
 1193  
 
 1194  
     /**
 1195  
      * Indicates that, in the HTTP upload request, the parameter that containts the uploaded files is an Iteration. For
 1196  
      * instance: from File0 to FileN (for N+1 files).
 1197  
      */
 1198  
     public final String HTTPUPLOADPARAMETERTYPE_ARRAY = "array";
 1199  
 
 1200  
     /**
 1201  
      * Indicates that, in the HTTP upload request, the parameter that containts the uploaded files is an Iteration. For
 1202  
      * instance: from File0 to FileN (for N+1 files).
 1203  
      */
 1204  
     public final String HTTPUPLOADPARAMETERTYPE_ITERATION = "iteration";
 1205  
 
 1206  
     /**
 1207  
      * Indicates that, in the HTTP upload request, there will be only one file. This value is only valid when
 1208  
      * nbFilesPerRequest is 1. The parameters in the HTTP upload request are let untransformed. For instance, if
 1209  
      * httpUploadParameterName is the default value (File), the file content will be loaded under the HTTP parameter
 1210  
      * 'File'.
 1211  
      */
 1212  
     public final String HTTPUPLOADPARAMETERTYPE_ONE_FILE = "oneFile";
 1213  
 
 1214  
     /** Indicates that the log window is always visible. */
 1215  
     public final String SHOWLOGWINDOW_TRUE = "true";
 1216  
 
 1217  
     /** Indicates that the log window is always hidden. */
 1218  
     public final String SHOWLOGWINDOW_FALSE = "false";
 1219  
 
 1220  
     /**
 1221  
      * Indicates that the log window is hidden, and will become visible only when an error occurs.
 1222  
      */
 1223  
     public final String SHOWLOGWINDOW_ONERROR = "onError";
 1224  
 
 1225  
     /***************************************************************************
 1226  
      * ************************************************************************ ************************* LIST OF
 1227  
      * DEFAULT VALUES ********************** ************************************************************************
 1228  
      **************************************************************************/
 1229  
 
 1230  
     /**
 1231  
      * Default value for parameter "afterUploadTarget".
 1232  
      */
 1233  
     public final static String DEFAULT_AFTER_UPLOAD_TARGET = null;
 1234  
 
 1235  
     /**
 1236  
      * Default value for parameter "afterUploadURL"
 1237  
      */
 1238  
     public final static String DEFAULT_AFTER_UPLOAD_URL = null;
 1239  
 
 1240  
     /**
 1241  
      * Default value for parameter "allowHttpPersisten".
 1242  
      */
 1243  
     public final static boolean DEFAULT_ALLOW_HTTP_PERSISTENT = false;
 1244  
 
 1245  
     /**
 1246  
      * Default value for parameter "allowedFileExtensions".
 1247  
      */
 1248  
     public final static String DEFAULT_ALLOWED_FILE_EXTENSIONS = null;
 1249  
 
 1250  
     /**
 1251  
      * Default value for parameter "albumId".
 1252  
      */
 1253  
     public final static int DEFAULT_ALBUM_ID = 0;
 1254  
 
 1255  
     /**
 1256  
      * Default value for parameter "storeBufferedImage". Be careful: if set to true, you'll probably have memory
 1257  
      * problems while in a navigator.
 1258  
      */
 1259  
     public final static boolean DEFAULT_STORE_BUFFERED_IMAGE = false;
 1260  
 
 1261  
     /**
 1262  
      * Default value for the browsing window first: no specific directory.
 1263  
      */
 1264  
     public final static String DEFAULT_BROWSING_DIRECTORY = null;
 1265  
 
 1266  
     /**
 1267  
      * Default value for date format when changing date/time variable to String.
 1268  
      */
 1269  
     public final static String DEFAULT_DATE_FORMAT = "dd/MM/yyyy HH:mm:ss";
 1270  
 
 1271  
     /**
 1272  
      * Default value for parameter "debugLevel".
 1273  
      */
 1274  
     public final static int DEFAULT_DEBUG_LEVEL = 0;
 1275  
 
 1276  
     /**
 1277  
      * Default value for applet parameter "fileChooserIconFromFileContent".
 1278  
      * 
 1279  
      * @see #PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT
 1280  
      */
 1281  
     public final static int DEFAULT_FILE_CHOOSER_ICON_FROM_FILE_CONTENT = 0;
 1282  
 
 1283  
     /**
 1284  
      * Default value for applet parameter "fileChooserIconSize".
 1285  
      * 
 1286  
      * @see #PROP_FILE_CHOOSER_ICON_SIZE
 1287  
      */
 1288  
     public final static int DEFAULT_FILE_CHOOSER_ICON_SIZE = 20;
 1289  
 
 1290  
     /**
 1291  
      * Default value for applet parameter "fileChooserImagePreview".
 1292  
      * 
 1293  
      * @see #PROP_FILE_CHOOSER_IMAGE_PREVIEW
 1294  
      */
 1295  
     public final static boolean DEFAULT_FILE_CHOOSER_IMAGE_PREVIEW = true;
 1296  
 
 1297  
     /**
 1298  
      * Default value for applet parameter "fileFilterName". This default value let the {@link DefaultUploadPolicy}
 1299  
      * return a calculated name, which contains the list of allowed file extensions.
 1300  
      * 
 1301  
      * @see #PROP_FILE_FILTER_NAME
 1302  
      * @see #PROP_ALLOWED_FILE_EXTENSIONS
 1303  
      */
 1304  
     public final static String DEFAULT_FILE_FILTER_NAME = null;
 1305  
 
 1306  
     /**
 1307  
      * Default value for applet parameter "ftpCreateDirectoryStructure".
 1308  
      * 
 1309  
      * @see #PROP_FTP_CREATE_DIRECTORY_STRUCTURE
 1310  
      */
 1311  
     public final static boolean DEFAULT_FTP_CREATE_DIRECTORY_STRUCTURE = false;
 1312  
 
 1313  
     /** FTP: binary or ascii mode */
 1314  
     public final static boolean DEFAULT_FTP_TRANSFERT_BINARY = true;
 1315  
 
 1316  
     /** FTP: passive or active mode */
 1317  
     public final static boolean DEFAULT_FTP_TRANSFERT_PASSIVE = true;
 1318  
 
 1319  
     /** Default value for parameter "lang". */
 1320  
     public final static String DEFAULT_LANG = null;
 1321  
 
 1322  
     /** Default value for parameter "fileListViewMode" */
 1323  
     public final static FilePanel.FileListViewMode DEFAULT_FILE_LIST_VIEW_MODE = FilePanel.FileListViewMode.FLAT;
 1324  
 
 1325  
     /** Default value for parameter "filenameEncoding". Note: the CoppermineUploadPolicy forces it to "UTF8". */
 1326  
     public final static String DEFAULT_FILENAME_ENCODING = null;
 1327  
 
 1328  
     /** Default value for parameter "highQualityPreview". */
 1329  
     public final static boolean DEFAULT_HIGH_QUALITY_PREVIEW = false;
 1330  
 
 1331  
     /** Default value for parameter "httpUploadParameterName". */
 1332  
     public final static String DEFAULT_HTTP_UPLOAD_PARAMETER_NAME = "File";
 1333  
 
 1334  
     /** Default value for parameter "httpUploadParameterName". */
 1335  
     public final static String DEFAULT_HTTP_UPLOAD_PARAMETER_TYPE = HTTPUPLOADPARAMETERTYPE_ITERATION;
 1336  
 
 1337  
     /** Default value for parameter "lookAndFeel". */
 1338  
     public final static String DEFAULT_LOOK_AND_FEEL = "";
 1339  
 
 1340  
     /** Default value for parameter "maxChunkSize". */
 1341  
     public final static long DEFAULT_MAX_CHUNK_SIZE = Long.MAX_VALUE;
 1342  
 
 1343  
     /**
 1344  
      * Default value for parameter "maxFileSize". Take care of this parameter if chunk upload is activated! See comment
 1345  
      * above.
 1346  
      */
 1347  
     public final static long DEFAULT_MAX_FILE_SIZE = Long.MAX_VALUE;
 1348  
 
 1349  
     /** Default value for parameter "maxPicWidth". */
 1350  
     public final static int DEFAULT_MAX_WIDTH = Integer.MAX_VALUE;
 1351  
 
 1352  
     /** Default value for parameter "maxPicHeight". */
 1353  
     public final static int DEFAULT_MAX_HEIGHT = Integer.MAX_VALUE;
 1354  
 
 1355  
     /**
 1356  
      * Default value for parameter "maxPicHeight". Note: the CoppermineUploadPolicy forces it to 1.
 1357  
      */
 1358  
     public final static int DEFAULT_NB_FILES_PER_REQUEST = 1;
 1359  
 
 1360  
     /**
 1361  
      * Default value for parameter "pictureCompressionQuality".
 1362  
      */
 1363  
     public final static float DEFAULT_PICTURE_COMPRESSION_QUALITY = (float) 0.8;
 1364  
 
 1365  
     /**
 1366  
      * Default value for parameter "pictureCompressionQuality".
 1367  
      */
 1368  
     public final static boolean DEFAULT_PICTURE_TRANSMIT_METADATA = false;
 1369  
 
 1370  
     /**
 1371  
      * Default value for parameter "postURL".
 1372  
      */
 1373  
     public final static String DEFAULT_POST_URL = null;
 1374  
 
 1375  
     /**
 1376  
      * Default value for parameter "readCookieFromNavigator".
 1377  
      */
 1378  
     public final static boolean DEFAULT_READ_COOKIE_FROM_NAVIGATOR = true;
 1379  
 
 1380  
     /**
 1381  
      * Default value for parameter "readUserAgentFromNavigator".
 1382  
      */
 1383  
     public final static boolean DEFAULT_READ_USER_AGENT_FROM_NAVIGATOR = true;
 1384  
 
 1385  
     /**
 1386  
      * Default value for parameter "realMaxPicWidth".
 1387  
      */
 1388  
     public final static int DEFAULT_REAL_MAX_WIDTH = Integer.MAX_VALUE;
 1389  
 
 1390  
     /**
 1391  
      * Default value for parameter "realMaxPicHeight".
 1392  
      */
 1393  
     public final static int DEFAULT_REAL_MAX_HEIGHT = Integer.MAX_VALUE;
 1394  
 
 1395  
     /**
 1396  
      * Default value for parameter "retryMaxNumberOf".
 1397  
      */
 1398  
     public final static int DEFAULT_RETRY_MAX_NUMBER_OF = 1;
 1399  
 
 1400  
     /**
 1401  
      * Default value for parameter "retryNbSecondsBetween".
 1402  
      */
 1403  
     public final static int DEFAULT_RETRY_NB_SECONDS_BETWEEN = 30;
 1404  
 
 1405  
     /**
 1406  
      * Default value for parameter "serverProtocol".
 1407  
      */
 1408  
     public final static String DEFAULT_SERVER_PROTOCOL = "HTTP/1.1";
 1409  
 
 1410  
     /**
 1411  
      * Default value for the sendMD5Sum applet parameter
 1412  
      */
 1413  
     public final static boolean DEFAULT_SEND_MD5_SUM = false;
 1414  
 
 1415  
     /**
 1416  
      * Default value for parameter "showLogWindow".
 1417  
      */
 1418  
     public final static String DEFAULT_SHOW_LOGWINDOW = "true";
 1419  
 
 1420  
     /**
 1421  
      * Default value for parameter "showStatusBar".
 1422  
      */
 1423  
     public final static boolean DEFAULT_SHOW_STATUSBAR = true;
 1424  
 
 1425  
     /**
 1426  
      * Default value for parameter "sslVerifyCert"
 1427  
      */
 1428  
     public final static String DEFAULT_SPECIFIC_HEADERS = null;
 1429  
 
 1430  
     /**
 1431  
      * Default value for parameter "sslVerifyCert"
 1432  
      */
 1433  
     public final static String DEFAULT_SSL_VERIFY_CERT = "none";
 1434  
 
 1435  
     /**
 1436  
      * Default value for parameter "stringUploadError".
 1437  
      * 
 1438  
      * @since 2.9.2rc4
 1439  
      */
 1440  
     public final static String DEFAULT_STRING_UPLOAD_ERROR = "^ERROR: (.*)$";
 1441  
 
 1442  
     /**
 1443  
      * Default value for parameter "stringUploadSuccess". Note: was ".* 200 OK$" before 2.9.0
 1444  
      */
 1445  
     public final static String DEFAULT_STRING_UPLOAD_SUCCESS = "^SUCCESS$";
 1446  
 
 1447  
     /**
 1448  
      * Default value for parameter "stringUploadWarning".
 1449  
      */
 1450  
     public final static String DEFAULT_STRING_UPLOAD_WARNING = "^WARNING: (.*)$";
 1451  
 
 1452  
     /**
 1453  
      * Default value for parameter "targetPictureFormat".
 1454  
      */
 1455  
     public final static String DEFAULT_TARGET_PICTURE_FORMAT = null;
 1456  
 
 1457  
     /**
 1458  
      * default value for parameter "keepOriginalFileExtensionForConvertedImages"
 1459  
      */
 1460  
     public final static boolean DEFAULT_KEEP_ORIG_EXTENSION = false;
 1461  
 
 1462  
     /**
 1463  
      * Default value for parameter "uploadPolicy".
 1464  
      */
 1465  
     public final static String DEFAULT_UPLOAD_POLICY = "DefaultUploadPolicy";
 1466  
 
 1467  
     /**
 1468  
      * Default value for parameter "urlToSendErrorTo".
 1469  
      */
 1470  
     public final static String DEFAULT_URL_TO_SEND_ERROR_TO = null;
 1471  
 
 1472  
     /**
 1473  
      * Default value for parameter "formdata"
 1474  
      * 
 1475  
      * @since 2.9.2rc4
 1476  
      */
 1477  
     public final static String DEFAULT_FORMDATA = null;
 1478  
 
 1479  
     /***************************************************************************/
 1480  
     /******************** MISC CONSTANTS ***************************************/
 1481  
     /***************************************************************************/
 1482  
 
 1483  
     /**
 1484  
      * Indicating that the applet is currently waiting for the user, to select files or start an uploading.
 1485  
      */
 1486  
     public final static int EXEC_STATUS_READY = 1;
 1487  
 
 1488  
     /** Indicating that the applet is currently uploading files */
 1489  
     public final static int EXEC_STATUS_UPLOADING = 2;
 1490  
 
 1491  
     /***************************************************************************
 1492  
      * ************************************************************************* ********************* LIST OF METHODS
 1493  
      * ********************************** *************************************************************************
 1494  
      **************************************************************************/
 1495  
 
 1496  
     /**
 1497  
      * This method allows the upolad policy to override the content of the applet part that is above the file list,
 1498  
      * called here the 'top panel'. That is: the part that contains the Browse, Remove and RemoveAll buttons. The
 1499  
      * default implementation is defined in
 1500  
      * {@link wjhk.jupload2.policies.DefaultUploadPolicy#createTopPanel(JButton, JButton, JButton, JUploadPanel)} . <BR>
 1501  
      * You can see an example in the {@link PictureUploadPolicy#createTopPanel(JButton, JButton, JButton, JUploadPanel)}
 1502  
      * upload policy implementation. <BR>
 1503  
      * <B>Note:</B> This method is called by the {@link DefaultUploadPolicy#addComponentsToJUploadPanel(JUploadPanel)}
 1504  
      * method. If you create an upload policy that overrides the addComponentsToJUploadPanel method, it's up to you to
 1505  
      * call it.
 1506  
      * 
 1507  
      * @param browse The default browse button.
 1508  
      * @param remove The default removeSelected button.
 1509  
      * @param removeAll The default removeAll button.
 1510  
      * @param mainPanel The panel that contains all objects.
 1511  
      * @return the topPanel, that will be displayed on the top of the Applet.
 1512  
      */
 1513  
     public JPanel createTopPanel(JButton browse, JButton remove, JButton removeAll, JUploadPanel mainPanel);
 1514  
 
 1515  
     /**
 1516  
      * This method is called to create the progress panel. The default implementation is defined in
 1517  
      * {@link wjhk.jupload2.policies.DefaultUploadPolicy#createProgressPanel(JProgressBar, JProgressBar, JButton, JButton, JUploadPanel)}
 1518  
      * .
 1519  
      * 
 1520  
      * @param preparationProgressBar The default preparation progress bar.
 1521  
      * @param uploadProgressBar The default upload progress bar.
 1522  
      * @param uploadButton The default upload button.
 1523  
      * @param stopButton The default stop button.
 1524  
      * @param mainPanel The panel that contains all objects.
 1525  
      * @return the topPanel, that will be displayed on the top of the Applet.
 1526  
      */
 1527  
     public JPanel createProgressPanel(JProgressBar preparationProgressBar, JProgressBar uploadProgressBar,
 1528  
             JButton uploadButton, JButton stopButton, JUploadPanel mainPanel);
 1529  
 
 1530  
     /**
 1531  
      * This method is used to create a new status bar. The default implementation is defined in
 1532  
      * {@link wjhk.jupload2.policies.DefaultUploadPolicy#createStatusBar(JLabel, JUploadPanel)} .
 1533  
      * 
 1534  
      * @param statusContent The status bar content
 1535  
      * @param mainPanel The panel that contains all objects.
 1536  
      * @return the topPanel, that will be displayed on the top of the Applet.
 1537  
      */
 1538  
     public JPanel createStatusBar(JLabel statusContent, JUploadPanel mainPanel);
 1539  
 
 1540  
     /**
 1541  
      * This methods allow the upload policy to override the default disposition of the components on the applet.<br>
 1542  
      * There are some utility methods to style file panel elements (font/color), see
 1543  
      * {@link wjhk.jupload2.gui.filepanel.FilePanel}.
 1544  
      * 
 1545  
      * @param jUploadPanel The main applet panel.
 1546  
      * @see #createTopPanel(JButton, JButton, JButton, JUploadPanel)
 1547  
      */
 1548  
     public void addComponentsToJUploadPanel(JUploadPanel jUploadPanel);
 1549  
 
 1550  
     /**
 1551  
      * This methods creates a new FileData instance (or one of its inherited classes), and return it to the caller.
 1552  
      * 
 1553  
      * @param file The file used to create the FileData instance. This method is called once for each file selected by
 1554  
      *            the user, even if the user added several files in one 'shot'.
 1555  
      * @param root An optional toplevel directory of a hierarchy (can be null).
 1556  
      * @return A FileData instance. The exact class depends on the currentUploadPolicy. Can be null, if the policy
 1557  
      *         performs checks, and the given file is not Ok for these controls. See
 1558  
      *         {@link PictureUploadPolicy#createFileData(File,File)} for an example. It's up to the upload policy to
 1559  
      *         display a message to inform the user that this file won't be added to the file list.
 1560  
      * @throws JUploadExceptionStopAddingFiles The exception is not really an error. It allows an easy way to indicates
 1561  
      *             that the applet should stop adding files when the user clicked on the 'Cancel' button.
 1562  
      */
 1563  
     public FileData createFileData(File file) throws JUploadExceptionStopAddingFiles;
 1564  
 
 1565  
     /**
 1566  
      * This method displays the applet parameter list, according to the current debugLevel. It is called by the
 1567  
      * {@link #setDebugLevel(int)} method. It should be override by any subclasses, that should display its own
 1568  
      * parameters, then call <i>super.displayParameterStatus()</i>.
 1569  
      */
 1570  
     public void displayParameterStatus();
 1571  
 
 1572  
     /**
 1573  
      * Reaction to the applet start. This method was added from the patch 3035735 given by Tsukasa Hamano (SF login:
 1574  
      * cuspy). Its aim is to move all call to JSObject from the applet.init() method to the applet.start() method. This
 1575  
      * prevents a crash, under Safari.
 1576  
      */
 1577  
     public void start();
 1578  
 
 1579  
     /**
 1580  
      * This method is called by the {@link JUploadPanel#updateButtonState()} method, when the execution status of the
 1581  
      * applet changes. This allow the applet to manage specific GUI items, depending on the current execution status of
 1582  
      * the applet.
 1583  
      * 
 1584  
      * @param executionStatus One of the EXEC_STATUS_XXX constant.
 1585  
      */
 1586  
     public void updateButtonState(int executionStatus);
 1587  
 
 1588  
     // //////////////////////////////////////////////////////////////////////////////////////////////
 1589  
     // /////////////////// getters / setters
 1590  
     // //////////////////////////////////////////////////////////////////////////////////////////////
 1591  
 
 1592  
     /**
 1593  
      * This allow runtime modifications of properties. With this method, you can change any applet parameter after the
 1594  
      * applet initilization, with JavaScript for instance. If the applet parameters given in <i>prop</i> is not managed
 1595  
      * by this method, a warning is displayed in the log window.
 1596  
      * 
 1597  
      * @param prop The applet parameter name.
 1598  
      * @param value The new value for this parameter. If the value is not valid (for instance <i>aaa</i> for a number),
 1599  
      *            a warning is displayed in the log window, and the existing value is not changed.
 1600  
      * @throws JUploadException
 1601  
      * @exception JUploadExceptionStopAddingFiles indicates that the applet should stop strying adding the current file
 1602  
      *                selection. Useful for instance, when a user drop a directory, full of unallowed file: it's
 1603  
      *                annoying for the user to click 'Ok' for each file in the alert box.
 1604  
      */
 1605  
     public void setProperty(String prop, String value) throws JUploadException;
 1606  
 
 1607  
     /**
 1608  
      * Retrieves the current value for the afterUploadURL applet parameter.
 1609  
      * 
 1610  
      * @return The current value for he afterUploadURL applet parameter.
 1611  
      */
 1612  
     public String getAfterUploadURL();
 1613  
 
 1614  
     /**
 1615  
      * Retrieves the current value for allowHttpPersistent
 1616  
      * 
 1617  
      * @return Current value for allowHttpPersistent
 1618  
      */
 1619  
     public boolean getAllowHttpPersistent();
 1620  
 
 1621  
     /**
 1622  
      * Retrieves the current value for allowedFileExtensions *
 1623  
      * 
 1624  
      * @return Current value for allowedFileExtensions
 1625  
      */
 1626  
     public String getAllowedFileExtensions();
 1627  
 
 1628  
     /**
 1629  
      * A useful function, that has nothing to do with an upload policy. But it is useful to have it here, as the
 1630  
      * uploadPolicy is known everywhere in the applet.
 1631  
      * 
 1632  
      * @return Reference to the current JUpload context.
 1633  
      */
 1634  
     public JUploadContext getContext();
 1635  
 
 1636  
     /**
 1637  
      * Set the current directory.
 1638  
      * 
 1639  
      * @param currentBrowsingDirectoryParam The directory that will be the current one, the next time the file chooser
 1640  
      *            is opened.
 1641  
      * @see #getCurrentBrowsingDirectory()
 1642  
      * @deprecated
 1643  
      */
 1644  
     public void setCurrentBrowsingDirectory(File currentBrowsingDirectoryParam);
 1645  
 
 1646  
     /**
 1647  
      * Set the current directory.
 1648  
      * 
 1649  
      * @param currentBrowsingDirectoryParam The directory that will be the current one, the next time the file chooser
 1650  
      *            is opened. This directory may begin with ~/ or ~\
 1651  
      * @see #getCurrentBrowsingDirectory()
 1652  
      */
 1653  
     public void setCurrentBrowsingDirectory(String currentBrowsingDirectoryParam);
 1654  
 
 1655  
     /**
 1656  
      * Returns the current browsing directory, that is: the directory that will be current the next time the file
 1657  
      * chooser is opened. It is initialized with the browsingDirectory applet parameter. Then, it contains the last
 1658  
      * directory used in the file chooser.
 1659  
      * 
 1660  
      * @return The directory that will be the current one, the next time the file chooser is opened.
 1661  
      */
 1662  
     public File getCurrentBrowsingDirectory();
 1663  
 
 1664  
     /**
 1665  
      * Returns the currently choosen format for date. It must be compatible with the SimpleDateFormat standard Java
 1666  
      * class.
 1667  
      * 
 1668  
      * @return The date format.
 1669  
      */
 1670  
     public String getDateFormat();
 1671  
 
 1672  
     /**
 1673  
      * This method indicate whether or not the debug messages must be displayed. Default is no debug (0). <br>
 1674  
      * To activate the debug, add a 'debugLevel' parameter to the applet (with 1 to n value), or call this method.
 1675  
      * Currently, level used in the code are between 0 (no debug) and 100 (max debug). <br>
 1676  
      * With a 0 value, no debug messages will be displayed. The {@link DefaultUploadPolicy}.addMsgToDebugBufferString
 1677  
      * method stores all debug output in a BufferString.
 1678  
      * 
 1679  
      * @param debugLevel The new debugLevel.
 1680  
      * @see DefaultUploadPolicy#sendDebugInformation(String, Exception)
 1681  
      */
 1682  
     public void setDebugLevel(int debugLevel);
 1683  
 
 1684  
     /**
 1685  
      * This method returns the current debug level.
 1686  
      * 
 1687  
      * @return The current debug level
 1688  
      * @see #setDebugLevel(int)
 1689  
      */
 1690  
     public int getDebugLevel();
 1691  
 
 1692  
     /**
 1693  
      * Getter for the fileFilterName property.
 1694  
      * 
 1695  
      * @return Stored value for fileFilterName
 1696  
      * @see UploadPolicy#PROP_FILE_FILTER_NAME
 1697  
      */
 1698  
     public String getFileFilterName();
 1699  
 
 1700  
     /**
 1701  
      * Getter for the fileChooserIconFromFileContent applet parameter.
 1702  
      * 
 1703  
      * @return Stored value for fileChooserIconFromFileContent
 1704  
      * @see #PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT
 1705  
      */
 1706  
     public int getFileChooserIconFromFileContent();
 1707  
 
 1708  
     /**
 1709  
      * Getter for the fileChooserIconSize applet parameter.
 1710  
      * 
 1711  
      * @return Stored value for fileChooserIconSize
 1712  
      * @see #PROP_FILE_CHOOSER_ICON_SIZE
 1713  
      */
 1714  
     public int getFileChooserIconSize();
 1715  
 
 1716  
     /**
 1717  
      * Getter for the fileListViewMode applet parameter.
 1718  
      * 
 1719  
      * @return The mode for displaying the file list (flat or tree view)
 1720  
      */
 1721  
     public FilePanel.FileListViewMode getFileListViewMode();
 1722  
 
 1723  
     /**
 1724  
      * Setter for the fileListViewMode applet parameter: it can be changed at runtime, by the user.
 1725  
      * 
 1726  
      * @return The mode for displaying the file list (flat or tree view)
 1727  
      */
 1728  
     public void setFileListViewMode(FilePanel.FileListViewMode fileListViewMode);
 1729  
 
 1730  
     /**
 1731  
      * Returns the encoding that should be used for the filename. This encoding has no impact on the content of the file
 1732  
      * that will be uploaded.
 1733  
      * 
 1734  
      * @return The encoding name, like UTF-8 (see the Charset JDK documentation).
 1735  
      */
 1736  
     public String getFilenameEncoding();
 1737  
 
 1738  
     /**
 1739  
      * Returns the current value for the ftpCreateDirectoryStructure applet parameter.
 1740  
      * 
 1741  
      * @return The current value of ftpCreateDirectoryStructure
 1742  
      */
 1743  
     public boolean getFtpCreateDirectoryStructure();
 1744  
 
 1745  
     /**
 1746  
      * Returns the current value for the ftpTransfertBinary applet parameter.
 1747  
      * 
 1748  
      * @return The current value of ftpTransfertBinary
 1749  
      */
 1750  
     public boolean getFtpTransfertBinary();
 1751  
 
 1752  
     /**
 1753  
      * Returns the current value for the ftpTransfertPassive applet parameter.
 1754  
      * 
 1755  
      * @return The current value of ftpTransfertPassive
 1756  
      */
 1757  
     public boolean getFtpTransfertPassive();
 1758  
 
 1759  
     /**
 1760  
      * This method sets the current language to take into account. It loads the lang resourceBundle, which will allow
 1761  
      * the applet to display the texts in the correct language.
 1762  
      * 
 1763  
      * @param lang The new language to take into account. See the java.util.Locale(String) constructor for a list of
 1764  
      *            valid values.
 1765  
      */
 1766  
     public void setLang(String lang);
 1767  
 
 1768  
     /**
 1769  
      * Returns the value of the applet parameter maxChunkSize (see above for a description of all applet parameters)
 1770  
      * 
 1771  
      * @return the current value of maxChunkSize.
 1772  
      */
 1773  
     public long getMaxChunkSize();
 1774  
 
 1775  
     /**
 1776  
      * Returns the value of the applet parameter maxFileSize (see above for a description of all applet parameters)
 1777  
      * 
 1778  
      * @return the current value of maxFileSize.
 1779  
      */
 1780  
     public long getMaxFileSize();
 1781  
 
 1782  
     /**
 1783  
      * This function returns the number of files should be uploaded during one access to the server. If negative or 0,
 1784  
      * all files are to be uploaded in one HTTP request. If positive, each HTTP upload contains this number of files.
 1785  
      * The last upload request may contain less files. <br>
 1786  
      * Examples :
 1787  
      * <UL>
 1788  
      * <li>If 1 : files are uploaded file by file.
 1789  
      * <li>If 5 : files are uploaded 5 files by 5 files. If 12 files are uploaded, 3 HTTP upload are done, containing 5,
 1790  
      * 5 and 2 files.
 1791  
      * </UL>
 1792  
      * 
 1793  
      * @return Returns the maximum number of files, to download in one HTTP request.
 1794  
      */
 1795  
     public int getNbFilesPerRequest();
 1796  
 
 1797  
     /**
 1798  
      * Return the current value of readUserAgentFromNavigator
 1799  
      * 
 1800  
      * @return Current value of readUserAgentFromNavigator
 1801  
      */
 1802  
     public boolean getReadUserAgentFromNavigator();
 1803  
 
 1804  
     /**
 1805  
      * Return the current value of retryMaxNumberOf
 1806  
      * 
 1807  
      * @return Current value of retryMaxNumberOf
 1808  
      */
 1809  
     public int getRetryMaxNumberOf();
 1810  
 
 1811  
     /**
 1812  
      * Return the current value of retryNbSecondsBetween
 1813  
      * 
 1814  
      * @return Current value of retryNbSecondsBetween
 1815  
      */
 1816  
     public int getRetryNbSecondsBetween();
 1817  
 
 1818  
     /**
 1819  
      * Return the current value of readCookieFromNavigator
 1820  
      * 
 1821  
      * @return Current value of readCookieFromNavigator
 1822  
      */
 1823  
     public boolean getReadCookieFromNavigator();
 1824  
 
 1825  
     /**
 1826  
      * Get the target URL for upload.
 1827  
      * 
 1828  
      * @return Should be valid URL...
 1829  
      */
 1830  
     public String getPostURL();
 1831  
 
 1832  
     /**
 1833  
      * The URL can change during the life of our policy ...
 1834  
      * 
 1835  
      * @param postURL
 1836  
      * @throws JUploadException
 1837  
      */
 1838  
     public void setPostURL(String postURL) throws JUploadException;
 1839  
 
 1840  
     /**
 1841  
      * Return the target, specified as applet parameter "afterUploadTarget"
 1842  
      * 
 1843  
      * @return the specified target.
 1844  
      */
 1845  
     public String getAfterUploadTarget();
 1846  
 
 1847  
     /**
 1848  
      * HTTP protocol that should be used to send the HTTP request. Currently, this is mainly used by
 1849  
      * {@link wjhk.jupload2.policies.CoppermineUploadPolicy}, as the coppermine control that the protocol used for each
 1850  
      * HTTP request is the same as the one used during the session creation. It is used in the default policy, as it
 1851  
      * could be used elsewhere. <br>
 1852  
      * Default is : HTTP/1.1
 1853  
      * 
 1854  
      * @return The selected server protocol.
 1855  
      */
 1856  
     public String getServerProtocol();
 1857  
 
 1858  
     /**
 1859  
      * @param serverProtocol The protocol is set from the postURL. For HTTP URL, a HEAD request is done toward the
 1860  
      *            server, to check if any temporary redirection is occuring.
 1861  
      */
 1862  
     public void setServerProtocol(String serverProtocol);
 1863  
 
 1864  
     /**
 1865  
      * MD5Sum allows the server to control that the file has been correctly uploaded. This is interesting, when
 1866  
      * uploading in chunk mode. But calculating this can be long, for big files.
 1867  
      * 
 1868  
      * @return true or false, whether the md5sum should be processed and sent to the server.
 1869  
      */
 1870  
     public boolean getSendMD5Sum();
 1871  
 
 1872  
     /**
 1873  
      * MD5Sum allows the server to control that the file has been correctly uploaded. This is interesting, when
 1874  
      * uploading in chunk mode. But calculating this can be long, for big files.
 1875  
      * 
 1876  
      * @param sendMD5Sum true or false, whether the md5sum should be processed and sent to the server.
 1877  
      */
 1878  
     public void setSendMD5Sum(boolean sendMD5Sum);
 1879  
 
 1880  
     /**
 1881  
      * Retrieves SSL verification mode.
 1882  
      * 
 1883  
      * @return The current SSL verification mode.
 1884  
      */
 1885  
     public int getSslVerifyCert();
 1886  
 
 1887  
     /**
 1888  
      * @param showLogWindow The show window status to set.
 1889  
      * @see #getShowLogWindow()
 1890  
      */
 1891  
     public void setShowLogWindow(String showLogWindow);
 1892  
 
 1893  
     /**
 1894  
      * Indicate whether the log window should be shown. It may be convenient to hide it, as it contains mostly debug
 1895  
      * information. But it still is the only place where possible errors and warnings are shown.<br>
 1896  
      * Default is : true
 1897  
      * 
 1898  
      * @return The current value for the <i>showStatusBar</i> applet parameter.
 1899  
      */
 1900  
     public String getShowLogWindow();
 1901  
 
 1902  
     /**
 1903  
      * Returns the list of specific headers, that will be added to all HTTP request to the server.
 1904  
      * 
 1905  
      * @return List of specific headers, with a \r\n at the end of each header.
 1906  
      */
 1907  
     public String getSpecificHeaders();
 1908  
 
 1909  
     /**
 1910  
      * Get the original name of the file on the disk. This function can encode the filename (see the filenameEncoding
 1911  
      * parameter). By default, the original filename is returned.
 1912  
      * 
 1913  
      * @param fileData The file data whose upload file name must be calculated.
 1914  
      * @param index index of the file in the current request to the server (from 0 to n)
 1915  
      * @return The filename the is given in the filename part of the Content-Disposition header.
 1916  
      * @throws JUploadException
 1917  
      */
 1918  
     public String getUploadFilename(FileData fileData, int index) throws JUploadException;
 1919  
 
 1920  
     /**
 1921  
      * Get an upload filename, that is to be send in the HTTP upload request. This is the name part of the
 1922  
      * Content-Disposition header. That is: this is the name under which you can manage the file (for instance in the
 1923  
      * _FILES[$name] in PHP) and not the filename of the original file. <BR>
 1924  
      * If you're using one of the core JUpload {@link UploadPolicy}, the value for this parameter is controled by the
 1925  
      * applet parameters: targetPictureFormat and keepOriginalFileExtensionForConvertedImages.
 1926  
      * 
 1927  
      * @param fileData The file data whose upload name must be calculated.
 1928  
      * @param index index of the file in the current request to the server (from 0 to n)
 1929  
      * @return The name part of the Content-Disposition header.
 1930  
      * @throws JUploadException
 1931  
      * @see #getUploadFilename(FileData, int)
 1932  
      */
 1933  
     public String getUploadName(FileData fileData, int index) throws JUploadException;
 1934  
 
 1935  
     /**
 1936  
      * Returns the current URL where error log must be posted. See <a href="#parameters">Parameters</a>
 1937  
      * 
 1938  
      * @return the urlToSendErrorTo
 1939  
      */
 1940  
     public String getUrlToSendErrorTo();
 1941  
 
 1942  
     /**
 1943  
      * @param urlToSendErrorTo the urlToSendErrorTo to set
 1944  
      * @throws JUploadException
 1945  
      */
 1946  
     public void setUrlToSendErrorTo(String urlToSendErrorTo) throws JUploadException;
 1947  
 
 1948  
     /**
 1949  
      * Retrieve the regular expression that will be tested against each line of the server answer. If one line matches
 1950  
      * this expression, that upload is marked as failed. <br>
 1951  
      * 
 1952  
      * @return The regular expression that must be run again each line of the http answer.
 1953  
      */
 1954  
     public String getStringUploadError();
 1955  
 
 1956  
     /**
 1957  
      * Get the regular expression that will be tested against each line of the server answer. If one line matches this
 1958  
      * expression, that upload is marked as successful. <br>
 1959  
      * The upload works this way:
 1960  
      * <ol>
 1961  
      * <li>Upload the selected file(s) to the server
 1962  
      * <li>Get all the server HTTP response.
 1963  
      * <li>The stringUploadSuccess regular expression is tested against each line from the server.
 1964  
      * <li>If the above test gives a match, the upload is marked as successful. Else, the upload is marked as
 1965  
      * unsuccessful, and a JUploadExceptionUploadFailure is thrown.
 1966  
      * </ol>
 1967  
      * 
 1968  
      * @return The regular expression that must be run again each line of the http answer.
 1969  
      */
 1970  
     public String getStringUploadSuccess();
 1971  
 
 1972  
     /**
 1973  
      * Retrieve the regular expression that will be tested against each line of the server answer. If one line matches
 1974  
      * this expression, a warning message is displayed to the user. <br>
 1975  
      * 
 1976  
      * @return The regular expression that must be run again each line of the http answer.
 1977  
      * @see #getStringUploadError()
 1978  
      * @see #getStringUploadSuccess()
 1979  
      */
 1980  
     public String getStringUploadWarning();
 1981  
 
 1982  
     /**
 1983  
      * Retrieve the applet's "formdata" parameter.
 1984  
      * 
 1985  
      * @return The applet's formdata parameter.
 1986  
      */
 1987  
     public String getFormdata();
 1988  
 
 1989  
     /**
 1990  
      * Retrieve the applet's "httpUploadParameterName" parameter.
 1991  
      * 
 1992  
      * @return The applet's httpUploadParameterName parameter.
 1993  
      */
 1994  
     public String getHttpUploadParameterName();
 1995  
 
 1996  
     /**
 1997  
      * Retrieve the applet's "httpUploadParameterType" parameter.
 1998  
      * 
 1999  
      * @return The applet's httpUploadParameterType parameter.
 2000  
      */
 2001  
     public String getHttpUploadParameterType();
 2002  
 
 2003  
     // //////////////////////////////////////////////////////////////////////////////////////////////
 2004  
     // /////////////////// miscellaneous methods
 2005  
     // //////////////////////////////////////////////////////////////////////////////////////////////
 2006  
 
 2007  
     /**
 2008  
      * Reaction by the upload policy, once the management of the dropped file(s) is finished, that is: after all the
 2009  
      * dropped files have been successfully added to the file list.
 2010  
      * 
 2011  
      * @param dropEvent The event containing the dropped file
 2012  
      */
 2013  
     public void afterFileDropped(DropTargetDropEvent dropEvent);
 2014  
 
 2015  
     // MANAGEMENT OF THE FILE CHOOSER
 2016  
 
 2017  
     /**
 2018  
      * The creation of the file chooser is controled by the upload policy, to allow fine control of the way to select
 2019  
      * files. For instance, the {@link PictureUploadPolicy} creates a file chooser, and add an accessory to preview
 2020  
      * pictures.
 2021  
      * 
 2022  
      * @return Return the specific file choose, according to this upload policy.
 2023  
      */
 2024  
     public JUploadFileChooser createFileChooser();
 2025  
 
 2026  
     /**
 2027  
      * This methods is called by the {@link JUploadFileFilter#accept(File)}. It allows the current upload policy to
 2028  
      * filter files, according to any choosen applet behaviour. This filter applied only when using the fileChooser.
 2029  
      * Files dropped onto the applet won't trigger this function.<br>
 2030  
      * In the {@link DefaultUploadPolicy} upload policy, this filter is based on the applet parameter:
 2031  
      * <i>allowedFileExtensions</i>.
 2032  
      * 
 2033  
      * @param file Allows the applet to filter files from the file chooser.
 2034  
      * @return true or false, whether the file is accepted or not.
 2035  
      * @see JUploadPanel
 2036  
      */
 2037  
     public boolean fileFilterAccept(File file);
 2038  
 
 2039  
     /**
 2040  
      * Return a description for the FileFilter, according to the current upload policy.
 2041  
      * 
 2042  
      * @return A description for the current filter
 2043  
      */
 2044  
     public String fileFilterGetDescription();
 2045  
 
 2046  
     /**
 2047  
      * Response for the {@link JUploadFileView#getIcon(File)}. Default is implemented in
 2048  
      * {@link DefaultUploadPolicy#fileViewGetIcon(File)}, by returning null, which displays the default icon.
 2049  
      * 
 2050  
      * @param file The file from which the icon should represent.
 2051  
      * @return The resulting icon.
 2052  
      */
 2053  
     public Icon fileViewGetIcon(File file);
 2054  
 
 2055  
     /**
 2056  
      * This method changes the current mouse cursor to the wait one. It returns the old one so that, it can be restored,
 2057  
      * once the work is done.
 2058  
      * 
 2059  
      * @return The cursor that was active, before changing to the wait one.
 2060  
      * @see #setCursor(Cursor)
 2061  
      */
 2062  
     public Cursor setWaitCursor();
 2063  
 
 2064  
     /**
 2065  
      * Changes the current mouse cursor. This method can be called at the end of a big treatement, to restore the cursor
 2066  
      * returned by the {@link #setWaitCursor()}.
 2067  
      * 
 2068  
      * @param cursor The cursor that must be set.
 2069  
      * @return The cursor that was active before setting the new one. Can be used to restore its previous state.
 2070  
      */
 2071  
     public Cursor setCursor(Cursor cursor);
 2072  
 
 2073  
     // //////////////////////////////////////////////////////////////////////////////////////////////
 2074  
     // DISPLAY OF MESSAGES (ERROR, DEBUG ...)
 2075  
     // //////////////////////////////////////////////////////////////////////////////////////////////
 2076  
 
 2077  
     /**
 2078  
      * This method allows the applet to post debug information to the website (see {@link #getUrlToSendErrorTo()}).
 2079  
      * Then, it is possible to log the error, to send a mail...
 2080  
      * 
 2081  
      * @param reason A string describing briefly the problem. The mail subject will be something like: Jupload Error
 2082  
      *            (reason)
 2083  
      * @param exception The java exception that was raised, or null if no exception.
 2084  
      */
 2085  
     public void sendDebugInformation(String reason, Exception exception);
 2086  
 
 2087  
     /**
 2088  
      * log an error message, based on an exception. Will be logged in the log window, if defined. <BR>
 2089  
      * The dialog box will only contain an Ok button. Same as caling: displayErr(e, JOptionPane.OK_OPTION);
 2090  
      * 
 2091  
      * @param e The exception to report
 2092  
      */
 2093  
     public void displayErr(Exception e);
 2094  
 
 2095  
     /**
 2096  
      * log an error message, based on an exception. Will be logged in the log window, if defined.<BR>
 2097  
      * 
 2098  
      * @param err The erreur message to be displayed. If null the exception (or it's cause if any) message is displayed.
 2099  
      * @param e The exception to report
 2100  
      * @param optionType One of the valid {@link JOptionPane} option types for the
 2101  
      *            {@link JOptionPane#showConfirmDialog(java.awt.Component, Object, String, int)} method:
 2102  
      *            OK_CANCEL_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION... -1 is also accepted, to only have the Ok
 2103  
      *            button. OK_OPTION is prohibited, as it has the same value as YES_NO_OPTION.
 2104  
      * @return The XXX_OPTION, corresponding to the button clicked by the user.
 2105  
      */
 2106  
     public int displayErr(String err, Exception e, int optionType);
 2107  
 
 2108  
     /**
 2109  
      * log an error message. Will be logged in the log window, if defined. <BR>
 2110  
      * The dialog box will only contain an Ok button.
 2111  
      * 
 2112  
      * @param err The erreur message to be displayed.
 2113  
      */
 2114  
     public void displayErr(String err);
 2115  
 
 2116  
     /**
 2117  
      * log an error message. Will be logged in the log window, if defined. <BR>
 2118  
      * The dialog box will only contain an Ok button.
 2119  
      * 
 2120  
      * @param err The error message to be displayed.
 2121  
      * @param e An exception. It's stacktrace is logged.
 2122  
      */
 2123  
     public void displayErr(String err, Exception e);
 2124  
 
 2125  
     /**
 2126  
      * log an info message. Will be logged in the log window, if defined.
 2127  
      * 
 2128  
      * @param info The information message that will be displayed.
 2129  
      */
 2130  
     public void displayInfo(String info);
 2131  
 
 2132  
     /**
 2133  
      * log a warning message. Will be logged in the log window, if defined.
 2134  
      * 
 2135  
      * @param warn The warning message that will be displayed.
 2136  
      */
 2137  
     public void displayWarn(String warn);
 2138  
 
 2139  
     /**
 2140  
      * log a debug message. Will be logged in the log window, if defined.
 2141  
      * 
 2142  
      * @param debug The message to display.
 2143  
      * @param minDebugLevel If the current debug level is superior or equals to minDebugLevel, the message will be
 2144  
      *            displayed. Otherwise, it will be ignored.
 2145  
      */
 2146  
     public void displayDebug(String debug, int minDebugLevel);
 2147  
 
 2148  
     // Others
 2149  
 
 2150  
     /**
 2151  
      * Add an header to the list of headers that will be added to each HTTP upload request. This method is called from
 2152  
      * specific uploadPolicies, which would need headers to be added to all uploads. These headers are used in
 2153  
      * {@link wjhk.jupload2.policies.DefaultUploadPolicy}.
 2154  
      * 
 2155  
      * @param header
 2156  
      * @see #onAppendHeader(ByteArrayEncoder)
 2157  
      */
 2158  
     public void addHeader(String header);
 2159  
 
 2160  
     /**
 2161  
      * Append specific headers for this upload (session cookies, for instance). This method is called while building
 2162  
      * each upload HTTP request.
 2163  
      * 
 2164  
      * @param sb The header {@link ByteArrayEncoder} where specific headers should be appended.
 2165  
      * @return The {@link ByteArrayEncoder} given in parameters. This is allows to work like with StringBuffer.append
 2166  
      *         method: sb.append(s1).append(s2);
 2167  
      * @throws JUploadIOException
 2168  
      * @see #addHeader(String)
 2169  
      * @see wjhk.jupload2.upload.FileUploadThread
 2170  
      */
 2171  
     public ByteArrayEncoder onAppendHeader(ByteArrayEncoder sb) throws JUploadIOException;
 2172  
 
 2173  
     /**
 2174  
      * This method is called each time a file is selected in the panel files. It allows, for instance, to preview a
 2175  
      * picture {@link wjhk.jupload2.policies.PictureUploadPolicy}.
 2176  
      * 
 2177  
      * @param fileData
 2178  
      */
 2179  
     public void onFileSelected(FileData fileData);
 2180  
 
 2181  
     /**
 2182  
      * Reaction when the user double click on a file, in the file list. Default is no reaction. In
 2183  
      * {@link PictureUploadPolicy}, it will open a {@link PictureDialog}.
 2184  
      * 
 2185  
      * @param fileData
 2186  
      */
 2187  
     public void onFileDoubleClicked(FileData fileData);
 2188  
 
 2189  
     /**
 2190  
      * Execute any action, that must be done before upload. For instance, {@link PictureUploadPolicy} disable the
 2191  
      * rotation buttons during buttons. The {@link DefaultUploadPolicy#beforeUpload()} method just returns true.
 2192  
      * 
 2193  
      * @return indicate if everything is ready for upload.
 2194  
      */
 2195  
     public boolean beforeUpload();
 2196  
 
 2197  
     /**
 2198  
      * This method returns true, if upload is a success. A HTTP response of "200 OK" indicates that the server response
 2199  
      * is techically correct. But, it may be a functionnal error. For instance, the server could answer by a proper HTTP
 2200  
      * page, that the user is no allowed to upload files. It's up to the uploadPolicy to check this, and answer true or
 2201  
      * false to this method. <br>
 2202  
      * This method is called once for each HTTP request toward the server. For instance, if the upload is done file by
 2203  
      * file, and there are three files to upload, this method will be called three times. <br>
 2204  
      * So this method is different from the {@link #afterUpload(Exception, String)}, that will be called only once in
 2205  
      * this case, after the three calls to the checkUploadSuccess method.
 2206  
      * 
 2207  
      * @param status The numeric response status (e.g. 200)
 2208  
      * @param msg The status message from the first line of the response (e.g. "200 OK").
 2209  
      * @param body The http body part (that is: the serverOuput without the http headers and the blank line that follow
 2210  
      *            them).
 2211  
      * @return true (or an exception is raised, instead of returning false). This garantees that all cases are handled:
 2212  
      *         the compiler will indicate an error if the code can come to the end of the method, without finding a
 2213  
      *         'return' or a throw exception. This return code can be ignored by the caller.
 2214  
      * @throws JUploadException Thrown if the success conditions are not met.
 2215  
      */
 2216  
     public boolean checkUploadSuccess(int status, String msg, String body) throws JUploadException;
 2217  
 
 2218  
     /**
 2219  
      * This method is called after an upload, whether it is successful or not. This method is called once for each click
 2220  
      * of the user on the 'upload' button. That is: if the nbFilesPerRequest is 2, and the user selected 5 files before
 2221  
      * clicking on the 'upload' button. Then the afterUpload is called once the 5 files were uploaded to the server.
 2222  
      * 
 2223  
      * @param e null if success, or the exception indicating the problem.
 2224  
      * @param serverOutput The full server output, including the HTTP headers.
 2225  
      * @throws JUploadException
 2226  
      */
 2227  
     public void afterUpload(Exception e, String serverOutput) throws JUploadException;
 2228  
 
 2229  
     /**
 2230  
      * Returns the current locale. It is the default value at startup, based on the local computer configuration. Then,
 2231  
      * if the lang applet parameter is given, this method the Locale initialized from this lang parameter.
 2232  
      * 
 2233  
      * @return The current Locale for the current policy.
 2234  
      */
 2235  
     public Locale getLocale();
 2236  
 
 2237  
     /**
 2238  
      * Retrieve a lang string, based on the file cointained in the wjhk.jupload2.lang package. This allows localization.
 2239  
      * 
 2240  
      * @param key The key, whose associated text is to retrieve. This text must respect the constraints of the
 2241  
      *            {@link String#format(String, Object...)} method, that is called in the
 2242  
      *            {@link DefaultUploadPolicy#getLocalizedString(String, Object...)} implementation of this method.
 2243  
      * @param args The optional parameters, that will replace the placeholders in the localized text identified by
 2244  
      *            'key'.
 2245  
      * @return The associated text.
 2246  
      */
 2247  
     public String getLocalizedString(String key, Object... args);
 2248  
 
 2249  
     /**
 2250  
      * Displays a MessageBox with a unique 'Ok' button, by calling the
 2251  
      * {@link JOptionPane#showMessageDialog(java.awt.Component, Object)} method.
 2252  
      * 
 2253  
      * @param key The string identifying the text to display, depending on the current language.
 2254  
      * @see #alertStr(String)
 2255  
      */
 2256  
     public void alert(String key);
 2257  
 
 2258  
     /**
 2259  
      * Displays a MessageBox with a unique 'Ok' button, by calling the
 2260  
      * {@link JOptionPane#showMessageDialog(java.awt.Component, Object)} method.
 2261  
      * 
 2262  
      * @param str The full String that must be displayed to the user.
 2263  
      * @see #alert(String)
 2264  
      */
 2265  
     public void alertStr(String str);
 2266  
 
 2267  
     /**
 2268  
      * Displays a MessageBox with a unique 'Ok' button, by calling the
 2269  
      * {@link JOptionPane#showConfirmDialog(java.awt.Component, Object, String, int)} method.
 2270  
      * 
 2271  
      * @param str The full String that must be displayed to the user.
 2272  
      * @param optionTypes The options indicating the button to display. Valid options are the options valid for the
 2273  
      *            {@link JOptionPane#showConfirmDialog(java.awt.Component, Object, String, int)} method.
 2274  
      * @return The JOptionConstant that indicates the button the user cliecked on (for instance OK_OPTION)
 2275  
      * @see #alert(String)
 2276  
      */
 2277  
     public int confirmDialogStr(String str, int optionTypes);
 2278  
 
 2279  
     /**
 2280  
      * Indicates that an error occurs.
 2281  
      * 
 2282  
      * @return The last Exception that occurs in the applet. null if no exception occurs.
 2283  
      */
 2284  
     public JUploadException getLastException();
 2285  
 
 2286  
     /**
 2287  
      * Retrieve the body of the last server response.
 2288  
      * 
 2289  
      * @return The string containing the last server response (body);
 2290  
      */
 2291  
     public String getLastResponseBody();
 2292  
 
 2293  
     /**
 2294  
      * Retrieve the status/error message of the last server response.
 2295  
      * 
 2296  
      * @return The string containing either the last server status or (if the error regex matches, the parsed error
 2297  
      *         message.
 2298  
      */
 2299  
     public String getLastResponseMessage();
 2300  
 }