You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2005/05/04 22:54:05 UTC

[jira] Created: (TAPESTRY-313) External service --> listener method

External service --> listener method
------------------------------------

         Key: TAPESTRY-313
         URL: http://issues.apache.org/jira/browse/TAPESTRY-313
     Project: Tapestry
        Type: Improvement
  Components: Framework  
    Versions: 4.0    
    Reporter: Howard M. Lewis Ship
     Fix For: 4.0


It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
the IExternalPage interface.

Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)

This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.

In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


Re: [jira] Commented: (TAPESTRY-313) External service --> listener method

Posted by Numa Schmeder <nu...@euroconsumers.com>.
I agree that we should only have a link and linkService, much more  
simple and no misunderstanding between the various link types.  Why  
remove data squeezer in BookmarkLink? They don't add much clutter and  
could simplify the URL. They just need to be easy to register and well  
documented (That was my hardest thing to understand in the beginning of  
tapestry).  The Link and Link service could have a special parameter  
that will be added to the link if this link is statefull , and nothing  
would be added is it is stateless.

Numa

On 5 mai 05, at 02:45, Erik Hatcher (JIRA) wrote:

>      [  
> http://issues.apache.org/jira/browse/TAPESTRY-313? 
> page=comments#action_64542 ]
>
> Erik Hatcher commented on TAPESTRY-313:
> ---------------------------------------
>
> I am for less "magic".  I would like to see the link  
> component/services converge rather than get more complex with more  
> implicit behavior.  Rather than even invoking a listener, just let the  
> page render normally.  Service parameters could be accessed from the  
> PageRenderListener methods or something like that.  Or merge this with  
> your proposed BookmarkLink.
>
> Let's have a Link and LinkService... that's all!  :)
>
>> External service --> listener method
>> ------------------------------------
>>
>>          Key: TAPESTRY-313
>>          URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>>      Project: Tapestry
>>         Type: Improvement
>>   Components: Framework
>>     Versions: 4.0
>>     Reporter: Howard M. Lewis Ship
>>      Fix For: 4.0
>
>>
>> It would be nice if you could use the external service (i.e.,  
>> ExternalLink) with a page that doesn't implement
>> the IExternalPage interface.
>> Instead, it could simply get and invoke the listener named  
>> "activateExternalPage" (or would a different name be more  
>> appropriate?)
>> This would make it easier for "external pages" to access the listener  
>> parameters, since (as a listener method), they can be provided as  
>> Java method parameters.
>> In fact, I would deprecate IExternalPage after implementing this  
>> change.
>
> -- 
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
>
>


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


[jira] Commented: (TAPESTRY-313) External service --> listener method

Posted by "Erik Hatcher (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=comments#action_64542 ]
     
Erik Hatcher commented on TAPESTRY-313:
---------------------------------------

I am for less "magic".  I would like to see the link component/services converge rather than get more complex with more implicit behavior.  Rather than even invoking a listener, just let the page render normally.  Service parameters could be accessed from the PageRenderListener methods or something like that.  Or merge this with your proposed BookmarkLink.

Let's have a Link and LinkService... that's all!  :)

> External service --> listener method
> ------------------------------------
>
>          Key: TAPESTRY-313
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>      Project: Tapestry
>         Type: Improvement
>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>      Fix For: 4.0

>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-313) External service --> listener method

Posted by "Andreas Andreou (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=all ]

Andreas Andreou updated TAPESTRY-313:
-------------------------------------

    Fix Version: 4.0.3
                     (was: 4.0.2)

> External service --> listener method
> ------------------------------------
>
>          Key: TAPESTRY-313
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>      Project: Tapestry
>         Type: Improvement

>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>      Fix For: 4.0.3

>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-313) External service --> listener method

Posted by "sorphi (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=comments#action_12415523 ] 

sorphi commented on TAPESTRY-313:
---------------------------------

Very nice, I have implemented a same idea with it recently.

refer:http://forum.javaeye.com/viewtopic.php?t=20744

Objective:

    1/page specifiaction
   Test.page 

