org.apache.turbine.services.xmlrpc.util
Class FileHandler
java.lang.Object
|
+--org.apache.turbine.services.xmlrpc.util.FileHandler
- Direct Known Subclasses:
- AuthenticatedFileHandler
- public class FileHandler
- extends java.lang.Object
A Handler for use with the XML-RPC service that will deal
with clients sending file to the server (Turbine application)
and clients getting files from the server (Turbine application).
1) In the first case where the client sends a file to the server,
the client has encoded the file contents and passes those
encoded file contents on to the server:
Client --------> encoded file contents -------------> Server
The server must then decode the file contents and write the
decoded file contents to disk.
2) In the second case where the client gets a file from the
the server, the server has encoded the file contents and
passes those encoded file contents on to the client:
Client <------- encoded file contents <------------- Server
The client must then decode the file contents and write the
decoded file contents to disk.
- Version:
- $Id: FileHandler.java,v 1.4 2001/10/18 20:24:10 thorhauer Exp $
- Author:
- Jason van Zyl, Jon S. Stevens
Method Summary |
java.lang.String |
get(java.lang.String targetLocationProperty,
java.lang.String fileName)
The client has indicated that it would like
to get a file from the server. |
static java.lang.String |
readFileContents(java.lang.String targetLocationProperty,
java.lang.String fileName)
Return the content of file encoded for transfer |
static void |
remove(java.lang.String sourceLocationProperty,
java.lang.String sourceFileName)
Method to allow a client to remove a file from
the server |
boolean |
send(java.lang.String fileContents,
java.lang.String targetLocationProperty,
java.lang.String fileName)
The client has indicated that it would like
to send a file to the server and have it
stored in a certain location on the server. |
static boolean |
writeFileContents(java.lang.String fileContents,
java.lang.String targetLocationProperty,
java.lang.String fileName)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileHandler
public FileHandler()
- Default Constructor
send
public boolean send(java.lang.String fileContents,
java.lang.String targetLocationProperty,
java.lang.String fileName)
- The client has indicated that it would like
to send a file to the server and have it
stored in a certain location on the server.
So a client Turbine application might use the
following bit of code to send a file to a server
Turbine application:
TurbineXmlRpc.executeRpc("file.send", params)
Where:
params.get(0) = contents of the file as a string.
params.get(1) = the name the file should have when it lands.
params.get(2) = property describing where the file should land.
- Parameters:
fileContents:
- The contents of the file to store. It
is assumed that any xml content is properly encoded!fileName:
- Name to give the file created to store
the contents.targetLocationProperty:
- storage location of this file
is controlled by this property that is specified in
the TR.props file or an included properties file.
get
public java.lang.String get(java.lang.String targetLocationProperty,
java.lang.String fileName)
- The client has indicated that it would like
to get a file from the server.
So a client Turbine application might use the
following bit of code to get a file from a server
Turbine application:
TurbineXmlRpc.executeRpc("file.get", params)
Where:
params.get(0) = the name the file should have when it lands.
params.get(1) = property describing where the file should land.
- Parameters:
fileName:
- Name to give the file created to store
the contents.targetLocationProperty:
- storage location of this file
is controlled by this property that is specified in
the TR.props file or an included properties file.- Returns:
- the file contents encoded with base64.
readFileContents
public static java.lang.String readFileContents(java.lang.String targetLocationProperty,
java.lang.String fileName)
- Return the content of file encoded for transfer
- Parameters:
file:
- path to file to encode.- Returns:
- String encoded contents of the requested file.
writeFileContents
public static boolean writeFileContents(java.lang.String fileContents,
java.lang.String targetLocationProperty,
java.lang.String fileName)
remove
public static void remove(java.lang.String sourceLocationProperty,
java.lang.String sourceFileName)
- Method to allow a client to remove a file from
the server
- Parameters:
serverURL
- sourceLocationProperty
- sourceFileName
-
Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.