📄 uploadpolicy.java
字号:
* <i>See also maxPicWidth, realMaxPicHeight</i> </td>
* </tr>
* <tr>
* <td>serverProtocol</td>
* <td>null since 2.9.2rc4<br>
* (before: "HTTP/1.1")<br>
* <br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
* <td>This parameter allows the control of the protocol toward the server. It
* can be HTTP/0.9 (not tested), HTTP/1.0, HTTP/1.1 and FTP. HTTP supports
* https. Since version 2.9.2rc4, the default is <i>null</i>, introducing a new
* facility of automatically adjusting the protocol according to the server
* response.<br>
* This parameter is really useful only in
* {@link wjhk.jupload2.policies.CoppermineUploadPolicy}, as the coppermine
* application also controls that the requests send within an HTTP session uses
* the same HTTP protocol (as a protection to limit the 'steal' of session
* cookies). </td>
* </tr>
* <tr>
* <td>showLogWindow<br>
* Since 3.0.2<br>
* Changed in 3.5.0</td>
* <td>true<br>
* <br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
* <td>This parameter was formerly known as <i>showStatusBar</i> which now has
* a different purpose. <BR>
* <U>Since 3.5.0:</U> Available values are (case sensitive):<DIR>
* <LI>true: always visible.
* <LI>false: always hiden.
* <LI>onError: the log window is hidden. It will be displayed when an error
* occurs. If you put 99 into the debugLevel, then the full debugOutput become
* visible if and only if an error occurs</DIR> <BR>
* <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 applet will still store all debug
* information in it. But the user won't see it any more. If a problem occurs,
* the <i>urlToSendErrorTo</i> can still be used to log all available
* information. </td>
* </tr>
* <tr>
* <td>showStatusBar</td>
* <td>True<br>
* <br>
* New meaning since 3.0.2<br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
* <td>This parameter controls if the status bar is shown in the applet. If
* shown, the stausbar provides information about the current transfer speed and
* estimated time of completion. Before version 3.0.2, this parameter was used
* to control visibility of the log window. This is now controlled by
* <i>showLogWindow</i>.</td>
* </tr>
* <tr>
* <td>specificHeaders</td>
* <td><I>null</I><br>
* <br>
* Since 3.0.2<br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
* <td>Allows the caller to add any header(s) to the applet. These headers will
* be sent with each HTTP request to the server. If you put several lines in
* this parameter, these parameter should be separated by the "\n" string (not
* the \n character, but the \ character followed by the n character, like
* msg="\\n";). No "\\n" at the end: it will be added by the applet. <BR>
* This allows an easy management of <B>Basic HTTP authentication</B>. Just add
* a header like this one:<BR>
* Authorization: Basic Base64EncodedString Where Base64EncodedString is the
* string "login:passord" encoded in Base 64. </td>
* </tr>
* <tr>
* <td>sslVerifyCert<br>
* Since 3.0.2b1</td>
* <td>none<br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
* <td>With this parameter, the handling of certificates when using SSL can be
* configured. There are 4 possible settings:<br>
* <ul>
* <li><i>none</i> (default): Any server cert is accepted, no cert-based
* client authentication is performed.</li>
* <li><i>server</i>: The server cert is verified against the local truststore
* and if that fails, a dialog pops up which asks the user if the certificate
* shall be accepted permanently, just for the current session or not at all
* (Just like any browser would do).</li>
* <li><i>client</i>: A user-certificate (which must be available in the local
* keystore) is used to perform client authentication.</li>
* <li><i>strict</i>: The combination of <i>client</i> and <i>server</i>.</li>
* </ul>
* <p>
* The location of the local truststore and keystore uses the normal JRE
* conventions. This means, that the system truststore is used for verifying
* server certs (usually in $JAVA_HOME/lib/security/cacerts) unless either the
* system property <i>javax.net.ssl.trusStore</i> specifies another location or
* a file <b>.truststore</b> exists in the user's home directory. If the user
* decides to permanently accept an untrusted certificate, the file
* <b>.truststore</b> in the user's home directory is written. The default
* keystore (for client certificates) is the file <b>.keystore</b> in the
* user's home directory. This can be overridden by setting the system property
* <i>javax.net.ssl.keyStore</i>. If the name of the keystore ends in <b>.p12</b>,
* it is assumed that the keystore is in <b>PKCS12</b> format, otherwise the
* default format as specified in the JRE security-configuration is used.
* <p>
* <b>Important Note about client authentication:</b>
* <p>
* At the time of this writing, a <i>serious</i> bug exists in apache 2.0.x
* which prevents POST requests when SSL renegotiation is about to happen.
* Renegotiation is triggered by a location-based (or directory-based) change of
* the SSLVerifyClient directive in apache. Therefore you <b>can not</b>
* protect a sub-area of an otherwise unprotected SSL server. You can circumvent
* that by setting up a virtualhost which is configured to perform SSL client
* verification <b>for the complete virtualhost</b>. Attached to the bug report
* at <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=12355">ASF
* Bugzilla</a>, there are several patches which claim to fix the problem.
* However in that same report, other users complain about those patches to be
* ineffective. Therefore, the author recommends avoiding re-negotiation
* alltogether by using the virtualhost aproach described above. It is the
* understanding of the author, that this bug has been fixed for apache 2.2,
* however the author did not verify that. Test-Reports from users running
* apache 2.2 are welcome.</td>
* </tr>
* <tr>
* <td>storeBufferedImage</td>
* <td>false <br>
* <I>Deprecated</I> <br>
* {@link wjhk.jupload2.policies.PictureUploadPolicy}</td>
* <td>This parameter indicates that the preview image on the applet is kept in
* memory. It works really nice under eclise. But, once in the navigator, the
* applet runs very quickly out of memory. So I add a lot of calls to
* {@link wjhk.jupload2.filedata.PictureFileData#freeMemory(String)}, but it
* doesn't change anything. Be careful to this parameter, and let it to the
* default value, unless you've well tested it under all your target client
* configurations. <BR>
* <I>This parameter will probably never be correctly implemented.</I> </td>
* </tr>
* <tr>
* <td>stringUploadError</td>
* <td>Since 3.2.0: "^ERROR: (.*)$" for all upload policies<br>
* Empty string ("") [if using DefaultUploadPolicy]<br>
* "ERROR: (.*)" [if using CopperminUploadPolicy]<br>
* <br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}<br>
* Since 2.9.2rc4</td>
* <td>This string is a regular expression. It allows the applet to test that
* the server has detected an error in the upload. If this parameter is given to
* the applet, the upload thread will try to match this regular expression
* against each line of the server response <b>body</b>. If a group is found,
* it is considered as the error message, and will be displayed to the user.<br>
* If the match is successfull once, the upload is considered to have failed.
* and {@link wjhk.jupload2.exception.JUploadExceptionUploadFailed} is thrown.
* If the expression contains a hunt-group, the matching contents of that group
* is reported to the user. For example: If let the default value "^ERROR:
* (.*)$" here, the applet will find an error if at least one line returned in
* the server response begins with "ERROR: ". Then, all characters that follow
* are extracted as the error message. So, if the server response contains the
* line "ERROR: md5sum check failed", the string "md5sum check failed" is used
* for the exception message. But if it returns a line "maybe ERROR: is it an
* error?", then the applet won't find any error in the server response.</td>
* </tr>
* <tr>
* <td>stringUploadSuccess</td>
* <td>"^SUCCESS$"<br>
* empty string ("") since 2.9.0<br>
* (was ".* 200 OK$" before) <br>
* <br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
* <td>This string is a regular expression. It allows the applet to test that
* the server has accepted the upload. If this parameter is given to the applet,
* the upload thread will try to match this regular expression against each
* lines returned from the server.<br>
* If the match is successfull once, the upload is considered to be a success.
* If not, a {@link wjhk.jupload2.exception.JUploadExceptionUploadFailed} is
* thrown. <br>
* The default test expression testes that the web server returns no HTTP error:
* 200 is the return code for a successfull HTTP request. It actually means that
* postURL is a valid URL, and that the applet was able to send a request to
* this URL: there should be no problem with the network configuration, like
* proxy, password proxy...). <br>
* <b>But</b> it doesn't mean that the uploaded files have correctly be managed
* by the server. For instance, the URL can be http://sourceforge.net, which, of
* course, would not take your files into account. <br>
* So, as soon as you know a regular expression that test the return from the
* target application (and not just a techical HTTP response code), change the
* stringUploadSuccess to this value. For instance, the default value will be
* matched if the HTTP body content of the server response contains one line
* that is exactly 'SUCCESS', without any other character. This 'success' means
* that the pictures have correctly uploaded to the server, and that he
* successfully managed the uploaded files. </td>
* </tr>
* <tr>
* <td>stringUploadWarning</td>
* <td>"^WARNING: (.*)$" <br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}<br>
* Since 3.4.2</td>
* <td>This string is a regular expression. It allows the applet to test that
* the server has detected a warning was generated by the server. This warning
* is just a warning, that will be displayed to the user, as is. There may be
* several warnings in the server return. If one or more warning is/are
* received, the message(s) will be displayed to the user.<BR>
* If the expression contains a hunt-group, the matching contents of that group
* is reported to the user. For example: If you let the default value "^WARNING:
* (.*)$" here, the applet will find an error if at least one line returned in
* the server response begins with "WARNING: ". Then, all characters that follow
* are extracted as the error message. So, if the server response contains the
* line "WARNING: Bad encoding", the string "Bad encoding" is displayed as
* warning message to the user. But if it returns a line "maybe WARNING: is it
* an error?", then the applet won't find any warning in the server response.<BR>
* <B>Note:</B> there is no link between these warning and the fact the upload
* is considered to be a success or not. Upload success is only based on the
* success and error string. See the <B>stringUploadSuccess</B> and
* <B>stringUploadError</B> applet parameters, here above. </td>
* </tr>
* <tr>
* <td>targetPictureFormat</td>
* <td><i>Empty String</i> <br>
* <br> (<b>to be</b> implemented in
* {@link wjhk.jupload2.policies.PictureUploadPolicy})</td>
* <td>This parameter can contain any picture writer known by the JVM. For
* instance: jpeg, png, gif. All standard formats should be available. More
* information can be found on the <a
* href="http://java.sun.com/j2se/1.4.2/docs/guide/imageio/spec/title.fm.html">java.sun.com</a>
* web site. </td>
* </tr>
* <tr>
* <td><b>uploadPolicy</b></td>
* <td>DefaultUploadPolicy <br>
* <br>
* see {@link wjhk.jupload2.policies.UploadPolicyFactory}</td>
* <td>This parameter contains the class name for the UploadPolicy that should
* be used. If it is not set, or if its value is unknown from
* {@link wjhk.jupload2.policies.UploadPolicyFactory#getUploadPolicy(JUploadApplet)},
* the {@link wjhk.jupload2.policies.DefaultUploadPolicy} is used. </td>
* </tr>
* <tr>
* <td>urlToSendErrorTo</td>
* <td><i>null</i> <br>
* <br>
* {@link wjhk.jupload2.policies.DefaultUploadPolicy}</td>
* <td>If this url is given, and an upload error occurs, the applet posts all
* debug output to this address. It's up to 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 a mail (like the mail.php script given with the coppermine pack). <br>
* <u>Notes:</u> <DIR>
* <LI>Only http and https URL schemes are supported.</LI>
* <LI>The error information is sent in a POST request sent to the given URL.
* These post parameters are used: description (a quick description of the
* error), javaError (the java output for the error, or null if no java error
* were caught) and debugOutput (the full debug generated by the applet).</LI>
* </DIR></td>
* </tr>
* </table>
* <h3><a name="example">HTML call example</a></h3>
* <p>
* Below, an example of how to put the applet into a PHP page is shown:
* </p>
* <code><pre>
* <applet name="JUpload" code="wjhk.jupload2.JUploadApplet"
* archive="plugins/jupload/wjhk.jupload.jar"
* <!-- Applet display size, on the navigator page -->
* width="500" height="700"
* <!-- The applet uses some javascript functions, so we must allow that : -->
* mayscript>
* <!-- No parameter is mandatory. We don't precise the UploadPolicy, so
* DefaultUploadPolicy is used. The applet behaves like the original
* JUpload. (jupload v1) -->
* <param name="postURL" value="http://some.host.com/youruploadpage.php">
* Java 1.5 or higher plugin required.
* </applet>
* </pre></code> <BR>
* <!-- ANT_COPYDOC_END --> <!-- ATTENTION: The previous comment is used by Ant
* build. DO NOT CHANGE!! -->
*
* @author etienne_sf
* @version $Revision: 634 $
* @see wjhk.jupload2.policies.DefaultUploadPolicy
*/
public interface UploadPolicy {
/*
* Available parameters for the applet. New parameters (for instance for new
* policies) should all be added here, in alphabetic order. This ensures
* that all tags are unique
*/
/***************************************************************************
* ************************************************************************
* ************************* LIST OF PROPERTIES **************************
* ************************************************************************
**************************************************************************/
/**
* Parameter/Property name for URL to be loaded after an successful upload.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -