public class Server extends Object
| Constructor and Description |
|---|
Server(int port,
File apiKeysFile)
Launches a server on the specified port with the specified api keys.
|
Server(int port,
String apiKeysFileName)
Launches a server on the specified port with the specified api keys.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
createResponse(Object receivedObject)
Called when the server receives an object.
|
Properties |
getApiKeys()
Returns the currently served api keys
|
void |
readUsedPublicKeys()
Causes the server to re-read the already used (and thus blocked) public RSA keys from disk.
|
void |
readUsedPublicKeys(String filePath)
Causes the server to re-read the already used (and thus blocked) public RSA keys from disk.
|
boolean |
resetPermanently()
Resets the list of used public RSA keys permanently by deleting the corresponding file on the drive.
|
boolean |
resetPermanently(String pathToUsedKeysFile)
Resets the list of used public RSA keys permanently by deleting the corresponding file on the drive.
|
void |
resetTemporarily()
Resets the list of public RSA keys temporarily (until the server is rebooted)
|
void |
saveUsedPublicKeys()
Saves the list of used (and thus blocked) public RSA keys to the default location (
<appDataPath>/com.github.vatbub.safeAPIKeyStore.server/usedPublicKeys) |
void |
saveUsedPublicKeys(String filePath)
Saves the list of used (and thus blocked) public RSA keys to the specified location
|
void |
stop()
Shuts the server down.
|
public Server(int port,
String apiKeysFileName)
throws IOException
port - The port to run the server onapiKeysFileName - The absolute or relative file path to the properties-file that contains the api keys to serveIOException - If the server fails to launch for any reason.public Server(int port,
File apiKeysFile)
throws IOException
port - The port to run the server onapiKeysFile - The properties-file that contains the api keys to serveIOException - If the server fails to launch for any reason.public Properties getApiKeys()
public Object createResponse(Object receivedObject)
receivedObject - The object received by the servernull to send no response at allpublic void readUsedPublicKeys()
<appDataPath>/com.github.vatbub.safeAPIKeyStore.server/usedPublicKeys)public void readUsedPublicKeys(String filePath)
filePath - The absolute or relative path to the file to read the used keys list frompublic void saveUsedPublicKeys()
throws FileNotFoundException
<appDataPath>/com.github.vatbub.safeAPIKeyStore.server/usedPublicKeys)FileNotFoundException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reasonpublic void saveUsedPublicKeys(String filePath) throws FileNotFoundException
filePath - The absolute or relative path to the file to save the list inFileNotFoundException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reasonpublic boolean resetPermanently()
<appDataPath>/com.github.vatbub.safeAPIKeyStore.server/usedPublicKeys).true if the server was reset permanently, false if only temporarilyresetTemporarily()public boolean resetPermanently(String pathToUsedKeysFile)
pathToUsedKeysFile - The absolute or relative path to the file that contains the list of used public RSA keystrue if the server was reset permanently, false if only temporarilyresetTemporarily()public void resetTemporarily()
public void stop()
Copyright © 2016–2018 Frederik Kammel. All rights reserved.