<page-specification> 
  <property name="testProperty1"/> 
  <property name="testProperty2"/> 
  <property name="testProperty3"/> 
  <property name="testProperty4"/> 
  <component id="parameterBinder" type="ParameterBinder"> 
    <binding name="p1" value="ognl:testProperty1"/> 
    <binding name="p2" value="ognl:testProperty2"/> 
    <binding name="p3" value="ognl:testProperty3"/> 
    <binding name="p4" value="ognl:testProperty4"/> 
  </component> 
</page-specification>
 


2/page template

Test.html 

<span jwcid="@Insert" value="ognl:testProperty1">testProperty1</span><br> 
<span jwcid="@Insert" value="ognl:testProperty2">testProperty2</span><br> 
<span jwcid="@Insert" value="ognl:testProperty3">testProperty3</span><br> 
<span jwcid="@Insert" value="ognl:testProperty4">testProperty4</span><br> 


<a href="#" jwcid="@ParameterizedLink" page="literal:Test" parameterBinder="component:parameterBinder">this page</a>
 
3/URL 
http://host/Test.external?p1=Sstring&p2=d123.0&p3=123&p4=f123.0 




Implements:

1/ Define a ParameterBinder component.

public abstract class ParameterBinder extends AbstractComponent { 
  protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { 
  } 
} 

<component-specification class="tapestry.jwc.ParameterBinder" allow-body="no" allow-informal-parameters="yes"> 
</component-specification>
 
2/ Define a ParameterizedLink component like ExternalLink 

public abstract class ParameterizedLink extends AbstractLinkComponent { 
  public abstract IEngineService getParameterizedService(); 

  public ILink getLink(IRequestCycle cycle) { 
    Map parameters = null; 
    ParameterBinder binder = getParameterBinder(); 
    if (binder != null) { 
      Map bindingMap = binder.getBindings(); 
      parameters = new HashMap(bindingMap.size()); 
      for (Iterator i = bindingMap.entrySet().iterator(); i.hasNext(); ) { 
        Map.Entry entry = (Map.Entry) i.next(); 
        String bindingName = (String) entry.getKey(); 
        IBinding binding = (IBinding) entry.getValue(); 
        parameters.put(bindingName, binding.getObject()); 
      } 
    } 
    else { 
      parameters = Collections.EMPTY_MAP; 
    } 

    ParameterizedServiceParameter psp = new ParameterizedServiceParameter( 
        getTargetPage(), 
        parameters); 

    return getParameterizedService().getLink(false, psp); 
  } 

  public abstract String getTargetPage(); 

  public abstract ParameterBinder getParameterBinder(); 

} 

<component-specification class="tapestry.jwc.ParameterizedLink"> 
  <description>Creates link using the parameterized service, which can pass service parameters to the targeted page and autobind those.</description> 
  <parameter name="page" required="yes" property="targetPage"/> 
  <parameter name="parameterBinder"/> 
.... 
</component-specification>
 

3/ Define a ParameterizedService egine service like ExternalService

    private String _parameterBinderId = "parameterBinder";// could inject other id name by hivemind

  public void service(IRequestCycle cycle) throws IOException { 
    String pageName = cycle.getParameter(ServiceConstants.PAGE); 
    IPage rawPage = cycle.getPage(pageName); 

    cycle.activate(rawPage); 

    autoBindParameters(cycle, rawPage); 

    _responseRenderer.renderResponse(cycle); 
  } 

  private void autoBindParameters(IRequestCycle cycle, 
                                  IPage page) { 

    ParameterBinder binder = (ParameterBinder) page 
                             .getComponents().get(_parameterBinderId); 
    if (binder == null) { 
      return; 
    } 
    if (LOG.isDebugEnabled()) { 
      LOG.debug("Begin binding parameters by component " + binder.getId()); 
    } 
    Map bindingMap = binder.getBindings(); 
    for (Iterator i = bindingMap.entrySet().iterator(); i.hasNext(); ) { 
      Map.Entry entry = (Map.Entry) i.next(); 
      String bindingName = (String) entry.getKey(); 
      IBinding binding = (IBinding) entry.getValue(); 
      String rawValue = cycle.getParameter(bindingName); 
      if (rawValue != null) { 
        Object value = _dataSqueezer.unsqueeze(rawValue); 
        binding.setObject(value); 
        if (LOG.isDebugEnabled()) { 
          LOG.debug("bindingName:" + bindingName); 
          LOG.debug("binding:" + binding); 
          LOG.debug("parameter value:" + value); 
        } 
      } 
    } 
  }
 
