001    /*
002     * Created by IntelliJ IDEA.
003     * User: d@hd.org
004     * Date: 21-May-02
005     * Time: 21:35:07
006    
007    Copyright (c) 1996-2012, Damon Hart-Davis
008    All rights reserved.
009    
010    Redistribution and use in source and binary forms, with or without
011    modification, are permitted provided that the following conditions are
012    met:
013    
014      * Redistributions of source code must retain the above copyright
015        notice, this list of conditions and the following disclaimer.
016    
017      * Redistributions in binary form must reproduce the above copyright
018        notice, this list of conditions and the following disclaimer in the
019        documentation and/or other materials provided with the
020        distribution.
021    
022    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
023    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
024    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
025    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
026    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
027    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
028    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
029    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
030    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
031    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
032    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
033    
034     */
035    package org.hd.d.pg2k.svrCore.uploader;
036    
037    import org.hd.d.pg2k.svrCore.FileTools;
038    
039    /**Constants pertaining to exhibit upload.
040     * Some of these may be set dynamically in future, ie
041     * from GenProps or similar.
042     */
043    public final class UploaderConsts
044        {
045        /**Hopefully-unique (but constant between runs) window name to place search page in. */
046        public static final String searchWindow = "searchPaGe4UpLoad";
047    
048        /**Attribute (and form field) name under which we store (verified) contributor ID (initials).
049         * Prefix with "X-" to use as an HTTP header.
050         */
051        public static final String USERID_FIELD_NAME = "userID";
052    
053        /**Form field name for user password.
054         * Prefix with "X-" to use as an HTTP header.
055         */
056        public static final String PASSWD_FIELD_NAME = "userPass";
057    
058        /**Attribute name under which we store UploadInfoBean. */
059        public static final String attrUIB = "uib";
060    
061        /**Name of parameter containing exhibit file for upload. */
062        public static final String exhibitFile = "exhibitFile";
063    
064        /**Field name to be present to upload or login pages to force a logout. */
065        public static final String LOGOUT_FIELD_NAME = "logout";
066    
067        /**Header name on login page to indicate user is logged in.
068         * Must start with "X-" to avoid breaking any other code.
069         */
070        public static final String LOGGED_IN_HEADER = "X-LoggedIn";
071    
072        /**Login page root-relative URL (starting with '/'). */
073        public static final String LOGIN_URL = "/_upload/login.jsp";
074    
075        /**Minimum free space we will contemplate even attempting an upload at.
076         * Note that this had probably better be at least a couple of blocks,
077         * to represent filesystem consumption for directory and file data,
078         * and anyway tiny uploads are not likely to be much use!
079         */
080        public static final int MIN_UPLOAD_SPACE_BYTES =
081            2 * FileTools.FS_EST_BLOCK_SIZE_BYTES;
082    
083        /**If true, then we can pipeline multiple batch uploads in one POST to the non-browser upload servlet. */
084        public static final boolean BATCH_UPLOADS_CAN_BE_PIPELINED = true;
085    
086        /**Maximum time uploader connection should stay idle before being shut, ms; strictly positive.
087         * As connections for batch uploads are non-interactive
088         * this need only be long enough to allow for:
089         * <ul>
090         * <li>Glitches in connectivity and TCP/IP data flow.
091         * <li>Client and server turnaround time moving to the next upload.
092         * </ul>
093         * <p>
094         * This period applies while no upload is in progress;
095         * a somewhat longer timeout should apply during upload
096         * to avoid glitches forcing an upload to be started again later.
097         * <p>
098         * A few tens of seconds should suffice,
099         * and help free unused resources quickly.
100         */
101        public static final int BATCH_UPLOAD_MAX_IDLE_MS = 30000;
102        }