Offord, Victoria wrote:
> I'm trying to transfer the files held in a project into an external
> system but I require the location the file is stored so that it can be
> passed into a Perl script which will copy the file. I am unable to get
> the location of the file held within the Java 'File' class because the
> method getInternalName is private and therefore is inaccessible from the
> jsp, is there a way of accessing this value from the jsp?
No. The names are internal because we want to avoid direct access to the
files. There are several reasons:
* It is possible that files are stored compressed.
* We also have some ideas about making the BASE file system pluggable
(http://base.thep.lu.se/ticket/585). This would, for example, make it
possible to use an FTP server instead of a local disk for file
storage.
* It would allow a client application/plug-in to bypass permission
checks so that a user that has only read permission may delete or
overwrite the file.
If suggest that you copy the file from the JSP or a Java class. Assuming
that you have got the File object and know the destination it should be
as easy as
String destinationPath = ...
File baseFile = ...
OutputStream copy = new FileOutputStream(destinationPath);
FileUtil.copy(baseFile.getDownloadStream(0), copy);
copy.close();
The FTP Server extension mentioned in a previous post may be an option
if you don't want to use Java, but it requires that the username and
password is known by the application (perl script) that does the
copying. Since BASE doesn't store passwords in clear text, this must be
coded into the script or the user must be asked for the values. Also
note that the FTP Server is still in beta-status and is not recommended
for critical production use.
Another option that doesn't depend on Java is to use regular http for
the download. The URL to access a file should be something like:
http://your.webserver.com/base2/filemanager/files/download/-SESSIONID-/path/to/file.txt
where you need to replace
* 'your.webserver.com' with the appropriate host name of the server.
* SESSIONID with the current user's session ID.
Eg. SessionControl.getId();
* /path/to/file.txt: The path to the file as seen in the BASE
web interface. Eg. File.getPath().toString()
/Nicklas
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
The BASE general discussion mailing list
[email protected]
unsubscribe: send a mail with subject "unsubscribe" to
[EMAIL PROTECTED]