wt.clients.util.http
Class UploadApplet
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
wt.clients.util.http.UploadApplet
- All Implemented Interfaces:
- Accessible, ImageObserver, MenuContainer, Serializable
- Direct Known Subclasses:
- RemoteWorkerUploadApplet
- public class UploadApplet
- extends Applet
Applet for uploading and downloading files via HTTP.
May be used for either single or multiple upload destinations. If multiple, concatenated
target files will be uploaded to their corresponding concatenated uploadURLs, but all
secondary content attachments will be uploaded to the first of the uploadURLs.
This applet accepts several initialization parameters.
<param name="target" value="e:\abcd\efgh\file.txt"> (for multiple destinations, may concatenate with contentDelim value)
<param name="debug" value="TRUE" or "FALSE"> default is "FALSE"
<param name="bgcolor" value="########"> decimal integer value of the desired background color, default is 14934992
This is a decimal integer giving the red, green, and blue components
where the red component is in bits 16-23 of the argument,
the green component is in bits 8-15 of the argument,
and the blue component is in bits 0-7.
The value zero indicates no contribution from the primary color component.
Example: for the hex RGB color #E3E3CF, the bgcolor value would be "14934992". For #0000FF, bgcolor="255".
<param name="wt.context.locale" value="XX"> locale tag for current browser language
<param name="workspacePath" value="drive\directory\filename"> user preference workspacePath value, if set
<param name="validEmptyFile" value="TRUE" or "FALSE"> default is "FALSE"
<param name="callingAction" value="create" or "updateReplace">
<param name="uploadURL" value=URL to upload files to (for multiple destinations, may concatenate with contentDelim value)
<param name="attachments" value=concatenated attachments transactions in the form of FILE + "newfile"|oid + DELIM + filepath + DELIM + "ADD"|"REMOVE", with RECORD_DELIM between the transactions
<param name="contentDelim" DELIM used in attachments and uploadURL strings, defaults to ";;;qqq">
<param name="contentRecordDelim" RECORD_DELIM used in attachments string, defaults to ";;;zzz">
<param name="completionUrl" value=URL to go to after successful completion of upload>
<param name="failureUrl" value=URL to go to if primary target is invalid or upload fails>
<param name="jsFeedbackMethod" value=method name of JavaScript method that displays invalid filepaths - must accept two arguments, the paths and the URL to go to next, i.e. function displayFeedback( invalidPaths, nextUrl ), defaults to "displayInvalidPaths">
<param name="multipleQuantity" value=if uploading multiple target files to multiple uploadURLs, how many are there? (multiple primaries assumes primary files only, not primary URLs)
<param name="targetType" value="FILE" or "URL" or "NONE" for non-multiple situation, defaults to "FILE"
<param name="uploadImpl" value="rmi" or "http", defaults to "rmi"
The following parameters are only relevant when callingAction=updateReplace:
<param name="continueIfFileNotFound" value="true" or "false"> user preference - whether to automatically continue the operation if filepath is invalid
<param name="continueIfFileUnchanged" value="true" or "false"> user preference - whether to automatically continue the operation if local file is identical to Windchill file
<param name="uploadIfFileChanged" value="true" or "false"> user preference - whether to automatically upload if the local file is different than the Windchill file
<param name="checksum" value=persisted checksum of current persisted primary content>
<param name="persistedFilename" value=persisted filename (no path) of current persisted primary content
<param name="oidString" value=OID of current persisted primary content ApplicationData object>
Note: oidString must be in the format of "wt.content.ApplicationData:1437923". Attempting to use an OID with a leading "OR:", such as "OR:wt.content.ApplicationData:1437923", will likely result in server-side failure to persist the uploaded object.
Supported API:true
Extendable:false
- See Also:
- Serialized Form
Fields inherited from class java.applet.Applet |
|
Fields inherited from class java.awt.Panel |
|
Fields inherited from class java.awt.Container |
|
Methods inherited from class java.applet.Applet |
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
DOCUMENTOID
private static final String DOCUMENTOID
- See Also:
- Constant Field Values
UNKNOWN
protected static final int UNKNOWN
- See Also:
- Constant Field Values
NO_UPLOAD
protected static final int NO_UPLOAD
- See Also:
- Constant Field Values
DO_UPLOAD
protected static final int DO_UPLOAD
- See Also:
- Constant Field Values
CANCEL
protected static final int CANCEL
- See Also:
- Constant Field Values
SUCCESS
protected static final int SUCCESS
- See Also:
- Constant Field Values
FAILURE
protected static final int FAILURE
- See Also:
- Constant Field Values
FILE_NOT_FOUND
protected static final int FILE_NOT_FOUND
- See Also:
- Constant Field Values
FILE_UNCHANGED
protected static final int FILE_UNCHANGED
- See Also:
- Constant Field Values
DECLINED_UPLOAD
protected static final int DECLINED_UPLOAD
- See Also:
- Constant Field Values
TARGET_TYPE_FILE
public static final int TARGET_TYPE_FILE
- See Also:
- Constant Field Values
TARGET_TYPE_URL
public static final int TARGET_TYPE_URL
- See Also:
- Constant Field Values
TARGET_TYPE_NONE
public static final int TARGET_TYPE_NONE
- See Also:
- Constant Field Values
CREATE_ACTION
public static final String CREATE_ACTION
- See Also:
- Constant Field Values
UPDATE_ACTION
public static final String UPDATE_ACTION
- See Also:
- Constant Field Values
DEBUG_STRING
public static final String DEBUG_STRING
- See Also:
- Constant Field Values
UPLOAD_IMPL
public static final String UPLOAD_IMPL
- See Also:
- Constant Field Values
initSync
private static Object initSync
CONTENT_RESOURCES
private static String CONTENT_RESOURCES
RESOURCE
private static String RESOURCE
CONTINUE_IF_FILE_NOT_FOUND
protected static String CONTINUE_IF_FILE_NOT_FOUND
CONTINUE_IF_FILE_UNCHANGED
protected static String CONTINUE_IF_FILE_UNCHANGED
UPLOAD_IF_FILE_CHANGED
protected static String UPLOAD_IF_FILE_CHANGED
WORKSPACE_PATH
protected static String WORKSPACE_PATH
UPLOAD_URL
protected static String UPLOAD_URL
CALLING_ACTION
protected static String CALLING_ACTION
VALID_EMPTY_FILE
protected static String VALID_EMPTY_FILE
SECONDARY_CONTENT
protected static String SECONDARY_CONTENT
CONTENT_RECORD_DELIM
protected static String CONTENT_RECORD_DELIM
CONTENT_DELIM
protected static String CONTENT_DELIM
TARGET_TYPE
protected static String TARGET_TYPE
uploadDownload
private HTTPUploadDownload uploadDownload
uploadDownloadView
private HTTPUploadDownloadView uploadDownloadView
contextGroup
private ThreadGroup contextGroup
DEBUG
protected boolean DEBUG
continueIfFileNotFound
protected boolean continueIfFileNotFound
continueIfFileUnchanged
protected boolean continueIfFileUnchanged
uploadIfFileChanged
protected boolean uploadIfFileChanged
validEmptyFile
protected boolean validEmptyFile
removable
protected boolean removable
workspacePath
protected String workspacePath
persistedFilename
protected String persistedFilename
callingAction
protected String callingAction
docOperation
protected String docOperation
fileAccess
private FileAccess fileAccess
uploadStatus
protected int uploadStatus
multipleQuantity
protected int multipleQuantity
localChecksum
protected long localChecksum
existingChecksum
protected long existingChecksum
uploadPath
protected String uploadPath
defaultFilename
protected String defaultFilename
uploadURL
protected String uploadURL
invalidPathsDisplay
protected String invalidPathsDisplay
secondaryContent
protected String secondaryContent
contentRecordDelim
protected String contentRecordDelim
contentDelim
protected String contentDelim
targetType
protected int targetType
jsFeedbackMethod
protected String jsFeedbackMethod
uploadImpl
protected String uploadImpl
uploadToCacheOnly
protected boolean uploadToCacheOnly
hostName
protected String hostName
sessionID
protected String sessionID
formName
protected String formName
UploadApplet
public UploadApplet()
init
public void init()
start
public void start()
stop
public void stop()
destroy
public void destroy()
updateContent
public void updateContent()
updateMultiple
public void updateMultiple()
validateFiles
protected void validateFiles()
validateTarget
protected void validateTarget()
validateAttachments
protected void validateAttachments()
stripInvalidAttachments
protected void stripInvalidAttachments()
saveContent
protected boolean saveContent()
saveContent
protected boolean saveContent(boolean primaryUpload)
getUrl
private URL getUrl()
isValidTarget
public boolean isValidTarget(String target)
getFileAccess
private FileAccess getFileAccess()
getParameter
public String getParameter(String paramName,
String defaultParamValue)
checksumsMatch
private boolean checksumsMatch()
getParentApplet
public Applet getParentApplet()
getParentFrame
public Frame getParentFrame()
confirm
private boolean confirm(String displayMessage)
getContext
private WTContext getContext()
escape
private String escape(String source)
parseIntoArray
private String[] parseIntoArray(String parseFrom,
String delimiter,
int arraySize)
browseForFile
public String browseForFile(String path)
- Browse local file system. The file name that is located will be
used for the pending upload or download. The result of this browse
will become the first or primary file.
isDirectory
public boolean isDirectory(String path)
createValidDefaultPath
public String createValidDefaultPath(String path)
sendKeyValueToServer
public String sendKeyValueToServer(String key,
String value)
throws Exception
- Throws:
Exception