com.compoze.util
Class TemporaryFileServer
java.lang.Object
|
+--com.compoze.util.TemporaryFileServer
- public class TemporaryFileServer
- extends java.lang.Object
This class is a server that listens for incoming requests to create and
provide access to a temporary file. A new thread is created to handle each
incoming request. The temporary file names may be either chosen by the
client or generated by the server. When the name is chosen by the client, a unique
temporary directory is created so that there will be no filename conflicts.
The process for connecting to the client is as follows:
- Open the connection.
- Present a header and a 64 byte random challenge to the client.
- Verify that the client properly produces an SHA digest of the challenge
and the password.
- Accept the filename from the client or a request to generate one.
- Create the local file and give the filename back to the client.
- Write all data from the client into the file.
- After receiving notification that the client is done, or after the
connection to the client fails, delete the file.
- Close the connection.
When running the main()
method in this class, Java system
properties may be specified to configure the server. The following table
describes the effect of the different properties:
Property
| Description
| Required?
| Default
|
password
| Sets the password that clients must use to gain access to the server.
| Yes
| N/A
|
ip
| Sets the IP address that the server listens on.
| No
| All local addresses
|
port
| Sets the port that the server listens on.
| No
| 2112
|
tempdir
| Sets the location of the temporary directory.
| No
| java.io.tmpdir Java system property
|
log
| Sets whether or not logging is enabled (true/false).
| No
| true
|
- See Also:
TemporaryFileClient
Constructor Summary |
TemporaryFileServer(java.net.InetAddress listenAddress,
int iPort,
java.lang.String sPassword,
java.io.File tempDir,
boolean bLog,
boolean bSSL)
Constructor. |
Method Summary |
static void |
main(java.lang.String[] args)
Main. |
void |
run()
Runs the server. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_PORT
public static final int DEFAULT_PORT
TemporaryFileServer
public TemporaryFileServer(java.net.InetAddress listenAddress,
int iPort,
java.lang.String sPassword,
java.io.File tempDir,
boolean bLog,
boolean bSSL)
throws java.security.NoSuchAlgorithmException,
java.io.UnsupportedEncodingException
- Constructor.
- Parameters:
listenAddress
- the listen IP addressiPort
- the server portsPassword
- the server passwordbLog
- if true, do logging- Throws:
java.security.NoSuchAlgorithmException
- if algorithm not supportedjava.io.UnsupportedEncodingException
- if UTF-8 not supported
run
public void run()
throws java.io.IOException
- Runs the server.
- Throws:
java.io.IOException
- if the server could not listen on the specified
IP or port
main
public static void main(java.lang.String[] args)
- Main.
- Parameters:
args
- command line arguments
Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.