You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Massimo Lusetti (JIRA)" <de...@tapestry.apache.org> on 2008/03/29 11:46:24 UTC

[jira] Created: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Make usage of expansion within Asset injection and template definition
----------------------------------------------------------------------

                 Key: TAPESTRY-2313
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2313
             Project: Tapestry
          Issue Type: Improvement
          Components: tapestry-core
    Affects Versions: 5.0
         Environment: Any
            Reporter: Massimo Lusetti


It would be great if we could provide a way to use Asset with a dynamic path, known only at runtime.
Typical usage is for asset relative to a product in a online shot where i got the id of the prodcut beeing displayed and want to display the relative image via Asset to benefit of caching and others.
For the records, now the problem is solved using and an action link as the src attribute of img tag and from the action event handler returning a StreamResposne.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Re: [jira] Created: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Posted by Massimo Lusetti <ml...@gmail.com>.
On Tue, Apr 1, 2008 at 7:34 PM, Fernando Padilla <fe...@alum.mit.edu> wrote:

> So.. outside the context and classpath.. wow.
>
>  So how is that accessed then?  Like what would the url point to it and
>  who would handle it and return something?..

Well the point here is not to discuss when or where to have an (apache
httpd) alias which point to the root directory... is how to make the
Asset facility works dynamically to point to the correct asset base on
the product specificied.

Let's say you'have a URL like this /product/218 which is the product
page with activate context 218 that show the product details for
product with ID 218, now i want to put an asset with the product image
lets say ${asset:dynamic:product.path} which is a relative path on the
filesystem which point to the subdir of a predefined root where i got
access to the image file or just using the id to query the db to get
the actual path of the image.

Regards
-- 
Massimo
http://meridio.blogspot.com

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


Re: [jira] Created: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Posted by Fernando Padilla <fe...@alum.mit.edu>.
So.. outside the context and classpath.. wow.

So how is that accessed then?  Like what would the url point to it and 
who would handle it and return something?..

Or is he saying that the clients can access the filesystem directly.. so 
just giving them a "file:///........" url is fine.

If that is the case, I already have a UrlAssetFactory that I can post 
up.  It allows you to create assets with a "url:" prefix, that just 
return the url associated with them.  Allowing absolute urls : 
"url:http://www.google.com/"  or "url:file:///etc/passwd"


Massimo Lusetti wrote:
> On Tue, Apr 1, 2008 at 6:32 PM, Fernando Padilla <fe...@alum.mit.edu> wrote:
> 
>> Well, I can't remember who wanted this functionality, of being able to
>>  generate assets dynamically.  That is actually done through the
>>  AssetSource, which is backed by a list of AssetFactories.  So the could
>>  would look something like the following:
>>
>>
>>  @Inject
>>  private AssetSource source;
>>
>>  public Asset getMyDynamicAsset() {
>>         return source.getAsset( null, "context:/blahblah"+blahblah+"blah", null );
>>
>> }
> 
> Well the asset is actually outiside the context path and outisde the
> classpath. The asset is simply on the filesystem.
> Maybe you're right in term that this reqeust is too specific but it
> could be useful to have a FilesystemAssetFactory configurable via a
> Symbol
> 

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


Re: [jira] Created: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Posted by Massimo Lusetti <ml...@gmail.com>.
On Tue, Apr 1, 2008 at 6:32 PM, Fernando Padilla <fe...@alum.mit.edu> wrote:

> Well, I can't remember who wanted this functionality, of being able to
>  generate assets dynamically.  That is actually done through the
>  AssetSource, which is backed by a list of AssetFactories.  So the could
>  would look something like the following:
>
>
>  @Inject
>  private AssetSource source;
>
>  public Asset getMyDynamicAsset() {
>         return source.getAsset( null, "context:/blahblah"+blahblah+"blah", null );
>
> }

Well the asset is actually outiside the context path and outisde the
classpath. The asset is simply on the filesystem.
Maybe you're right in term that this reqeust is too specific but it
could be useful to have a FilesystemAssetFactory configurable via a
Symbol

-- 
Massimo
http://meridio.blogspot.com

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


Re: [jira] Created: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Posted by Fernando Padilla <fe...@alum.mit.edu>.
Well, I can't remember who wanted this functionality, of being able to 
generate assets dynamically.  That is actually done through the 
AssetSource, which is backed by a list of AssetFactories.  So the could 
would look something like the following:


@Inject
private AssetSource source;

public Asset getMyDynamicAsset() {
	return source.getAsset( null, "context:/blahblah"+blahblah+"blah", null );
}



Massimo Lusetti wrote:
> On Sat, Mar 29, 2008 at 10:38 PM, Fernando Padilla <fe...@alum.mit.edu> wrote:
> 
>> So.. you know you could get the AssetSource, and create the desired
>>  Asset directly, whenever you like..
> 
> You mean AssetFactory which compose the structure behind AssetSource service.
> 

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


Re: [jira] Created: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Posted by Massimo Lusetti <ml...@gmail.com>.
On Sat, Mar 29, 2008 at 10:38 PM, Fernando Padilla <fe...@alum.mit.edu> wrote:

> So.. you know you could get the AssetSource, and create the desired
>  Asset directly, whenever you like..

You mean AssetFactory which compose the structure behind AssetSource service.

-- 
Massimo
http://meridio.blogspot.com

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


Re: [jira] Created: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Posted by Fernando Padilla <fe...@alum.mit.edu>.
So.. you know you could get the AssetSource, and create the desired 
Asset directly, whenever you like..



Massimo Lusetti (JIRA) wrote:
> Make usage of expansion within Asset injection and template definition
> ----------------------------------------------------------------------
> 
>                  Key: TAPESTRY-2313
>                  URL: https://issues.apache.org/jira/browse/TAPESTRY-2313
>              Project: Tapestry
>           Issue Type: Improvement
>           Components: tapestry-core
>     Affects Versions: 5.0
>          Environment: Any
>             Reporter: Massimo Lusetti
> 
> 
> It would be great if we could provide a way to use Asset with a dynamic path, known only at runtime.
> Typical usage is for asset relative to a product in a online shot where i got the id of the prodcut beeing displayed and want to display the relative image via Asset to benefit of caching and others.
> For the records, now the problem is solved using and an action link as the src attribute of img tag and from the action event handler returning a StreamResposne.
> 

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


[jira] Commented: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Posted by "Massimo Lusetti (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12585021#action_12585021 ] 

Massimo Lusetti commented on TAPESTRY-2313:
-------------------------------------------

Maybe another way could be to use the action link event handler to return a url (relative) built on top of assets virtual folder. But that is problematic since you have to eventually deal with context prefix and others development configuration options, i don't know if this is easly handled.

After that the job is ended with a custom factory.

> Make usage of expansion within Asset injection and template definition
> ----------------------------------------------------------------------
>
>                 Key: TAPESTRY-2313
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2313
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.0
>         Environment: Any
>            Reporter: Massimo Lusetti
>
> It would be great if we could provide a way to use Asset with a dynamic path, known only at runtime.
> Typical usage is for asset relative to a product in a online shot where i got the id of the prodcut beeing displayed and want to display the relative image via Asset to benefit of caching and others.
> For the records, now the problem is solved using and an action link as the src attribute of img tag and from the action event handler returning a StreamResposne.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Closed: (TAPESTRY-2313) Make usage of expansion within Asset injection and template definition

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAPESTRY-2313.
------------------------------------------

    Resolution: Won't Fix
      Assignee: Howard M. Lewis Ship

I'm really adverse to mixing and matching the different bindings; anything complicated should go in Java code.

The AssetSource can help with what you want, but isn't quite ideal; perhaps if it had an extra method or two for conveniently obtaining assets from the context.  Worse, the same code that handles the asset: binding prefix also has to handle @Inject @Path private Asset foo (that is, the AssetObjectProvider inside the MasterObjectProvider chain of command).  Expansions and symbols share the same syntax which would be very confusing (that ${...} is a symbol only for asset: or something along those lines).

You can instead inject the AssetFactory (with marker annotation @ContextProvider).  

> Make usage of expansion within Asset injection and template definition
> ----------------------------------------------------------------------
>
>                 Key: TAPESTRY-2313
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2313
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.0
>         Environment: Any
>            Reporter: Massimo Lusetti
>            Assignee: Howard M. Lewis Ship
>
> It would be great if we could provide a way to use Asset with a dynamic path, known only at runtime.
> Typical usage is for asset relative to a product in a online shot where i got the id of the prodcut beeing displayed and want to display the relative image via Asset to benefit of caching and others.
> For the records, now the problem is solved using and an action link as the src attribute of img tag and from the action event handler returning a StreamResposne.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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