Shortage:
 
1.Each page which required parameter auto bind function , need declare a ParameterBinder with special ID

2.ParameterBinder cannot bind some reserved parameter name, such as page/id etc. So, parameters in URL cannot use these name.

3. Hardcode parameter literal value should abide with DateSqueezer speciafication.





> External service --> listener method
> ------------------------------------
>
>          Key: TAPESTRY-313
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>      Project: Tapestry
>         Type: Improvement

>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>      Fix For: 4.1

>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-313) External service --> listener method

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=all ]

Jesse Kuhnert updated TAPESTRY-313:
-----------------------------------

    Fix Version: 4.1
                     (was: 4.0.3)

> External service --> listener method
> ------------------------------------
>
>          Key: TAPESTRY-313
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>      Project: Tapestry
>         Type: Improvement

>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>      Fix For: 4.1

>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-313) External service --> listener method

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=all ]

Jesse Kuhnert updated TAPESTRY-313:
-----------------------------------

    Fix Version: 4.0.2
                     (was: 4.0)
    Description: 
It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
the IExternalPage interface.

Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)

This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.

In fact, I would deprecate IExternalPage after implementing this change.

  was:
It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
the IExternalPage interface.

Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)

This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.

In fact, I would deprecate IExternalPage after implementing this change.

    Environment: 

> External service --> listener method
> ------------------------------------
>
>          Key: TAPESTRY-313
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>      Project: Tapestry
>         Type: Improvement
>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>      Fix For: 4.0.2

>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-313) External service --> listener method

Posted by "Henri Dupre (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=comments#action_64519 ]
     
Henri Dupre commented on TAPESTRY-313:
--------------------------------------

If that service will be changed, It would be really nice to have support for named parameters instead of having an array of objects. With named parameters, it would be much easier to evolve the specs of a page. Could the external component be smarter and send named parameters? And the activateExternalPage have as parameter somekind of map to retrieve the named paramters?

> External service --> listener method
> ------------------------------------
>
>          Key: TAPESTRY-313
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>      Project: Tapestry
>         Type: Improvement
>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>      Fix For: 4.0

>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TAPESTRY-313) External service --> listener method

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=comments#action_64526 ]
     
Howard M. Lewis Ship commented on TAPESTRY-313:
-----------------------------------------------

I'm thinking of a new engine service / component combo for that:  BookmarkLink and bookmark service.

The BookmarkLink would be given a list of proeprties of the page to encode into the URL, and possible a map of property / value pairs.  It would generate a very reasonable URL.  The values would be simple strings, no data-squeezer (so you'd be limited to basic data types).

I think a typical link would end up looking like:

/Home.html?blogId=37

This URL would get the Home page, set its blogId property to 37, and activate it to render the response.

> External service --> listener method
> ------------------------------------
>
>          Key: TAPESTRY-313
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>      Project: Tapestry
>         Type: Improvement
>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>      Fix For: 4.0

>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TAPESTRY-313) External service --> listener method

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=all ]

Jesse Kuhnert updated TAPESTRY-313:
-----------------------------------

    Fix Version/s: 4.1.1
                       (was: 4.1)

> External service --> listener method
> ------------------------------------
>
>                 Key: TAPESTRY-313
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 4.0
>            Reporter: Howard M. Lewis Ship
>             Fix For: 4.1.1
>
>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (TAPESTRY-313) External service --> listener method

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-313?page=all ]

Jesse Kuhnert updated TAPESTRY-313:
-----------------------------------

    Fix Version/s: 4.2
                       (was: 4.1.1)

> External service --> listener method
> ------------------------------------
>
>                 Key: TAPESTRY-313
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-313
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 4.0
>            Reporter: Howard M. Lewis Ship
>             Fix For: 4.2
>
>
> It would be nice if you could use the external service (i.e., ExternalLink) with a page that doesn't implement
> the IExternalPage interface.
> Instead, it could simply get and invoke the listener named "activateExternalPage" (or would a different name be more appropriate?)
> This would make it easier for "external pages" to access the listener parameters, since (as a listener method), they can be provided as Java method parameters.
> In fact, I would deprecate IExternalPage after implementing this change.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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