You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Dawn <pe...@gmail.com> on 2007/05/30 00:52:47 UTC

Remote File Generation

guys,

i am using tap3. i am using postgres as my backend.

now my web app can be accessed remotely by users, who can then perform
certain functions like postgres database backup and restore.

now my problem is that when the database backup is performed using
pg_dump, the file is dumped on the local server. how can i let
somebody access this function remotely, tap executes pg_dump on the
server, and then dumps the file on the remote users computer and not
the local server. for pg_dump, i am executing the pg_dump on the local
servers command line, but from within tap.

any ideas how i can get this to work. thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Remote File Generation

Posted by Jesse Kuhnert <jk...@gmail.com>.
I think this is just not possible.  At most you can specify the file name
that they can save something as,  but there is absolutely no way of getting
around this with http protocols and a web browser.

Maybe you should investigate writing a java applet or web start app ?  I'd
certainly like everyone to use Tapestry as much as possible but it just
doesn't sound like the right fit for what you are doing.

Either way the correct http header to set is something along the lines of:

Content-disposition: attachment; filename=fname.ext



On 5/29/07, Peter Dawn <pe...@gmail.com> wrote:
>
> thats cool. how do i specify the client ip address.
> c:\windows\system32 is going to reference the server file system.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Re: Remote File Generation

Posted by Peter Dawn <pe...@gmail.com>.
thats cool. how do i specify the client ip address.
c:\windows\system32 is going to reference the server file system.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Remote File Generation

Posted by Martin Strand <do...@gmail.com>.
Yeah, you can just use:

WebResponse response = ...;
InputStream in = new FileInputStream(...);
response.writeToClientFilesystem("C:\WINDOWS\system32\...", in);

I don't have such a component finished but it should be pretty  
straightforward to add this functionality to a regular TextField.

Martin

On Wed, 30 May 2007 01:25:25 +0200, Peter Dawn <pe...@gmail.com> wrote:

> the Upload component allows the transfer of files from client to
> server. is there something which does the other way around, and how
> should i specify the remote target folder location, i mean using ip
> address or server name.
>
> thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Remote File Generation

Posted by Peter Dawn <pe...@gmail.com>.
the Upload component allows the transfer of files from client to
server. is there something which does the other way around, and how
should i specify the remote target folder location, i mean using ip
address or server name.

thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Remote File Generation

Posted by Peter Dawn <pe...@gmail.com>.
Cheers mate. Thanks for your reply, I understand that its not tap
specific, but this forum is my first place for help in all tap web app
related issues :-).

the users are not that technically savvy. so i will have to go for
option 1. but my question is, is there a way to automatically
reference a remote users file system, using their IP address. the
nature of web apps is that it restricts access to their local file
system, but just copying files is just like using FTP, i dont think it
will be a permissions issue then.

so i can reference files on the server using the file address, but
when i am copying the files, how do i specify the address of the
remote computer. i mean should i go ipaddress\c:\

either way i will look up some tap documentation on this and see if
tap does something similar to this.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Remote File Generation

Posted by Alan Chaney <al...@compulsivecreative.com>.
It seems to me that this is not really a Tapestry issue. I can see two 
ways - there may be lots more.

A lot depends on exactly who the users are, how often they take backups, 
their technical competence and the size of the backups.

Suggestions:

1. Ensure that your application writes the file to a well known location 
on your server using some kind of unique file name. Provide a tapestry 
service which streams the file to the user if they access a specific URL 
passing an identifier which you can associate with the backup file. This 
service would be pretty similar to the kind of service used to download 
images/audio. Depending upon the size of the database you might need to 
have two separate steps - one to generate the file and notify the user 
it is ready and the other for them to download the finished product. It 
may be worth zipping it unless you are using the postgres cdb format.

2. Create a 'backup user' for each database and let them connect 
directly to the database using one of the many free open source tools 
for postgres and take their backups that way using the pretty 
sophisticated access control mechanisms in PG to make sure that users 
only get data they are entitled to.

Hope that helps

Alan Chaney

Peter Dawn wrote:
> guys,
>
> i am using tap3. i am using postgres as my backend.
>
> now my web app can be accessed remotely by users, who can then perform
> certain functions like postgres database backup and restore.
>
> now my problem is that when the database backup is performed using
> pg_dump, the file is dumped on the local server. how can i let
> somebody access this function remotely, tap executes pg_dump on the
> server, and then dumps the file on the remote users computer and not
> the local server. for pg_dump, i am executing the pg_dump on the local
> servers command line, but from within tap.
>
> any ideas how i can get this to work. thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org