You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by SWC <ma...@crissman.net> on 2003/09/24 04:05:13 UTC

Newbie Guidance

I need the guidance of someone more familiar with Tapestry, to tell me 
how to approach the implementation of some functionality I need.

I have a list of files, which will vary depending on user, and be 
listed on a page.  From that page, the user needs to be able to click 
on a download button associated with each file, to download that file.

Thus far, I have the user login working, and am able to pull the 
correct files into the list before the page goes out, by implementing 
PageRenderListener.  I have a Foreach component that correctly  lists 
the file, and its size in a table.  The part I am stuck on is how to 
implement the download functionality.

First, I though I would create a form for each file in the table, and 
in the submit function, select the right file and go from there.  When 
I attempted this approach, I could not find a way to tell which file 
had been selected for download, as each form was calling the on submit, 
and I always seemed to be getting the first file's name, regardless of 
which was chosen.

I then was reading about the AssetService, and thought that I could 
potentially implement a service that would take the file name and 
return the file, but I don't see how to call the Service from within my 
code, and I'm not sure if this is even what I want to do.  It seems 
like I need to write a service link somehow, but I'm a bit lost as to 
how to generate the correct service link for each item in the Foreach.

Anyway, I'm just not sure I'm approaching this from the right angle, 
and am hoping someone can give me some pointers in the right direction, 
even if just to say no, you're going at it all wrong, read up on this 
other thing instead.

Thanks in Advance,

Spencer


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


Re: Newbie Guidance

Posted by Bryan Lewis <br...@maine.rr.com>.
It sounds like you're saying the files are simple static files, like
documents on a file system somewhere.  Why not use static URLs?  (No
Tapestry help needed at all.)  The following works in one of our
production apps for a list of Human Resources documents:

<base href="http://servername.domain.com/">
<table>
<tr>
  <td>
    <a href="hr/handbook/Handbook.pdf"><strong>Handbook</strong></a><br>
  </td>
</tr>


----- Original Message ----- 
From: "SWC" <ma...@crissman.net>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, September 23, 2003 10:05 PM
Subject: Newbie Guidance


> I need the guidance of someone more familiar with Tapestry, to tell me
> how to approach the implementation of some functionality I need.
>
> I have a list of files, which will vary depending on user, and be
> listed on a page.  From that page, the user needs to be able to click
> on a download button associated with each file, to download that file.
>
> Thus far, I have the user login working, and am able to pull the
> correct files into the list before the page goes out, by implementing
> PageRenderListener.  I have a Foreach component that correctly  lists
> the file, and its size in a table.  The part I am stuck on is how to
> implement the download functionality.
>
> First, I though I would create a form for each file in the table, and
> in the submit function, select the right file and go from there.  When
> I attempted this approach, I could not find a way to tell which file
> had been selected for download, as each form was calling the on
submit,
> and I always seemed to be getting the first file's name, regardless of
> which was chosen.
>
> I then was reading about the AssetService, and thought that I could
> potentially implement a service that would take the file name and
> return the file, but I don't see how to call the Service from within
my
> code, and I'm not sure if this is even what I want to do.  It seems
> like I need to write a service link somehow, but I'm a bit lost as to
> how to generate the correct service link for each item in the Foreach.
>
> Anyway, I'm just not sure I'm approaching this from the right angle,
> and am hoping someone can give me some pointers in the right
direction,
> even if just to say no, you're going at it all wrong, read up on this
> other thing instead.
>
> Thanks in Advance,
>
> Spencer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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


Re: Newbie Guidance

Posted by Harish Krishnaswamy <hk...@comcast.net>.
You are certainly on the right path. Only now all your files will have 
to be under the classpath and your path to the file should start with a 
leading slash "/" as opposed to a context path. Hope it helps.

-Harish

SWC wrote:

> The files in question should not be available via regular links.  I 
> need to ensure that someone can't look at a link, and deduce the link 
> to another file and retrieve it.  Because of this, I was looking at 
> the service, where I would then authenticate the user's permission to 
> view the file, and return the file.  It did not appear that I could do 
> this with just a simple link.
>
> I believe I have come upon the correct way to handle this:
> I will try to extend the AssetService, such that it does my 
> authentication prior to returning the asset, and in my for each, will 
> create a ServiceLink which will pass the correct file id as a 
> parameter to the service.
>
> Does this seem reasonable?  Is extending the asset service the way to 
> go?  Can I make the files accessible to the service, yet inaccessible 
> via any other means, or is this a permissions impossiblity?
>
> Thanks for your response, I'm sorry I wasn't completely clear on why a 
> simple link/static files do not work.
>
> Spencer
>
> On Tuesday, September 23, 2003, at 10:36 PM, Harish Krishnaswamy wrote:
>
>> You may want to use a GenericLink. Please see component reference for 
>> more info.
>>
>> -Harish
>>
>> SWC wrote:
>>
>>> I need the guidance of someone more familiar with Tapestry, to tell 
>>> me how to approach the implementation of some functionality I need.
>>>
>>> I have a list of files, which will vary depending on user, and be 
>>> listed on a page.  From that page, the user needs to be able to 
>>> click on a download button associated with each file, to download 
>>> that >> file.
>>>
>>> Thus far, I have the user login working, and am able to pull the 
>>> correct files into the list before the page goes out, by 
>>> implementing PageRenderListener.  I have a Foreach component that 
>>> correctly  lists the file, and its size in a table.  The part I am 
>>> stuck on is how to implement the download functionality.
>>>
>>> First, I though I would create a form for each file in the table, 
>>> and in the submit function, select the right file and go from 
>>> there.  When I attempted this approach, I could not find a way to 
>>> tell which file had been selected for download, as each form was 
>>> calling the on submit, and I always seemed to be getting the first 
>>> file's name, regardless of which was chosen.
>>>
>>> I then was reading about the AssetService, and thought that I could 
>>> potentially implement a service that would take the file name and 
>>> return the file, but I don't see how to call the Service from within 
>>> my code, and I'm not sure if this is even what I want to do.  It 
>>> seems like I need to write a service link somehow, but I'm a bit 
>>> lost as to how to generate the correct service link for each item in 
>>> the Foreach.
>>>
>>> Anyway, I'm just not sure I'm approaching this from the right angle, 
>>> and am hoping someone can give me some pointers in the right 
>>> direction, even if just to say no, you're going at it all wrong, 
>>> read up on this other thing instead.
>>>
>>> Thanks in Advance,
>>>
>>> Spencer
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


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


Re: Newbie Guidance

Posted by SWC <ma...@crissman.net>.
The files in question should not be available via regular links.  I 
need to ensure that someone can't look at a link, and deduce the link 
to another file and retrieve it.  Because of this, I was looking at the 
service, where I would then authenticate the user's permission to view 
the file, and return the file.  It did not appear that I could do this 
with just a simple link.

I believe I have come upon the correct way to handle this:
I will try to extend the AssetService, such that it does my 
authentication prior to returning the asset, and in my for each, will 
create a ServiceLink which will pass the correct file id as a parameter 
to the service.

Does this seem reasonable?  Is extending the asset service the way to 
go?  Can I make the files accessible to the service, yet inaccessible 
via any other means, or is this a permissions impossiblity?

Thanks for your response, I'm sorry I wasn't completely clear on why a 
simple link/static files do not work.

Spencer

On Tuesday, September 23, 2003, at 10:36 PM, Harish Krishnaswamy wrote:

> You may want to use a GenericLink. Please see component reference for 
> more info.
>
> -Harish
>
> SWC wrote:
>
>> I need the guidance of someone more familiar with Tapestry, to tell 
>> me how to approach the implementation of some functionality I need.
>>
>> I have a list of files, which will vary depending on user, and be 
>> listed on a page.  From that page, the user needs to be able to click 
>> on a download button associated with each file, to download that >> file.
>>
>> Thus far, I have the user login working, and am able to pull the 
>> correct files into the list before the page goes out, by implementing 
>> PageRenderListener.  I have a Foreach component that correctly  lists 
>> the file, and its size in a table.  The part I am stuck on is how to 
>> implement the download functionality.
>>
>> First, I though I would create a form for each file in the table, and 
>> in the submit function, select the right file and go from there.  
>> When I attempted this approach, I could not find a way to tell which 
>> file had been selected for download, as each form was calling the on 
>> submit, and I always seemed to be getting the first file's name, 
>> regardless of which was chosen.
>>
>> I then was reading about the AssetService, and thought that I could 
>> potentially implement a service that would take the file name and 
>> return the file, but I don't see how to call the Service from within 
>> my code, and I'm not sure if this is even what I want to do.  It 
>> seems like I need to write a service link somehow, but I'm a bit lost 
>> as to how to generate the correct service link for each item in the 
>> Foreach.
>>
>> Anyway, I'm just not sure I'm approaching this from the right angle, 
>> and am hoping someone can give me some pointers in the right 
>> direction, even if just to say no, you're going at it all wrong, read 
>> up on this other thing instead.
>>
>> Thanks in Advance,
>>
>> Spencer
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>


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


Re: Newbie Guidance

Posted by Harish Krishnaswamy <hk...@comcast.net>.
You may want to use a GenericLink. Please see component reference for 
more info.

-Harish

SWC wrote:

> I need the guidance of someone more familiar with Tapestry, to tell me 
> how to approach the implementation of some functionality I need.
>
> I have a list of files, which will vary depending on user, and be 
> listed on a page.  From that page, the user needs to be able to click 
> on a download button associated with each file, to download that file.
>
> Thus far, I have the user login working, and am able to pull the 
> correct files into the list before the page goes out, by implementing 
> PageRenderListener.  I have a Foreach component that correctly  lists 
> the file, and its size in a table.  The part I am stuck on is how to 
> implement the download functionality.
>
> First, I though I would create a form for each file in the table, and 
> in the submit function, select the right file and go from there.  When 
> I attempted this approach, I could not find a way to tell which file 
> had been selected for download, as each form was calling the on 
> submit, and I always seemed to be getting the first file's name, 
> regardless of which was chosen.
>
> I then was reading about the AssetService, and thought that I could 
> potentially implement a service that would take the file name and 
> return the file, but I don't see how to call the Service from within 
> my code, and I'm not sure if this is even what I want to do.  It seems 
> like I need to write a service link somehow, but I'm a bit lost as to 
> how to generate the correct service link for each item in the Foreach.
>
> Anyway, I'm just not sure I'm approaching this from the right angle, 
> and am hoping someone can give me some pointers in the right 
> direction, even if just to say no, you're going at it all wrong, read 
> up on this other thing instead.
>
> Thanks in Advance,
>
> Spencer
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


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